system_assignation/city_model_structure/iot/sensor.py

77 lines
1.3 KiB
Python
Raw Normal View History

"""
Sensor module
SPDX - License - Identifier: LGPL - 3.0 - or -later
2022-03-08 19:19:52 -05:00
Copyright © 2020 Project Author Guille Gutierrez guillermo.gutierrezmorote@concordia.ca
"""
2022-03-08 19:19:52 -05:00
from helpers.location import Location
2021-06-01 19:03:55 -04:00
class Sensor:
"""
Sensor abstract class
"""
2022-03-08 19:19:52 -05:00
def __init__(self):
self._name = None
self._type = None
self._units = None
self._location = None
@property
2022-03-08 19:19:52 -05:00
def name(self):
"""
2022-03-08 19:19:52 -05:00
Get sensor name
:return: str
"""
2022-03-08 19:19:52 -05:00
if self._name is None:
raise ValueError('Undefined sensor name')
return self._name
@name.setter
def name(self, value):
"""
Set sensor name
:param value: str
"""
if value is not None:
self._name = str(value)
@property
2022-03-08 19:19:52 -05:00
def type(self):
"""
Get sensor type
2022-03-08 19:19:52 -05:00
:return: str
"""
return self._type
@property
2022-03-08 19:19:52 -05:00
def units(self):
"""
2022-03-08 19:19:52 -05:00
Get sensor units
:return: str
"""
2022-03-08 19:19:52 -05:00
return self._units
@property
2022-03-08 19:19:52 -05:00
def location(self) -> Location:
"""
2022-03-08 19:19:52 -05:00
Get sensor location
:return: Location
"""
2022-03-08 19:19:52 -05:00
return self._location
2022-03-08 19:19:52 -05:00
@location.setter
def location(self, value):
"""
2022-03-08 19:19:52 -05:00
Set sensor location
:param value: Location
"""
2022-03-08 19:19:52 -05:00
self._location = value
@property
2022-03-08 19:19:52 -05:00
def measures(self):
"""
2021-09-01 09:39:27 -04:00
Raises not implemented error
"""
2022-03-08 19:19:52 -05:00
raise NotImplementedError