Index: leahi_dialin/fp/filtration_purification.py =================================================================== diff -u -rfc66ce51dca2af3afb1de1426f3eb1cf5285d66f -rf03c9a32180573f2430105ad69eb91d9f597a96b --- leahi_dialin/fp/filtration_purification.py (.../filtration_purification.py) (revision fc66ce51dca2af3afb1de1426f3eb1cf5285d66f) +++ leahi_dialin/fp/filtration_purification.py (.../filtration_purification.py) (revision f03c9a32180573f2430105ad69eb91d9f597a96b) @@ -37,7 +37,8 @@ from ..common.msg_defs import MsgIds, MsgFieldPositions, MsgFieldPositionsFWVersions from ..common.override_templates import cmd_generic_broadcast_interval_override, cmd_generic_override from ..protocols.CAN import DenaliMessage, DenaliCanMessenger, DenaliChannels -from ..utils.base import AbstractSubSystem, publish, LogManager +from leahi_dialin.utils.abstract_classes import AbstractSubSystem +from leahi_dialin.utils.base import publish, LogManager from ..utils.conversions import integer_to_bytearray, bytearray_to_byte Index: leahi_dialin/fp/modules/alarms.py =================================================================== diff -u -r20c821bd230fc7689a0275a2918981669ff5cc19 -rf03c9a32180573f2430105ad69eb91d9f597a96b --- leahi_dialin/fp/modules/alarms.py (.../alarms.py) (revision 20c821bd230fc7689a0275a2918981669ff5cc19) +++ leahi_dialin/fp/modules/alarms.py (.../alarms.py) (revision f03c9a32180573f2430105ad69eb91d9f597a96b) @@ -22,8 +22,9 @@ from leahi_dialin.common import fp_enum_repository 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.protocols.CAN import DenaliMessage, DenaliChannels -from leahi_dialin.utils.base import AbstractSubSystem, 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 @@ -35,7 +36,7 @@ START_POS_ALARM_ID = DenaliMessage.PAYLOAD_START_INDEX END_POS_ALARM_ID = START_POS_ALARM_ID + 2 - def __init__(self, can_interface, logger: Logger): + def __init__(self, can_interface: DenaliCanMessenger, logger: Logger): """ @param can_interface: Denali Can Messenger object """ @@ -65,8 +66,8 @@ self.alarm_data_type = dict() #: The Alarm's Data type in dict format # Loop through the list of the event data type enum and update the dictionary - for data_type in fp_enum_repository.FPEventDataTypes: - event_data_type = fp_enum_repository.FPEventDataTypes(data_type).name + for data_type in fp_enum_repository.DataTypes: + event_data_type = fp_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 @@ -96,13 +97,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[fp_enum_repository.FPEventDataTypes(data_typ_1[0]).name] + struct_data_type_1 = self.alarm_data_type[fp_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[fp_enum_repository.FPEventDataTypes(data_typ_2[0]).name] + struct_data_type_2 = self.alarm_data_type[fp_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])) Index: leahi_dialin/fp/modules/boost_pump.py =================================================================== diff -u -r99f9233b24e6115bb1384ec8f5a077aefc37ab4b -rf03c9a32180573f2430105ad69eb91d9f597a96b --- leahi_dialin/fp/modules/boost_pump.py (.../boost_pump.py) (revision 99f9233b24e6115bb1384ec8f5a077aefc37ab4b) +++ leahi_dialin/fp/modules/boost_pump.py (.../boost_pump.py) (revision f03c9a32180573f2430105ad69eb91d9f597a96b) @@ -21,8 +21,9 @@ from leahi_dialin.common import fp_enum_repository 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.protocols.CAN import DenaliChannels -from leahi_dialin.utils.base import AbstractSubSystem, publish +from leahi_dialin.protocols.CAN import DenaliCanMessenger, 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 @@ -31,7 +32,7 @@ Dialin API sub-class for FP Boost pump controller related commands. """ - def __init__(self, can_interface, logger: Logger): + def __init__(self, can_interface: DenaliCanMessenger, logger: Logger): """ FPBoostPump constructor """ Index: leahi_dialin/fp/modules/conductivity_sensors.py =================================================================== diff -u -r70ede35f42770305f04b251b3372ef42a9cecbf5 -rf03c9a32180573f2430105ad69eb91d9f597a96b --- leahi_dialin/fp/modules/conductivity_sensors.py (.../conductivity_sensors.py) (revision 70ede35f42770305f04b251b3372ef42a9cecbf5) +++ leahi_dialin/fp/modules/conductivity_sensors.py (.../conductivity_sensors.py) (revision f03c9a32180573f2430105ad69eb91d9f597a96b) @@ -22,8 +22,9 @@ from leahi_dialin.common.fp_defs import BETA_IOFP_COND_SENSOR_OFFSET 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.protocols.CAN import DenaliChannels -from leahi_dialin.utils.base import AbstractSubSystem, publish +from leahi_dialin.protocols.CAN import DenaliCanMessenger, 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 @@ -32,7 +33,7 @@ Dialin API sub-class for conductivity sensors related commands. """ - def __init__(self, can_interface, logger: Logger): + def __init__(self, can_interface: DenaliCanMessenger, logger: Logger): """ @param can_interface: Denali Can Messenger object """ Index: leahi_dialin/fp/modules/events.py =================================================================== diff -u -r20c821bd230fc7689a0275a2918981669ff5cc19 -rf03c9a32180573f2430105ad69eb91d9f597a96b --- leahi_dialin/fp/modules/events.py (.../events.py) (revision 20c821bd230fc7689a0275a2918981669ff5cc19) +++ leahi_dialin/fp/modules/events.py (.../events.py) (revision f03c9a32180573f2430105ad69eb91d9f597a96b) @@ -21,8 +21,9 @@ from leahi_dialin.common import fp_enum_repository from leahi_dialin.common.msg_defs import MsgIds, MsgFieldPositions -from leahi_dialin.protocols.CAN import DenaliChannels -from leahi_dialin.utils.base import AbstractSubSystem, publish +from leahi_dialin.protocols.CAN import DenaliCanMessenger, DenaliChannels, DenaliCanMessenger +from leahi_dialin.utils.abstract_classes import AbstractSubSystem +from leahi_dialin.utils.base import publish class FPEvents(AbstractSubSystem): @@ -31,24 +32,23 @@ """ UNKNOWN_STATE = "UNKNOWN_PREVIOUS_STATE" - def __init__(self, can_interface, logger: Logger): + def __init__(self, can_interface: DenaliCanMessenger, logger: Logger): """ @param can_interface: Denali CAN Messenger object """ super().__init__() - self.can_interface = can_interface + self.can_interface: DenaliCanMessenger = can_interface self.logger = logger if self.can_interface is not None: - channel_id = DenaliChannels.fp_sync_broadcast_ch_id - self.msg_id_fp_event = MsgIds.MSG_ID_FP_EVENT.value - self.can_interface.register_receiving_publication_function(channel_id, self.msg_id_fp_event, self._handler_events_sync) + self.can_interface.register_receiving_publication_function(channel_id = DenaliChannels.fp_sync_broadcast_ch_id, + message_id = MsgIds.MSG_ID_FP_EVENT.value, + function = self._handler_events_sync) - channel_id = DenaliChannels.fp_sync_broadcast_ch_id - self.msg_id_fp_op_mode_data = MsgIds.MSG_ID_FP_OP_MODE_DATA.value - self.can_interface.register_receiving_publication_function(channel_id, self.msg_id_fp_op_mode_data, - self._handler_fp_op_mode_sync) + self.can_interface.register_receiving_publication_function(channel_id = DenaliChannels.fp_sync_broadcast_ch_id, + message_id = MsgIds.MSG_ID_FP_OP_MODE_DATA.value, + function = self._handler_fp_op_mode_sync) self.fp_events_timestamp = 0.0 #: The timestamp of the last Event message self.fp_event_op_mode = 0 #: The new Operation Mode value @@ -76,8 +76,8 @@ self._fp_event_dictionary[fp_enum_repository.FPEventList(event).name] = [] # Loop through the list of the event data type enum and update the dictionary - for data_type in fp_enum_repository.FPEventDataTypes: - event_data_type = fp_enum_repository.FPEventDataTypes(data_type).name + for data_type in fp_enum_repository.DataTypes: + event_data_type = fp_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 @@ -173,7 +173,7 @@ # Get the data type event_data_type_1 = struct.unpack('i', bytearray( message['message'][MsgFieldPositions.START_POS_FIELD_2:MsgFieldPositions.END_POS_FIELD_2]))[0] - struct_data_type = self._fp_event_data_type[fp_enum_repository.FPEventDataTypes(event_data_type_1).name] + struct_data_type = self._fp_event_data_type[fp_enum_repository.DataTypes(event_data_type_1).name] op_mode = struct.unpack('