city_retrofit/hub/city_model_structure/iot/station.py

46 lines
943 B
Python
Raw Permalink Normal View History

2022-03-24 19:06:47 -04:00
"""
2023-05-30 17:13:49 -04:00
Station module
2022-03-24 19:06:47 -04:00
SPDX - License - Identifier: LGPL - 3.0 - or -later
Copyright © 2022 Concordia CERC group
Project Coder Guille Gutierrez guillermo.gutierrezmorote@concordia.ca
2022-03-24 19:06:47 -04:00
"""
import uuid
2023-01-24 10:51:50 -05:00
from hub.city_model_structure.iot.sensor import Sensor
2022-03-24 19:06:47 -04:00
class Station:
2023-05-30 17:13:49 -04:00
"""
Station class
"""
2022-03-24 19:06:47 -04:00
def __init__(self, station_id=None, _mobile=False):
self._id = station_id
self._mobile = _mobile
self._sensors = []
@property
def id(self):
"""
Get the station id a random uuid will be assigned if no ID was provided to the constructor
2023-05-17 17:10:30 -04:00
:return: ID
2022-03-24 19:06:47 -04:00
"""
if self._id is None:
self._id = uuid.uuid4()
return self._id
@property
def mobile(self):
2022-03-24 19:06:47 -04:00
"""
Get if the station is mobile or not
:return: bool
"""
return self._mobile
@property
def sensors(self) -> [Sensor]:
"""
Get the sensors belonging to the station
:return: [Sensor]
"""
return self._sensors