Index: leahi_dialin/td/modules/switches.py =================================================================== diff -u -r1f2bf6d939eb4033dbedb7d7005494cc12fccbc6 -r3f4937e339925dde0b95f08e49969f8983c5cba4 --- leahi_dialin/td/modules/switches.py (.../switches.py) (revision 1f2bf6d939eb4033dbedb7d7005494cc12fccbc6) +++ leahi_dialin/td/modules/switches.py (.../switches.py) (revision 3f4937e339925dde0b95f08e49969f8983c5cba4) @@ -20,7 +20,7 @@ # Project imports from leahi_dialin.common.constants import NO_RESET from leahi_dialin.common.generic_defs import DataTypes -from leahi_dialin.common.msg_defs import MsgIds +from leahi_dialin.common.msg_ids import MsgIds from leahi_dialin.common.override_templates import cmd_generic_broadcast_interval_override, cmd_generic_override from leahi_dialin.common import td_enum_repository from leahi_dialin.protocols.CAN import CanMessenger, CanChannels @@ -50,10 +50,25 @@ self.td_switches_timestamp = 0.0 #: The timestamp of the latest message - # The Switches data in dictionary format self.td_switches_status = { td_enum_repository.TDSwitchNames.H9_FRONT_DOOR.name: td_enum_repository.TDSwitchStatus.CLOSED.value } + +# ============================================================ Properties ============================================================ + @property + def td_switches_status(self) -> dict: + """ + The current Switches data + """ + return self._switches + + @td_switches_status.setter + def td_switches_status(self, value): + self._switches = value + + + +# ============================================================ Handlers ============================================================ @publish(["msg_id_td_switches_data", "td_switches_status", "td_switches_timestamp"]) def _handler_switches_sync(self, message, timestamp=0.0): """ @@ -62,15 +77,15 @@ @param message: published switches data message @return: none """ - sensor_list =[] - sensor_list.append((td_enum_repository.TDSwitchNames.H9_FRONT_DOOR.name, DataTypes.U32)) + msg_list =[] + msg_list.append((self.td_switches_status, td_enum_repository.TDSwitchNames.H9_FRONT_DOOR.name, DataTypes.U32)) - self.process_into_dict(dict_to_update = self.td_switches_status, - decoder_list = sensor_list, - message = message) + self.process_into_vars(decoder_list = msg_list, message = message) self.td_switches_timestamp = timestamp + +# ============================================================ Overrides and Requests ============================================================ def cmd_switches_data_broadcast_interval_override(self, ms: int, reset: int = NO_RESET) -> int: """ Constructs and sends the TD switch data publication override command.