2021-10-06 21:43:18 +02:00
|
|
|
from enum import Enum
|
|
|
|
|
|
|
|
|
2021-12-03 17:43:59 +01:00
|
|
|
class Directions(str, Enum):
|
2021-10-07 01:37:48 +02:00
|
|
|
INSIDE = "indoor"
|
|
|
|
OUTSIDE = "outdoor"
|
|
|
|
|
2021-10-07 12:39:09 +02:00
|
|
|
def other(direction: 'Direction') -> 'Direction':
|
2021-10-07 01:37:48 +02:00
|
|
|
if direction is Directions.INSIDE:
|
|
|
|
return Directions.OUTSIDE
|
|
|
|
else:
|
|
|
|
return Directions.INSIDE
|
|
|
|
|
2021-10-07 12:39:09 +02:00
|
|
|
def __iter__():
|
|
|
|
return [Directions.INSIDE, Directions.OUTSIDE]
|
2021-10-06 21:43:18 +02:00
|
|
|
|
|
|
|
|
|
|
|
class ToFSensor:
|
2021-10-07 01:37:48 +02:00
|
|
|
def open(self) -> None:
|
2021-10-06 21:43:18 +02:00
|
|
|
raise NotImplementedError()
|
|
|
|
|
2021-10-07 01:37:48 +02:00
|
|
|
def setDirection(self, direction: Directions) -> None:
|
2021-10-06 21:43:18 +02:00
|
|
|
"""Configure sensor to pick up the distance in a specific direction.
|
|
|
|
"""
|
|
|
|
raise NotImplementedError()
|
|
|
|
|
|
|
|
def getDistance(self) -> float:
|
|
|
|
"""Returns new distance in cm.
|
|
|
|
"""
|
|
|
|
raise NotImplementedError()
|
2021-10-07 01:37:48 +02:00
|
|
|
|
|
|
|
def close(self) -> None:
|
2021-10-06 21:43:18 +02:00
|
|
|
raise NotImplementedError()
|