mdx.mtmc.stream.state.sensor module

class StateManager

Bases: object

Module to manage sensor state

sensor_state = StateManager()
get_sensor_state_objects() Dict[str, SensorStateObject]

Gets a map from all the sensor IDs to sensor state objects in state

Returns:

map from sensor IDs to sensor state objects

Return type:

Dict[str,SensorStateObject]

sensor_state_objects = sensor_state.get_sensor_state_objects()
init_state(calibrator: Calibrator, calibration_path: str) None

Initializes state with existing calibration info

Parameters:
  • calibrator (Calibrator) – calibrator used to create sensor state objects

  • calibration_path (str) – path to the calibration file in JSON format

Returns:

None

sensor_state.init_state(calibrator, calibration_path)
update_state(notifications: List[Notification], calibrator: Calibrator) Set[str]

Updates sensor state

Parameters:
  • notifications (List[Notification]) – list of notifications

  • calibrator (Calibrator) – calibrator used to convert sensors to sensor state objects

Returns:

updated sensor IDs

Return type:

Set[str]

updated_sensor_ids = sensor_state.update_state(notifications, calibrator)