Index: leahi_dialin/td/modules/alarms.py =================================================================== diff -u -r47a803c6dd859a5bcc7a6c82e0cb160c350473ea -rf03c9a32180573f2430105ad69eb91d9f597a96b --- leahi_dialin/td/modules/alarms.py (.../alarms.py) (revision 47a803c6dd859a5bcc7a6c82e0cb160c350473ea) +++ leahi_dialin/td/modules/alarms.py (.../alarms.py) (revision f03c9a32180573f2430105ad69eb91d9f597a96b) @@ -23,9 +23,11 @@ from leahi_dialin.common.msg_defs import MsgIds, MsgFieldPositions 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 DenaliMessage, DenaliChannels -from leahi_dialin.utils.base import AbstractSubSystem, DialinEnum, publish +from leahi_dialin.protocols.CAN import DenaliCanMessenger, DenaliMessage, DenaliChannels +from leahi_dialin.utils.abstract_classes import AbstractSubSystem +from leahi_dialin.utils.base import publish from leahi_dialin.utils.conversions import integer_to_bytearray, float_to_bytearray +from leahi_dialin.utils.enums import DialinEnum class TDAlarms(AbstractSubSystem): @@ -69,7 +71,7 @@ START_POS_ALARMS_FLAGS = END_POS_ALARM_SILENCE_EXPIRES_IN END_POS_ALARMS_FLAGS = START_POS_ALARMS_FLAGS + 2 - def __init__(self, can_interface, logger: Logger): + def __init__(self, can_interface: DenaliCanMessenger, logger: Logger): """ @param can_interface: Denali Can Messenger object """ @@ -143,8 +145,8 @@ self.ui_alarm_list_timestamp = 0.0 #: The timestamp of the last Alarm List # Loop through the list of the event data type enum and update the dictionary - for data_type in td_enum_repository.TDEventDataTypes: - event_data_type = td_enum_repository.TDEventDataTypes(data_type).name + for data_type in td_enum_repository.DataTypes: + event_data_type = td_enum_repository.DataTypes(data_type).name struct_unpack_type = None # If U32 is in the data type enum (i.e. EVENT_DATA_TYPE_U32), then the key is the enum and the value is @@ -204,13 +206,13 @@ data_typ_1 = struct.unpack('i', bytearray(message['message'][MsgFieldPositions.START_POS_FIELD_2:MsgFieldPositions.END_POS_FIELD_2])) # Get the corresponding structure format - struct_data_type_1 = self.alarm_data_type[td_enum_repository.TDEventDataTypes(data_typ_1[0]).name] + struct_data_type_1 = self.alarm_data_type[td_enum_repository.DataTypes(data_typ_1[0]).name] # Get the data value by unpacking the data type data_1 = struct.unpack(struct_data_type_1, bytearray(message['message'][MsgFieldPositions.START_POS_FIELD_3:MsgFieldPositions.END_POS_FIELD_3])) data_typ_2 = struct.unpack('i', bytearray(message['message'][MsgFieldPositions.START_POS_FIELD_4:MsgFieldPositions.END_POS_FIELD_4])) # Get the corresponding structure format - struct_data_type_2 = self.alarm_data_type[td_enum_repository.TDEventDataTypes(data_typ_2[0]).name] + struct_data_type_2 = self.alarm_data_type[td_enum_repository.DataTypes(data_typ_2[0]).name] # Get the data value by unpacking the data type data_2 = struct.unpack(struct_data_type_2, bytearray(message['message'][MsgFieldPositions.START_POS_FIELD_5:MsgFieldPositions.END_POS_FIELD_5]))