Index: dialin/dg/accelerometer.py =================================================================== diff -u -racd09d02879e8add4cf7f694f5db8e423a76c341 -rceb2d67297d31ac7c816f01cd4f836f071c1d39a --- dialin/dg/accelerometer.py (.../accelerometer.py) (revision acd09d02879e8add4cf7f694f5db8e423a76c341) +++ dialin/dg/accelerometer.py (.../accelerometer.py) (revision ceb2d67297d31ac7c816f01cd4f836f071c1d39a) @@ -62,7 +62,7 @@ msg_id = MsgIds.MSG_ID_DG_ACCELEROMETER_DATA.value self.can_interface.register_receiving_publication_function(channel_id, msg_id, self._handler_accelerometer_sync) - + self.dg_accel_timestamp = 0.0 self.vector = self.AccelerometerVector() self.vector_max = self.AccelerometerVector() self.tilts = self.AccelerometerVector() @@ -89,11 +89,12 @@ return self.tilts @publish([ + "dg_accel_timestamp", "vector", "vector_max", "tilts" ]) - def _handler_accelerometer_sync(self, message): + def _handler_accelerometer_sync(self, message, timestamp = 0.0): """ Handles published accelerometer data messages. Accelerometer data are captured for reference. @@ -125,6 +126,7 @@ z = struct.unpack('f', bytearray( message['message'][MsgFieldPositions.START_POS_FIELD_9:MsgFieldPositions.END_POS_FIELD_9])) self.tilts = self.AccelerometerVector(x[0], y[0], z[0]) + self.dg_accel_timestamp = timestamp def cmd_accel_vector_override(self, axis: int, mag: int, reset: int = NO_RESET) -> int: """ Index: dialin/dg/alarms.py =================================================================== diff -u -racd09d02879e8add4cf7f694f5db8e423a76c341 -rceb2d67297d31ac7c816f01cd4f836f071c1d39a --- dialin/dg/alarms.py (.../alarms.py) (revision acd09d02879e8add4cf7f694f5db8e423a76c341) +++ dialin/dg/alarms.py (.../alarms.py) (revision ceb2d67297d31ac7c816f01cd4f836f071c1d39a) @@ -43,7 +43,7 @@ if self.can_interface is not None: channel_id = DenaliChannels.dg_alarm_broadcast_ch_id msg_id = MsgIds.MSG_ID_ALARM_TRIGGERED.value - self.can_interface.register_receiving_publication_function(channel_id, msg_id, self._handler_alarm_activate) + self.can_interface.register_receiving_publication_function(channel_id, msg_id, self._handler_alarm_triggered) msg_id = MsgIds.MSG_ID_ALARM_CLEARED.value self.can_interface.register_receiving_publication_function(channel_id, msg_id, self._handler_alarm_clear) @@ -54,6 +54,10 @@ msg_id = MsgIds.MSG_ID_DG_ALARM_INFO.value self.can_interface.register_receiving_publication_function(channel_id, msg_id, self._handler_alarm_information_sync) + self.dg_alarm_triggered_timestamp = 0.0 + self.dg_alarm_clrd_timestamp = 0.0 + self.dg_alarm_condition_clrd_timestamp = 0.0 + self.dg_alarm_info_timestamp = 0.0 # alarm states based on received DG alarm activation and alarm clear messages self.alarm_states = [False] * self._ALARM_ID_MAX_ALARMS # alarm condition states based on received DG alarm activation and clear condition messages @@ -101,8 +105,8 @@ for x in range(self._ALARM_ID_MAX_ALARMS): self.alarm_states[x] = False - @publish(["alarm_states"]) - def _handler_alarm_activate(self, message): + @publish(["dg_alarm_triggered_timestamp","alarm_states"]) + def _handler_alarm_triggered(self, message, timestamp = 0.0): """ Handles published DG alarm activation messages. @@ -113,9 +117,10 @@ alarm_id = struct.unpack(' int: """ Index: dialin/dg/calibration_record.py =================================================================== diff -u -rc1ec3baacb779f5176e3a7a619fe49f2dc4c19cd -rceb2d67297d31ac7c816f01cd4f836f071c1d39a --- dialin/dg/calibration_record.py (.../calibration_record.py) (revision c1ec3baacb779f5176e3a7a619fe49f2dc4c19cd) +++ dialin/dg/calibration_record.py (.../calibration_record.py) (revision ceb2d67297d31ac7c816f01cd4f836f071c1d39a) @@ -89,6 +89,8 @@ self.can_interface.register_receiving_publication_function(channel_id, msg_id, self._handler_dg_calibration_sync) + self.dg_calibration_record_timestamp = 0.0 + def cmd_reset_dg_calibration_record(self) -> bool: """ Handles resetting DG calibration record. @@ -187,7 +189,7 @@ self.logger.error("Timeout!!!!") return False - def _handler_dg_calibration_sync(self, message): + def _handler_dg_calibration_sync(self, message, timestamp = 0.0): """ Handles published DG calibration_record record messages. DG calibration records are captured for processing and updating the DG calibration_record record. @@ -225,9 +227,10 @@ self._is_getting_cal_in_progress = False # If all the messages have been received, call another function to process the raw data self._utilities.process_received_record_from_fw(self.dg_calibration_record, self._raw_cal_record) + self.dg_calibration_record_timestamp = timestamp self._handler_received_complete_dg_calibration_record() - @publish(["dg_calibration_record"]) + @publish(["dg_calibration_record_timestamp","dg_calibration_record"]) def _handler_received_complete_dg_calibration_record(self): """ Publishes the received calibration record Index: dialin/dg/chemical_disinfect.py =================================================================== diff -u -rc1ec3baacb779f5176e3a7a619fe49f2dc4c19cd -rceb2d67297d31ac7c816f01cd4f836f071c1d39a --- dialin/dg/chemical_disinfect.py (.../chemical_disinfect.py) (revision c1ec3baacb779f5176e3a7a619fe49f2dc4c19cd) +++ dialin/dg/chemical_disinfect.py (.../chemical_disinfect.py) (revision ceb2d67297d31ac7c816f01cd4f836f071c1d39a) @@ -50,6 +50,8 @@ self.r1_level = 0 self.r2_level = 0 self.chemical_disinfect_ui_state = 0 + self.dg_chem_disinfect_data_timestamp = 0.0 + self.dg_chem_disinfect_time_timestamp = 0.0 if self.can_interface is not None: channel_id = DenaliChannels.dg_sync_broadcast_ch_id @@ -62,6 +64,7 @@ self.can_interface.register_receiving_publication_function(channel_id, msg_id, self._handler_chemical_disinfect_to_ui_sync) + def clear_chem_disinfect_info(self) -> None: """ Clears public class properties that are updated by the handler. @@ -79,8 +82,8 @@ self.r2_level = 0 self.chemical_disinfect_ui_state = 0 - @publish(["chemical_disinfect_elapsed_time", "chemical_disinfect_target_time"]) - def _handler_chemical_disinfect_to_ui_sync(self, message): + @publish(["dg_chem_disinfect_time_timestamp","chemical_disinfect_elapsed_time", "chemical_disinfect_target_time"]) + def _handler_chemical_disinfect_to_ui_sync(self, message, timestamp = 0.0): """ Handles published chemical disinfect message @@ -94,10 +97,11 @@ self.chemical_disinfect_target_time = int(disinfect_target_time / 1000) self.chemical_disinfect_elapsed_time = int(disinfect_elapsed_time / 1000) + self.dg_chem_disinfect_time_timestamp = timestamp - @publish(["chemical_disinfect_state", "overall_elapsed_time", "state_elapsed_time", "cancellation_mode", - "r1_level", "r2_level", "chemical_disinfect_ui_state"]) - def _handler_chemical_disinfect_sync(self, message): + @publish(["dg_chem_disinfect_data_timestamp", "chemical_disinfect_state", "overall_elapsed_time", "state_elapsed_time", + "cancellation_mode", "r1_level", "r2_level", "chemical_disinfect_ui_state"]) + def _handler_chemical_disinfect_sync(self, message, timestamp = 0.0): """ Handles published chemical disinfect message @@ -126,3 +130,4 @@ self.r1_level = r1 self.r2_level = r2 self.chemical_disinfect_ui_state = chem_ui_state + self.dg_chem_disinfect_data_timestamp = timestamp Index: dialin/dg/chemical_disinfect_flush.py =================================================================== diff -u -rae43c05f20c84d0d1ff8954d9e2b78df43ec5352 -rceb2d67297d31ac7c816f01cd4f836f071c1d39a --- dialin/dg/chemical_disinfect_flush.py (.../chemical_disinfect_flush.py) (revision ae43c05f20c84d0d1ff8954d9e2b78df43ec5352) +++ dialin/dg/chemical_disinfect_flush.py (.../chemical_disinfect_flush.py) (revision ceb2d67297d31ac7c816f01cd4f836f071c1d39a) @@ -39,6 +39,7 @@ self.state_elapsed_time = 0 self.rinse_count = 0 self.flush_UI_state = DGChemDisinfectFlushUIStates.CHEM_DISINFECT_FLUSH_UI_STATE_NOT_RUNNING.value + self.dg_chem_disinfect_flush_timestamp = 0.0 if self.can_interface is not None: channel_id = DenaliChannels.dg_sync_broadcast_ch_id @@ -57,9 +58,9 @@ self.overall_elapsed_time = 0 self.state_elapsed_time = 0 - @publish(["flush_state", "overall_elapsed_time", "state_elapsed_time", "r1", "r2", "target_rinse_count", - "rinse_count", "flush_UI_state"]) - def _handler_chem_disinfect_flush_sync(self, message: dict) -> None: + @publish(["dg_chem_disinfect_flush_timestamp","flush_state", "overall_elapsed_time", "state_elapsed_time", + "r1", "r2", "target_rinse_count", "rinse_count", "flush_UI_state"]) + def _handler_chem_disinfect_flush_sync(self, message: dict, timestamp = 0.0) -> None: """ Handles published flush message @@ -84,4 +85,4 @@ self.state_elapsed_time = int(state_elapsed_time / 1000) self.rinse_count = rinse_count self.flush_UI_state = flush_ui_state - + self.dg_chem_disinfect_flush_timestamp = timestamp Index: dialin/dg/concentrate_pumps.py =================================================================== diff -u -racd09d02879e8add4cf7f694f5db8e423a76c341 -rceb2d67297d31ac7c816f01cd4f836f071c1d39a --- dialin/dg/concentrate_pumps.py (.../concentrate_pumps.py) (revision acd09d02879e8add4cf7f694f5db8e423a76c341) +++ dialin/dg/concentrate_pumps.py (.../concentrate_pumps.py) (revision ceb2d67297d31ac7c816f01cd4f836f071c1d39a) @@ -73,6 +73,7 @@ self.concentrate_pump_cp2_parked = False self.concentrate_pump_cp1_park_fault = False self.concentrate_pump_cp2_park_fault = False + self.dg_concentrate_pump_timestamp = 0.0 self.cp1_temp_pulse = 0.0 self.cp2_temp_pulse = 0.0 @@ -99,13 +100,13 @@ return [self.concentrate_pump_cp1_parked, self.concentrate_pump_cp2_parked, self.concentrate_pump_cp1_park_fault, self.concentrate_pump_cp2_park_fault] - @publish(["concentrate_pump_cp1_current_set_speed", "concentrate_pump_cp1_measured_speed", + @publish(["dg_concentrate_pump_timestamp","concentrate_pump_cp1_current_set_speed", "concentrate_pump_cp1_measured_speed", "concentrate_pump_cp2_current_set_speed", "concentrate_pump_cp2_measured_speed", "concentrate_pump_cp1_current_state", "concentrate_pump_cp2_current_state", "concentrate_pump_cp1_target_speed", "concentrate_pump_cp2_target_speed", "concentrate_pump_cp1_parked", "concentrate_pump_cp2_parked", "concentrate_pump_cp1_park_fault", "concentrate_pump_cp2_park_fault"]) - def _handler_concentrate_pumps_sync(self, message): + def _handler_concentrate_pumps_sync(self, message, timestamp=0.0): """ Handles published concentrate pumps' data messages. Concentrate pumps' speed data are captured for reference. @@ -145,6 +146,7 @@ message['message'][MsgFieldPositions.START_POS_FIELD_13:MsgFieldPositions.END_POS_FIELD_13]))[0] == 1 else False self.concentrate_pump_cp2_park_fault = True if struct.unpack('I', bytearray( message['message'][MsgFieldPositions.START_POS_FIELD_14:MsgFieldPositions.END_POS_FIELD_14]))[0] == 1 else False + self.dg_concentrate_pump_timestamp = timestamp def cmd_concentrate_pump_state_change_request(self, pump_id: int, on: bool = False) -> int: """ Index: dialin/dg/conductivity_sensors.py =================================================================== diff -u -racd09d02879e8add4cf7f694f5db8e423a76c341 -rceb2d67297d31ac7c816f01cd4f836f071c1d39a --- dialin/dg/conductivity_sensors.py (.../conductivity_sensors.py) (revision acd09d02879e8add4cf7f694f5db8e423a76c341) +++ dialin/dg/conductivity_sensors.py (.../conductivity_sensors.py) (revision ceb2d67297d31ac7c816f01cd4f836f071c1d39a) @@ -70,6 +70,8 @@ self.cd1_sensor_status = 0 self.cd2_sensor_status = 0 + self.dg_conductivity_timestamp = 0.0 + def get_conductivity_sensors(self): """ Gets the current conductivity value @@ -90,11 +92,11 @@ """ return self.ro_rejection_ratio - @publish(["ro_rejection_ratio", "conductivity_sensor_cpi", "conductivity_sensor_cpo", "conductivity_sensor_cd1", - "conductivity_sensor_cd2", "raw_conductivity_sensor_cpi", "raw_conductivity_sensor_cpo", + @publish(["dg_conductivity_timestamp","ro_rejection_ratio", "conductivity_sensor_cpi", "conductivity_sensor_cpo", + "conductivity_sensor_cd1","conductivity_sensor_cd2", "raw_conductivity_sensor_cpi", "raw_conductivity_sensor_cpo", "raw_conductivity_sensor_cd1", "raw_conductivity_sensor_cd2", "cpi_sensor_status", "cpo_sensor_status", "cd1_sensor_status", "cd2_sensor_status"]) - def _handler_conductivity_sensors_sync(self, message): + def _handler_conductivity_sensors_sync(self, message, timestamp=0.0): """ Handles published conductivity sensor data messages. Conductivity sensor data are captured for reference. @@ -132,6 +134,8 @@ self.cd2_sensor_status = struct.unpack('i', bytearray( message['message'][MsgFieldPositions.START_POS_FIELD_13:MsgFieldPositions.END_POS_FIELD_13]))[0] + self.dg_conductivity_timestamp = timestamp + def cmd_conductivity_sensor_override(self, sensor: int, conductivity: float, reset: int = NO_RESET) -> int: """ Constructs and sends the conductivity value override command Index: dialin/dg/cpld.py =================================================================== diff -u -racd09d02879e8add4cf7f694f5db8e423a76c341 -rceb2d67297d31ac7c816f01cd4f836f071c1d39a --- dialin/dg/cpld.py (.../cpld.py) (revision acd09d02879e8add4cf7f694f5db8e423a76c341) +++ dialin/dg/cpld.py (.../cpld.py) (revision ceb2d67297d31ac7c816f01cd4f836f071c1d39a) @@ -55,6 +55,8 @@ self.cpld_fault_led = 0 self.cpld_clean_led = 0 + self.dg_cpld_timestamp = 0.0 + def get_cpld_wdog(self) -> int: """ Gets the current CPLD watchdog value @@ -92,8 +94,8 @@ """ return self.cpld_clean_led - @publish(["cpld_wdog", "cpld_audio", "cpld_fault_led", "cpld_clean_led"]) - def _handler_cpld_sync(self, message): + @publish(["dg_cpld_timestamp","cpld_wdog", "cpld_audio", "cpld_fault_led", "cpld_clean_led"]) + def _handler_cpld_sync(self, message, timestamp=0.0): """ Handles published CPLD data messages. CPLD data are captured for reference. @@ -111,3 +113,4 @@ self.cpld_clean_led = struct.unpack('B', bytearray( message['message'][MsgFieldPositions.START_POS_FIELD_1 + 3:MsgFieldPositions.START_POS_FIELD_1 + 4]))[0] + self.dg_cpld_timestamp = timestamp Index: dialin/dg/dialysate_fill.py =================================================================== diff -u -r09d4fb18762b9baca3228be5a7ef224bb5d1d540 -rceb2d67297d31ac7c816f01cd4f836f071c1d39a --- dialin/dg/dialysate_fill.py (.../dialysate_fill.py) (revision 09d4fb18762b9baca3228be5a7ef224bb5d1d540) +++ dialin/dg/dialysate_fill.py (.../dialysate_fill.py) (revision ceb2d67297d31ac7c816f01cd4f836f071c1d39a) @@ -54,13 +54,15 @@ self.used_acid = 0.0 self.used_bicarb = 0.0 self.total_volume = 0.0 + self.dg_fill_mode_timestamp = 0.0 if self.can_interface is not None: channel_id = DenaliChannels.dg_sync_broadcast_ch_id msg_id = MsgIds.MSG_ID_DG_FILL_MODE_DATA.value self.can_interface.register_receiving_publication_function(channel_id, msg_id, self._handler_fill_mode_monitor_sync) + def get_fill_mode_data(self): """ Gets the current concentrate pump data value @@ -72,8 +74,8 @@ return [self.avg_acid, self.avg_bicarb, self.first_fill, self.pctDiffConduct, self.used_acid, self.used_bicarb] - @publish(["avg_acid", "avg_bicarb", "first_fill", "pctDiffConduct", "used_acid", "used_bicarb", "total_volume"]) - def _handler_fill_mode_monitor_sync(self, message): + @publish(["dg_fill_mode_timestamp","avg_acid", "avg_bicarb", "first_fill", "pctDiffConduct", "used_acid", "used_bicarb", "total_volume"]) + def _handler_fill_mode_monitor_sync(self, message, timestamp=0.0): """ Handles published dialysate fill mode data' data messages. Dialysate fill data are captured for reference. @@ -95,6 +97,7 @@ message['message'][MsgFieldPositions.START_POS_FIELD_6:MsgFieldPositions.END_POS_FIELD_6]))[0] self.total_volume = struct.unpack(' int: """ Index: dialin/dg/dialysate_generator.py =================================================================== diff -u -rae43c05f20c84d0d1ff8954d9e2b78df43ec5352 -rceb2d67297d31ac7c816f01cd4f836f071c1d39a --- dialin/dg/dialysate_generator.py (.../dialysate_generator.py) (revision ae43c05f20c84d0d1ff8954d9e2b78df43ec5352) +++ dialin/dg/dialysate_generator.py (.../dialysate_generator.py) (revision ceb2d67297d31ac7c816f01cd4f836f071c1d39a) @@ -161,6 +161,8 @@ self.dg_logged_in = False self.dg_set_logged_in_status(False) self.dg_no_transmit_msg_list = [0,0,0,0,0,0,0,0] + self.dg_op_mode_timestamp = 0.0 + self.dg_version_response_timestamp = 0.0 # Create command groups self.accel = DGAccelerometer(self.can_interface, self.logger) @@ -258,8 +260,8 @@ """ self.dg_logged_in = logged_in - @publish(["dg_version", "fpga_version"]) - def _handler_dg_version(self, message): + @publish(["dg_version_response_timestamp","dg_version", "fpga_version"]) + def _handler_dg_version(self, message,timestamp): """ Handler for response from DG regarding its version. @@ -292,9 +294,10 @@ if all([len(each) > 0 for each in [fpga_major, fpga_minor, fpga_id, fpga_lab]]): self.fpga_version = f"ID: {fpga_id[0]} v{fpga_major[0]}.{fpga_minor[0]}.{fpga_lab[0]}" self.logger.debug(f"DG FPGA VERSION: {self.fpga_version}") + self.dg_version_response_timestamp = timestamp - @publish(["dg_operation_mode", "dg_operation_sub_mode"]) - def _handler_dg_op_mode_sync(self, message): + @publish(["dg_op_mode_timestamp","dg_operation_mode", "dg_operation_sub_mode"]) + def _handler_dg_op_mode_sync(self, message, timestamp=0.0): """ Handles published DG operation mode messages. Current DG operation mode is captured for reference. @@ -310,6 +313,7 @@ self.dg_operation_mode = mode[0] self.dg_operation_sub_mode = smode[0] + self.dg_op_mode_timestamp = timestamp def cmd_log_in_to_dg(self, resend: bool = False) -> int: """ Index: dialin/dg/drain_pump.py =================================================================== diff -u -r0e68ec6bb733a8ab7b21a82f8b571f1678f9d2cd -rceb2d67297d31ac7c816f01cd4f836f071c1d39a --- dialin/dg/drain_pump.py (.../drain_pump.py) (revision 0e68ec6bb733a8ab7b21a82f8b571f1678f9d2cd) +++ dialin/dg/drain_pump.py (.../drain_pump.py) (revision ceb2d67297d31ac7c816f01cd4f836f071c1d39a) @@ -60,6 +60,7 @@ self.target_drain_pump_outlet_flow_lpm = 0.0 self.drain_pump_current_A = 0.0 self.drain_pump_direction = 0 + self.dg_drain_pump_timestamp = 0.0 def get_target_drain_pump_rpm(self): """ @@ -93,9 +94,9 @@ """ return self.current_drain_pump_rpm - @publish(["target_drain_pump_rpm", "dac_value", "drain_pump_state", "current_drain_pump_rpm", + @publish(["dg_drain_pump_timestamp","target_drain_pump_rpm", "dac_value", "drain_pump_state", "current_drain_pump_rpm", "drain_pump_current_A", "drain_pump_direction", "target_drain_pump_outlet_flow_lpm"]) - def _handler_drain_pump_sync(self, message): + def _handler_drain_pump_sync(self, message, timestamp=0.0): """ Handles published drain pump data messages. Drain pump data are captured for reference. @@ -117,6 +118,7 @@ message['message'][MsgFieldPositions.START_POS_FIELD_6:MsgFieldPositions.END_POS_FIELD_6]))[0] self.drain_pump_direction = struct.unpack('i', bytearray( message['message'][MsgFieldPositions.START_POS_FIELD_7:MsgFieldPositions.END_POS_FIELD_7]))[0] + self.dg_drain_pump_timestamp = timestamp def cmd_drain_pump_set_outlet_target_flow_lpm(self, flow: float) -> int: """ Index: dialin/dg/events.py =================================================================== diff -u -racd09d02879e8add4cf7f694f5db8e423a76c341 -rceb2d67297d31ac7c816f01cd4f836f071c1d39a --- dialin/dg/events.py (.../events.py) (revision acd09d02879e8add4cf7f694f5db8e423a76c341) +++ dialin/dg/events.py (.../events.py) (revision ceb2d67297d31ac7c816f01cd4f836f071c1d39a) @@ -37,6 +37,7 @@ super().__init__() self.can_interface = can_interface self.logger = logger + self.dg_events_timestamp = 0.0 if self.can_interface is not None: channel_id = DenaliChannels.dg_to_ui_ch_id @@ -135,8 +136,8 @@ return list_of_events - @publish(['_dg_event_dictionary']) - def _handler_events_sync(self, message): + @publish(["dg_events_timestamp", '_dg_event_dictionary']) + def _handler_events_sync(self, message,timestamp = 0.0): """ Handles published events message @@ -236,3 +237,4 @@ # Update event dictionary self._dg_event_dictionary[event_state_name].append(event_tuple) + self.dg_events_timestamp = timestamp Index: dialin/dg/fans.py =================================================================== diff -u -racd09d02879e8add4cf7f694f5db8e423a76c341 -rceb2d67297d31ac7c816f01cd4f836f071c1d39a --- dialin/dg/fans.py (.../fans.py) (revision acd09d02879e8add4cf7f694f5db8e423a76c341) +++ dialin/dg/fans.py (.../fans.py) (revision ceb2d67297d31ac7c816f01cd4f836f071c1d39a) @@ -65,6 +65,7 @@ self.outlet_2_rpm = 0.0 self.outlet_3_rpm = 0.0 self.rpm_alarm_time = 0 + self.dg_fans_timestamp = 0.0 def get_fans_target_duty_cycle(self): """ @@ -138,9 +139,9 @@ """ return self.rpm_alarm_time - @publish(['dg_fans_duty_cycle', 'dg_fans_target_rpm', 'inlet_1_rpm', 'inlet_2_rpm', 'inlet_3_rpm', 'outlet_1_rpm', + @publish(["dg_fans_timestamp",'dg_fans_duty_cycle', 'dg_fans_target_rpm', 'inlet_1_rpm', 'inlet_2_rpm', 'inlet_3_rpm', 'outlet_1_rpm', 'outlet_2_rpm', 'outlet_3_rpm', 'rpm_alarm_time']) - def _handler_fans_sync(self, message): + def _handler_fans_sync(self, message, timestamp=0.0): """ Handles published thermistors message. @@ -165,6 +166,7 @@ message['message'][MsgFieldPositions.START_POS_FIELD_8:MsgFieldPositions.END_POS_FIELD_8]))[0] self.rpm_alarm_time = struct.unpack('i', bytearray( message['message'][MsgFieldPositions.START_POS_FIELD_9:MsgFieldPositions.END_POS_FIELD_9]))[0] + self.dg_fans_timestamp = timestamp def cmd_fans_rpm_override(self, fan: int, rpm: float, reset: int = NO_RESET) -> int: """ Index: dialin/dg/flow_sensors.py =================================================================== diff -u -racd09d02879e8add4cf7f694f5db8e423a76c341 -rceb2d67297d31ac7c816f01cd4f836f071c1d39a --- dialin/dg/flow_sensors.py (.../flow_sensors.py) (revision acd09d02879e8add4cf7f694f5db8e423a76c341) +++ dialin/dg/flow_sensors.py (.../flow_sensors.py) (revision ceb2d67297d31ac7c816f01cd4f836f071c1d39a) @@ -54,6 +54,7 @@ self.measured_ro_flow_LPM = 0.0 self.measured_dialysate_flow_LPM = 0.0 self.measured_ro_flow_with_cp_LPM = 0.0 + self.dg_flow_sensors_timestamp = 0.0 if self.can_interface is not None: channel_id = DenaliChannels.dg_sync_broadcast_ch_id @@ -82,15 +83,16 @@ """ return self.measured_ro_flow_with_cp_LPM - @publish(["measured_ro_flow_LPM", "measured_dialysate_flow_LPM", "measured_ro_flow_with_cp_LPM"]) - def _handler_flow_sensors_sync(self, message): + @publish(["dg_flow_sensors_timestamp","measured_ro_flow_LPM", "measured_dialysate_flow_LPM", "measured_ro_flow_with_cp_LPM"]) + def _handler_flow_sensors_sync(self, message, timestamp=0.0): self.measured_ro_flow_LPM = struct.unpack('f', bytearray( message['message'][MsgFieldPositions.START_POS_FIELD_1:MsgFieldPositions.END_POS_FIELD_1]))[0] self.measured_ro_flow_with_cp_LPM = struct.unpack('f', bytearray( message['message'][MsgFieldPositions.START_POS_FIELD_2:MsgFieldPositions.END_POS_FIELD_2]))[0] self.measured_dialysate_flow_LPM = struct.unpack('f', bytearray( message['message'][MsgFieldPositions.START_POS_FIELD_3:MsgFieldPositions.END_POS_FIELD_3]))[0] + self.dg_flow_sensors_timestamp = timestamp def cmd_measured_flow_sensor_value_lpm_override(self, sensor_id: int, rate: float, reset: int = NO_RESET) -> int: """ Index: dialin/dg/fluid_leak.py =================================================================== diff -u -r0e68ec6bb733a8ab7b21a82f8b571f1678f9d2cd -rceb2d67297d31ac7c816f01cd4f836f071c1d39a --- dialin/dg/fluid_leak.py (.../fluid_leak.py) (revision 0e68ec6bb733a8ab7b21a82f8b571f1678f9d2cd) +++ dialin/dg/fluid_leak.py (.../fluid_leak.py) (revision ceb2d67297d31ac7c816f01cd4f836f071c1d39a) @@ -43,6 +43,7 @@ super().__init__() self.can_interface = can_interface self.logger = logger + self.dg_fluid_leak_timestamp = 0.0 if self.can_interface is not None: channel_id = DenaliChannels.dg_sync_broadcast_ch_id @@ -60,8 +61,8 @@ """ return self.fluid_leak_state - @publish(["fluid_leak_state"]) - def _handler_fluid_leak_sync(self, message: dict) -> None: + @publish(["dg_fluid_leak_timestamp","fluid_leak_state"]) + def _handler_fluid_leak_sync(self, message: dict, timestamp) -> None: """ Handles published fluid leak state messages. Fluid leak state is captured for reference. @@ -74,6 +75,7 @@ message['message'][MsgFieldPositions.START_POS_FIELD_1:MsgFieldPositions.END_POS_FIELD_1])) self.fluid_leak_state = state[0] + self.dg_fluid_leak_timestamp = timestamp def cmd_fluid_leak_detector_override(self, detected_state: int, reset: int = NO_RESET) -> int: """ Index: dialin/dg/flush.py =================================================================== diff -u -racd09d02879e8add4cf7f694f5db8e423a76c341 -rceb2d67297d31ac7c816f01cd4f836f071c1d39a --- dialin/dg/flush.py (.../flush.py) (revision acd09d02879e8add4cf7f694f5db8e423a76c341) +++ dialin/dg/flush.py (.../flush.py) (revision ceb2d67297d31ac7c816f01cd4f836f071c1d39a) @@ -39,6 +39,7 @@ self.state_elapsed_time = 0 self.flush_drain_line_volume_l = 0.0 self.flush_UI_state = DGFlushUIStates.FLUSH_UI_STATE_NOT_RUNNING.value + self.dg_flush_data_timestamp = 0.0 if self.can_interface is not None: channel_id = DenaliChannels.dg_sync_broadcast_ch_id @@ -57,9 +58,9 @@ self.overall_elapsed_time = 0 self.state_elapsed_time = 0 - @publish(["flush_state", "overall_elapsed_time", "state_elapsed_time", "flush_drain_line_volume_l", - "flush_UI_state"]) - def _handler_flush_sync(self, message: dict) -> None: + @publish(["dg_flush_data_timestamp","flush_state", "overall_elapsed_time", + "state_elapsed_time", "flush_drain_line_volume_l","flush_UI_state"]) + def _handler_flush_sync(self, message: dict, timestamp=0.0) -> None: """ Handles published flush message @@ -82,4 +83,5 @@ self.state_elapsed_time = int(state_elapsed_time / 1000) self.flush_drain_line_volume_l = drain_line_volume self.flush_UI_state = flush_ui_state + self.dg_flush_data_timestamp = timestamp Index: dialin/dg/gen_idle.py =================================================================== diff -u -r09d4fb18762b9baca3228be5a7ef224bb5d1d540 -rceb2d67297d31ac7c816f01cd4f836f071c1d39a --- dialin/dg/gen_idle.py (.../gen_idle.py) (revision 09d4fb18762b9baca3228be5a7ef224bb5d1d540) +++ dialin/dg/gen_idle.py (.../gen_idle.py) (revision ceb2d67297d31ac7c816f01cd4f836f071c1d39a) @@ -45,6 +45,7 @@ self.bad_fill_signal = 0 self.target_fill_volume_ml = 0 self.gen_idle_state = 0 + self.dg_gen_idle_data_timestamp = 0.0 if self.can_interface is not None: channel_id = DenaliChannels.dg_sync_broadcast_ch_id @@ -88,8 +89,8 @@ """ return self.bad_fill_signal - @publish(["gen_idle_state", "target_fill_volume_ml", "bad_fill_signal", "bad_fill_state"]) - def _handler_gen_idle_sync(self, message): + @publish(["dg_gen_idle_data_timestamp","gen_idle_state", "target_fill_volume_ml", "bad_fill_signal", "bad_fill_state"]) + def _handler_gen_idle_sync(self, message, timestamp=0.0): """ Handles published gen idle sub-states message. @@ -106,6 +107,8 @@ self.bad_fill_state = struct.unpack(' int: """ Constructs and sends the fill mode data broadcast interval override command Index: dialin/dg/heat_disinfect.py =================================================================== diff -u -r08313f85bfd2c466e33bb46e8b8291b5091e8e05 -rceb2d67297d31ac7c816f01cd4f836f071c1d39a --- dialin/dg/heat_disinfect.py (.../heat_disinfect.py) (revision 08313f85bfd2c466e33bb46e8b8291b5091e8e05) +++ dialin/dg/heat_disinfect.py (.../heat_disinfect.py) (revision ceb2d67297d31ac7c816f01cd4f836f071c1d39a) @@ -91,6 +91,8 @@ self.cancellation_mode = 0 self.r1_level = 0 self.r2_level = 0 + self.dg_heat_disinfection_time_timestamp = 0.0 + self.dg_heat_disinfection_data_timestamp = 0.0 if self.can_interface is not None: channel_id = DenaliChannels.dg_sync_broadcast_ch_id @@ -120,8 +122,8 @@ self.r2_level = 0 self.heat_disinfect_ui_state = 0 - @publish(["heat_disinfect_target_time", "heat_disinfect_count_down_time"]) - def _handler_heat_disinfect_to_ui_sync(self, message): + @publish(["dg_heat_disinfection_time_timestamp","heat_disinfect_target_time", "heat_disinfect_count_down_time"]) + def _handler_heat_disinfect_to_ui_sync(self, message, timestamp=0.0): """ Handles published heat disinfect message @@ -144,10 +146,11 @@ self.disinfect_ro_82_time_s = ro_82 self.disinfect_r_77_time_s = r_77 self.disinfect_r_82_time_s = r_82 + self.dg_heat_disinfection_time_timestamp = timestamp - @publish(["heat_disinfect_state", "overall_elapsed_time", "state_elapsed_time", "cancellation_mode", "r1_level", - "r2_level", "heat_disinfect_ui_state"]) - def _handler_heat_disinfect_sync(self, message): + @publish(["dg_heat_disinfection_data_timestamp","heat_disinfect_state", "overall_elapsed_time", + "state_elapsed_time", "cancellation_mode", "r1_level", "r2_level", "heat_disinfect_ui_state"]) + def _handler_heat_disinfect_sync(self, message, timestamp): """ Handles published heat disinfect message @@ -176,6 +179,7 @@ self.r1_level = r1 self.r2_level = r2 self.heat_disinfect_ui_state = ui + self.dg_heat_disinfection_data_timestamp = timestamp def cmd_set_nelson_support_mode(self, support: int): """ Index: dialin/dg/heat_disinfect_active_cool.py =================================================================== diff -u -racd09d02879e8add4cf7f694f5db8e423a76c341 -rceb2d67297d31ac7c816f01cd4f836f071c1d39a --- dialin/dg/heat_disinfect_active_cool.py (.../heat_disinfect_active_cool.py) (revision acd09d02879e8add4cf7f694f5db8e423a76c341) +++ dialin/dg/heat_disinfect_active_cool.py (.../heat_disinfect_active_cool.py) (revision ceb2d67297d31ac7c816f01cd4f836f071c1d39a) @@ -34,6 +34,7 @@ self.heat_disinfect_active_cool_state = 0 self.overall_elapsed_time = 0 self.state_elapsed_time = 0 + self.dg_heat_disinfection_active_cool_data_timestamp = 0.0 if self.can_interface is not None: channel_id = DenaliChannels.dg_sync_broadcast_ch_id @@ -54,8 +55,9 @@ self.overall_elapsed_time = 0 self.state_elapsed_time = 0 - @publish(["heat_disinfect_active_cool_state", "overall_elapsed_time", "state_elapsed_time"]) - def _handler_heat_disinfect_active_cool_sync(self, message): + @publish(["dg_heat_disinfection_active_cool_data_timestamp","heat_disinfect_active_cool_state", + "overall_elapsed_time", "state_elapsed_time"]) + def _handler_heat_disinfect_active_cool_sync(self, message, timestamp=0.0): """ Handles published heat disinfect active cool message @@ -72,3 +74,4 @@ self.heat_disinfect_active_cool_state = state self.overall_elapsed_time = int(elapsed_time / 1000) self.state_elapsed_time = int(state_elapsed_time / 1000) + self.dg_heat_disinfection_active_cool_data_timestamp = timestamp Index: dialin/dg/heaters.py =================================================================== diff -u -rc1ec3baacb779f5176e3a7a619fe49f2dc4c19cd -rceb2d67297d31ac7c816f01cd4f836f071c1d39a --- dialin/dg/heaters.py (.../heaters.py) (revision c1ec3baacb779f5176e3a7a619fe49f2dc4c19cd) +++ dialin/dg/heaters.py (.../heaters.py) (revision ceb2d67297d31ac7c816f01cd4f836f071c1d39a) @@ -78,6 +78,7 @@ self.primary_calc_target_temperature = 0.0 self.trimmer_calc_target_temperature = 0.0 self.trimmer_use_last_duty_cycle = 0 + self.dg_heaters_timestamp = 0.0 if self.can_interface is not None: channel_id = DenaliChannels.dg_sync_broadcast_ch_id @@ -124,11 +125,11 @@ """ return self.trimmer_heater_target_temperature - @publish(["main_primary_heater_duty_cycle", "small_primary_heater_duty_cycle", "trimmer_heater_duty_cycle", + @publish(["dg_heaters_timestamp","main_primary_heater_duty_cycle", "small_primary_heater_duty_cycle", "trimmer_heater_duty_cycle", "trimmer_heater_state", "primary_heaters_target_temperature", "trimmer_heater_target_temperature", "primary_efficiency", "primary_calc_target_temperature", "trimmer_calc_target_temperature", "trimmer_use_last_duty_cycle"]) - def _handler_heaters_sync(self, message): + def _handler_heaters_sync(self, message,timestamp=0.0): """ Handles published heaters message @@ -157,6 +158,7 @@ message['message'][MsgFieldPositions.START_POS_FIELD_10:MsgFieldPositions.END_POS_FIELD_10]))[0] self.trimmer_use_last_duty_cycle = struct.unpack('i', bytearray( message['message'][MsgFieldPositions.START_POS_FIELD_11:MsgFieldPositions.END_POS_FIELD_11]))[0] + self.dg_heaters_timestamp = timestamp def cmd_start_stop_primary_heater(self, state: int = HeatersStartStop.STOP.value) -> None: """ Index: dialin/dg/load_cells.py =================================================================== diff -u -racd09d02879e8add4cf7f694f5db8e423a76c341 -rceb2d67297d31ac7c816f01cd4f836f071c1d39a --- dialin/dg/load_cells.py (.../load_cells.py) (revision acd09d02879e8add4cf7f694f5db8e423a76c341) +++ dialin/dg/load_cells.py (.../load_cells.py) (revision ceb2d67297d31ac7c816f01cd4f836f071c1d39a) @@ -47,6 +47,7 @@ super().__init__() self.can_interface = can_interface self.logger = logger + self.dg_load_cell_timestamp = 0.0 if self.can_interface is not None: channel_id = DenaliChannels.dg_sync_broadcast_ch_id @@ -66,8 +67,8 @@ """ return [self.load_cell_A1, self.load_cell_A2, self.load_cell_B1, self.load_cell_B2] - @publish(["load_cell_A1", "load_cell_A2", "load_cell_B1", "load_cell_B2"]) - def _handler_load_cells_sync(self, message): + @publish(["dg_load_cell_timestamp","load_cell_A1", "load_cell_A2", "load_cell_B1", "load_cell_B2"]) + def _handler_load_cells_sync(self, message, timestamp=0.0): """ Handles published load cell data messages. Load cell data are captured for reference. @@ -84,6 +85,7 @@ message['message'][MsgFieldPositions.START_POS_FIELD_3:MsgFieldPositions.END_POS_FIELD_3]))[0] self.load_cell_B2 = struct.unpack('f', bytearray( message['message'][MsgFieldPositions.START_POS_FIELD_4:MsgFieldPositions.END_POS_FIELD_4]))[0] + self.dg_load_cell_timestamp = timestamp def cmd_load_cell_override(self, sensor: int, grams: float, raw: int, reset: int = NO_RESET) -> int: """ Index: dialin/dg/pressures.py =================================================================== diff -u -racd09d02879e8add4cf7f694f5db8e423a76c341 -rceb2d67297d31ac7c816f01cd4f836f071c1d39a --- dialin/dg/pressures.py (.../pressures.py) (revision acd09d02879e8add4cf7f694f5db8e423a76c341) +++ dialin/dg/pressures.py (.../pressures.py) (revision ceb2d67297d31ac7c816f01cd4f836f071c1d39a) @@ -58,6 +58,7 @@ self.drain_pump_inlet_pressure = 0.0 self.drain_pump_outlet_pressure = 0.0 self.barometric_pressure = 0.0 + self.dg_pressures_timestamp = 0.0 def get_pressures(self): """ @@ -71,13 +72,14 @@ self.drain_pump_outlet_pressure] @publish([ + "dg_pressures_timestamp", "ro_pump_inlet_pressure", "ro_pump_outlet_pressure", "drain_pump_inlet_pressure", "drain_pump_outlet_pressure", "barometric_pressure" ]) - def _handler_pressures_sync(self, message): + def _handler_pressures_sync(self, message,timestamp=0.0): """ Handles published pressure data messages. Pressure data are captured for reference. @@ -102,6 +104,7 @@ self.drain_pump_inlet_pressure = dri[0] self.drain_pump_outlet_pressure = dro[0] self.barometric_pressure = baro[0] + self.dg_pressures_timestamp = timestamp def cmd_pressure_override(self, sensor: int, pressure: int, reset: int = NO_RESET) -> int: """ Index: dialin/dg/reservoirs.py =================================================================== diff -u -racd09d02879e8add4cf7f694f5db8e423a76c341 -rceb2d67297d31ac7c816f01cd4f836f071c1d39a --- dialin/dg/reservoirs.py (.../reservoirs.py) (revision acd09d02879e8add4cf7f694f5db8e423a76c341) +++ dialin/dg/reservoirs.py (.../reservoirs.py) (revision ceb2d67297d31ac7c816f01cd4f836f071c1d39a) @@ -64,6 +64,7 @@ self.temp_avg_fill = 0.0 self.temp_last_fill = 0.0 self.time_rsrvr_fill = 0.0 + self.dg_reservoirs_timestamp = 0.0 def get_active_reservoir(self): """ @@ -136,10 +137,10 @@ return True - @publish(["active_reservoir", "fill_to_vol_ml", "drain_to_vol_ml", "time_reservoir_cycle", + @publish(["dg_reservoirs_timestamp","active_reservoir", "fill_to_vol_ml", "drain_to_vol_ml", "time_reservoir_cycle", "time_reservoir_fill_2_switch", "time_uf_decay", "temp_uf_fill", "temp_reservoir_use_actual", "temp_reservoir_end_fill", "temp_avg_fill", "temp_last_fill", "time_rsrvr_fill"]) - def _handler_reservoirs_sync(self, message): + def _handler_reservoirs_sync(self, message, timestamp=0.0): """ Handles published reservoir data messages. Reservoir data are captured for reference. @@ -172,3 +173,4 @@ message['message'][MsgFieldPositions.START_POS_FIELD_11:MsgFieldPositions.END_POS_FIELD_11]))[0] self.time_rsrvr_fill = struct.unpack('f', bytearray( message['message'][MsgFieldPositions.START_POS_FIELD_12:MsgFieldPositions.END_POS_FIELD_12]))[0] + self.dg_reservoirs_timestamp = timestamp Index: dialin/dg/ro_pump.py =================================================================== diff -u -r09d4fb18762b9baca3228be5a7ef224bb5d1d540 -rceb2d67297d31ac7c816f01cd4f836f071c1d39a --- dialin/dg/ro_pump.py (.../ro_pump.py) (revision 09d4fb18762b9baca3228be5a7ef224bb5d1d540) +++ dialin/dg/ro_pump.py (.../ro_pump.py) (revision ceb2d67297d31ac7c816f01cd4f836f071c1d39a) @@ -61,6 +61,7 @@ self.ro_pump_state = 0 self.target_flow_lpm = 0.0 self.feedback_duty_cycle_pct = 0.0 + self.dg_ro_pump_timestamp = 0.0 def get_target_pressure(self): """ @@ -94,9 +95,9 @@ """ return self.ro_pump_state - @publish(["target_pressure_psi", "pwm_duty_cycle_pct", "ro_pump_state", "target_flow_lpm", - "feedback_duty_cycle_pct"]) - def _handler_ro_pump_sync(self, message): + @publish(["dg_ro_pump_timestamp","target_pressure_psi", "pwm_duty_cycle_pct", + "ro_pump_state", "target_flow_lpm","feedback_duty_cycle_pct"]) + def _handler_ro_pump_sync(self, message,timestamp): """ Handles published ro pump data messages. RO pump data are captured for reference. @@ -119,6 +120,7 @@ message['message'][MsgFieldPositions.START_POS_FIELD_6:MsgFieldPositions.END_POS_FIELD_6]))[0] self.ro_pump_state = ROPumpStates(ro_state).name + self.dg_ro_pump_timestamp = timestamp def cmd_ro_pump_duty_cycle_pct(self, duty: float) -> int: """ Index: dialin/dg/rtc.py =================================================================== diff -u -r68418c949ee594c0f28b358c674a26f49eb244e6 -rceb2d67297d31ac7c816f01cd4f836f071c1d39a --- dialin/dg/rtc.py (.../rtc.py) (revision 68418c949ee594c0f28b358c674a26f49eb244e6) +++ dialin/dg/rtc.py (.../rtc.py) (revision ceb2d67297d31ac7c816f01cd4f836f071c1d39a) @@ -40,6 +40,7 @@ super().__init__() self.can_interface = can_interface self.logger = logger + self.dg_rtc_timestamp = 0.0 if self.can_interface is not None: channel_id = DenaliChannels.dg_sync_broadcast_ch_id @@ -55,8 +56,8 @@ """ return self.rtc_epoch - @publish(["rtc_epoch"]) - def _handler_rtc_epoch(self, message): + @publish(["dg_rtc_timestamp","rtc_epoch"]) + def _handler_rtc_epoch(self, message,timestamp=0.0): """ Publishes the rtc time in epoch @@ -66,6 +67,7 @@ epoch = struct.unpack('i', bytearray( message['message'][MsgFieldPositions.START_POS_FIELD_1:MsgFieldPositions.END_POS_FIELD_1]))[0] self.rtc_epoch = epoch + self.dg_rtc_timestamp = timestamp def cmd_stop_rtc(self): """ Index: dialin/dg/samplewater.py =================================================================== diff -u -racd09d02879e8add4cf7f694f5db8e423a76c341 -rceb2d67297d31ac7c816f01cd4f836f071c1d39a --- dialin/dg/samplewater.py (.../samplewater.py) (revision acd09d02879e8add4cf7f694f5db8e423a76c341) +++ dialin/dg/samplewater.py (.../samplewater.py) (revision ceb2d67297d31ac7c816f01cd4f836f071c1d39a) @@ -38,6 +38,7 @@ super().__init__() self.can_interface = can_interface self.logger = logger + self.dg_filter_flush_timestamp=0.0 if self.can_interface is not None: self.can_interface.register_receiving_publication_function(DenaliChannels.dg_sync_broadcast_ch_id, @@ -64,10 +65,11 @@ return self.filter_flush_time_countdown @publish([ + "dg_filter_flush_timestamp", "filter_flush_timeout", "filter_flush_time_countdown" ]) - def _handler_filter_flush_progress_sync(self, message: dict) -> None: + def _handler_filter_flush_progress_sync(self, message: dict,timestamp=0.0) -> None: """ Handles published filter flush progress data messages. Filter flush progress data are captured for reference. @@ -79,6 +81,7 @@ message['message'][MsgFieldPositions.START_POS_FIELD_1:MsgFieldPositions.END_POS_FIELD_1]))[0] self.filter_flush_time_countdown = struct.unpack('i', bytearray( message['message'][MsgFieldPositions.START_POS_FIELD_2:MsgFieldPositions.END_POS_FIELD_2]))[0] + self.dg_filter_flush_timestamp = timestamp def cmd_filter_flush_time_period_override(self, ms: int, reset: int = NO_RESET) -> int: """ Index: dialin/dg/scheduled_runs_record.py =================================================================== diff -u -racd09d02879e8add4cf7f694f5db8e423a76c341 -rceb2d67297d31ac7c816f01cd4f836f071c1d39a --- dialin/dg/scheduled_runs_record.py (.../scheduled_runs_record.py) (revision acd09d02879e8add4cf7f694f5db8e423a76c341) +++ dialin/dg/scheduled_runs_record.py (.../scheduled_runs_record.py) (revision ceb2d67297d31ac7c816f01cd4f836f071c1d39a) @@ -83,6 +83,7 @@ # DG scheduled runs main record as an ordered dictionary self.dg_scheduled_runs_record = self._prepare_dg_scheduled_runs_record() + self.dg_scheduled_runs_record_timestamp = 0.0 if self.can_interface is not None: @@ -133,7 +134,7 @@ self.logger.debug("Request cancelled: an existing request is in progress.") return False - def _handler_dg_scheduled_runs_record(self, message): + def _handler_dg_scheduled_runs_record(self, message,timestamp=0.0): """ Handles published DG scheduled runs record messages. DG scheduled runs records are captured for processing and updating the DG scheduled runs record. @@ -171,9 +172,10 @@ self._is_getting_runs_in_progress = False # If all the messages have been received, call another function to process the raw data self._update_dg_scheduled_record_from_fw() + self.dg_scheduled_runs_record_timestamp = timestamp self._handler_received_complete_dg_scheduled_runs_record() - @publish(["dg_scheduled_runs_record"]) + @publish(["dg_scheduled_runs_record_timestamp", "dg_scheduled_runs_record"]) def _handler_received_complete_dg_scheduled_runs_record(self): """ Publishes the received scheduled runs record Index: dialin/dg/service_record.py =================================================================== diff -u -racd09d02879e8add4cf7f694f5db8e423a76c341 -rceb2d67297d31ac7c816f01cd4f836f071c1d39a --- dialin/dg/service_record.py (.../service_record.py) (revision acd09d02879e8add4cf7f694f5db8e423a76c341) +++ dialin/dg/service_record.py (.../service_record.py) (revision ceb2d67297d31ac7c816f01cd4f836f071c1d39a) @@ -68,6 +68,7 @@ self._raw_service_record = [] self._utilities = NVOpsUtils(logger=self.logger) self.dg_service_record = self._prepare_dg_service_record() + self.dg_service_record_timestamp = 0.0 if self.can_interface is not None: channel_id = DenaliChannels.dg_to_dialin_ch_id @@ -149,7 +150,7 @@ self.logger.error("Timeout!!!!") return False - def _handler_dg_service_sync(self, message): + def _handler_dg_service_sync(self, message,timestamp=0.0): """ Handles published DG service record messages. DG service records are captured for processing and updating the DG service record. @@ -186,9 +187,10 @@ self._is_getting_service_in_progress = False # If all the messages have been received, call another function to process the raw data self._utilities.process_received_record_from_fw(self.dg_service_record, self._raw_service_record) + self.dg_service_record_timestamp = timestamp self._handler_received_complete_dg_service_record() - @publish(["dg_service_record"]) + @publish(["dg_service_record_timestamp","dg_service_record"]) def _handler_received_complete_dg_service_record(self): """ Publishes the received service record Index: dialin/dg/sw_configs.py =================================================================== diff -u -racd09d02879e8add4cf7f694f5db8e423a76c341 -rceb2d67297d31ac7c816f01cd4f836f071c1d39a --- dialin/dg/sw_configs.py (.../sw_configs.py) (revision acd09d02879e8add4cf7f694f5db8e423a76c341) +++ dialin/dg/sw_configs.py (.../sw_configs.py) (revision ceb2d67297d31ac7c816f01cd4f836f071c1d39a) @@ -91,6 +91,7 @@ self._raw_sw_config_record = [] self._utilities = NVOpsUtils(logger=self.logger) self.dg_sw_config_record = self._prepare_dg_sw_configs_record() + self.dg_sw_config_record_timestamp = 0.0 if self.can_interface is not None: channel_id = DenaliChannels.dg_to_dialin_ch_id @@ -141,7 +142,7 @@ self.logger.debug("Request cancelled: an existing request is in progress.") return False - def _handler_dg_sw_config_sync(self, message): + def _handler_dg_sw_config_sync(self, message,timestamp=0.0): """ Handles published DG software configuration record messages. DG software configuration records are captured for processing and updating the DG software configuration record. @@ -178,9 +179,10 @@ self._is_getting_sw_config_in_progress = False # If all the messages have been received, call another function to process the raw data self._utilities.process_received_record_from_fw(self.dg_sw_config_record, self._raw_sw_config_record) + self.dg_sw_config_record_timestamp = timestamp self._handler_received_complete_dg_sw_config_record() - @publish(["dg_sw_config_record"]) + @publish(["dg_sw_config_record_timestamp","dg_sw_config_record"]) def _handler_received_complete_dg_sw_config_record(self): """ Publishes the received software configuration record Index: dialin/dg/switches.py =================================================================== diff -u -racd09d02879e8add4cf7f694f5db8e423a76c341 -rceb2d67297d31ac7c816f01cd4f836f071c1d39a --- dialin/dg/switches.py (.../switches.py) (revision acd09d02879e8add4cf7f694f5db8e423a76c341) +++ dialin/dg/switches.py (.../switches.py) (revision ceb2d67297d31ac7c816f01cd4f836f071c1d39a) @@ -55,6 +55,7 @@ self.can_interface = can_interface self.logger = logger + self.dg_switches_timestamp = 0.0 if self.can_interface is not None: channel_id = DenaliChannels.dg_sync_broadcast_ch_id @@ -72,8 +73,8 @@ """ return self.dg_switches_status - @publish(["dg_switches_status"]) - def _handler_switches_sync(self, message): + @publish(["dg_switches_timestamp", "dg_switches_status"]) + def _handler_switches_sync(self, message, timestamp=0.0): """ Handles published drain pump data messages. Switches data are captured for reference. @@ -88,6 +89,7 @@ self.dg_switches_status[DGSwitchesName.CONCENTRATE_CAP.name] = conc_cap >> self._CONC_CAP_BIT_SHIFT self.dg_switches_status[DGSwitchesName.DIALYSATE_CAP.name] = dialysate_cap >> self._DIAL_CAP_BIT_SHIFT + self.dg_switches_timestamp = timestamp def cmd_dg_switch_status_override(self, switch: int, status: int, reset: int = NO_RESET) -> int: """ Index: dialin/dg/system_record.py =================================================================== diff -u -racd09d02879e8add4cf7f694f5db8e423a76c341 -rceb2d67297d31ac7c816f01cd4f836f071c1d39a --- dialin/dg/system_record.py (.../system_record.py) (revision acd09d02879e8add4cf7f694f5db8e423a76c341) +++ dialin/dg/system_record.py (.../system_record.py) (revision ceb2d67297d31ac7c816f01cd4f836f071c1d39a) @@ -73,6 +73,7 @@ self._utilities = NVOpsUtils(logger=self.logger) # System main record self.dg_system_record = self._prepare_dg_system_record() + self.dg_system_record_timestamp=0.0 if self.can_interface is not None: channel_id = DenaliChannels.dg_to_dialin_ch_id @@ -187,7 +188,7 @@ self.logger.error("Timeout!!!!") return False - def _handler_dg_system_sync(self, message): + def _handler_dg_system_sync(self, message, timestamp=0.0): """ Handles published DG system record messages. HD system records are captured for processing and updating the DG system record. @@ -224,9 +225,10 @@ self._is_getting_sys_in_progress = False # If all the messages have been received, call another function to process the raw data self._utilities.process_received_record_from_fw(self.dg_system_record, self._raw_system_record) + self.dg_system_record_timestamp = timestamp self._handler_received_complete_dg_system_record() - @publish(["dg_system_record"]) + @publish(["dg_system_record_timestamp","dg_system_record"]) def _handler_received_complete_dg_system_record(self): """ Publishes the received system record Index: dialin/dg/temperatures.py =================================================================== diff -u -racd09d02879e8add4cf7f694f5db8e423a76c341 -rceb2d67297d31ac7c816f01cd4f836f071c1d39a --- dialin/dg/temperatures.py (.../temperatures.py) (revision acd09d02879e8add4cf7f694f5db8e423a76c341) +++ dialin/dg/temperatures.py (.../temperatures.py) (revision ceb2d67297d31ac7c816f01cd4f836f071c1d39a) @@ -59,6 +59,7 @@ self.can_interface = can_interface self.logger = logger # Dictionary of the temperature sensors + self.dg_temperatures_timestamp = 0.0 self.temperatures = {DGTemperaturesNames.INLET_PRIMARY_HEATER.name: 0.0, DGTemperaturesNames.HEAT_DISINFECT.name: 0.0, DGTemperaturesNames.OUTLET_PRIMARY_HEATER.name: 0.0, @@ -96,8 +97,8 @@ """ return self.temperatures[DGTemperaturesNames(sensor).name] - @publish(["temperatures"]) - def _handler_temperature_sensors_sync(self, message): + @publish(["dg_temperatures_timestamp","temperatures"]) + def _handler_temperature_sensors_sync(self, message,timestamp=0.0): """ Handles published temperature sensors message @@ -167,6 +168,8 @@ self.temperatures[DGTemperaturesNames.BARO_TEMP_SENSOR.name] = struct.unpack('f', bytearray( message['message'][MsgFieldPositions.START_POS_FIELD_21:MsgFieldPositions.END_POS_FIELD_21]))[0] + self.dg_temperatures_timestamp = timestamp + def cmd_temperatures_data_broadcast_interval_override(self, ms: int, reset: int = NO_RESET) -> int: """ Constructs and sends broadcast time interval. Index: dialin/dg/thermistors.py =================================================================== diff -u -racd09d02879e8add4cf7f694f5db8e423a76c341 -rceb2d67297d31ac7c816f01cd4f836f071c1d39a --- dialin/dg/thermistors.py (.../thermistors.py) (revision acd09d02879e8add4cf7f694f5db8e423a76c341) +++ dialin/dg/thermistors.py (.../thermistors.py) (revision ceb2d67297d31ac7c816f01cd4f836f071c1d39a) @@ -48,6 +48,7 @@ self.can_interface = can_interface self.logger = logger # Dictionary of the thermistors + self.dg_thermistors_timestamp = 0.0 self.thermistors = {ThermistorsNames.THERMISTOR_ONBOARD_NTC.name: {}, ThermistorsNames.THERMISTOR_POWER_SUPPLY_1.name: {}, ThermistorsNames.THERMISTOR_POWER_SUPPLY_2.name: {}} @@ -67,8 +68,8 @@ """ return self.thermistors[ThermistorsNames(thermistor).name] - @publish(['thermistors']) - def _handler_thermistors_sync(self, message): + @publish(["dg_thermistors_timestamp",'thermistors']) + def _handler_thermistors_sync(self, message, timestamp=0.0): """ Handles published thermistors message. @@ -86,6 +87,8 @@ self.thermistors[ThermistorsNames.THERMISTOR_POWER_SUPPLY_1.name] = pwr_supply_1 self.thermistors[ThermistorsNames.THERMISTOR_POWER_SUPPLY_2.name] = pwr_supply_2 + self.dg_thermistors_timestamp = timestamp + def cmd_thermistors_value_override(self, thermistor: int, value: float, reset: int = NO_RESET) -> int: """ Constructs and sends the thermistors value override command Index: dialin/dg/usage_info_record.py =================================================================== diff -u -racd09d02879e8add4cf7f694f5db8e423a76c341 -rceb2d67297d31ac7c816f01cd4f836f071c1d39a --- dialin/dg/usage_info_record.py (.../usage_info_record.py) (revision acd09d02879e8add4cf7f694f5db8e423a76c341) +++ dialin/dg/usage_info_record.py (.../usage_info_record.py) (revision ceb2d67297d31ac7c816f01cd4f836f071c1d39a) @@ -59,6 +59,7 @@ self._raw_usage_info_record = [] self._utilities = NVOpsUtils(logger=self.logger) self.dg_usage_info_record = self._prepare_dg_usage_info_record() + self.dg_usage_info_record_timestamp = 0.0 if self.can_interface is not None: channel_id = DenaliChannels.dg_to_dialin_ch_id @@ -128,7 +129,7 @@ self.logger.error("Timeout!!!!") return False - def _handler_dg_usage_info_sync(self, message): + def _handler_dg_usage_info_sync(self, message, timestamp=0.0): """ Handles published DG usage information record messages. @@ -164,9 +165,10 @@ self._is_getting_usage_info_in_progress = False # If all the messages have been received, call another function to process the raw data self._utilities.process_received_record_from_fw(self.dg_usage_info_record, self._raw_usage_info_record) + self.dg_usage_info_record_timestamp = timestamp self._handler_received_complete_dg_usage_info_record() - @publish(["dg_usage_info_record"]) + @publish(["dg_usage_info_record_timestamp","dg_usage_info_record"]) def _handler_received_complete_dg_usage_info_record(self): """ Publishes the received usage information record Index: dialin/dg/uv_reactors.py =================================================================== diff -u -racd09d02879e8add4cf7f694f5db8e423a76c341 -rceb2d67297d31ac7c816f01cd4f836f071c1d39a --- dialin/dg/uv_reactors.py (.../uv_reactors.py) (revision acd09d02879e8add4cf7f694f5db8e423a76c341) +++ dialin/dg/uv_reactors.py (.../uv_reactors.py) (revision ceb2d67297d31ac7c816f01cd4f836f071c1d39a) @@ -61,6 +61,7 @@ self.can_interface = can_interface self.logger = logger + self.dg_uv_reactor_timestamp = 0.0 if self.can_interface is not None: channel_id = DenaliChannels.dg_sync_broadcast_ch_id msg_id = MsgIds.MSG_ID_DG_UV_REACTORS_DATA.value @@ -104,9 +105,9 @@ """ return self.outlet_uv_reactor_state - @publish(['inlet_uv_reactor_health', 'outlet_uv_reactor_health', 'inlet_uv_reactor_state', + @publish(["dg_uv_reactor_timestamp",'inlet_uv_reactor_health', 'outlet_uv_reactor_health', 'inlet_uv_reactor_state', 'outlet_uv_reactor_state']) - def _handler_uv_reactors_sync(self, message: dict) -> None: + def _handler_uv_reactors_sync(self, message: dict, timestamp=0.0) -> None: """ Handles published thermistors message. @@ -128,6 +129,7 @@ # Check if the received state from firmware is in range otherwise, the state will be unknown self.inlet_uv_reactor_state = inlet_state self.outlet_uv_reactor_state = outlet_state + self.dg_uv_reactor_timestamp = timestamp def cmd_uv_reactors_data_broadcast_interval_override(self, ms: int, reset: int = NO_RESET) -> int: """ Index: dialin/dg/valves.py =================================================================== diff -u -r68418c949ee594c0f28b358c674a26f49eb244e6 -rceb2d67297d31ac7c816f01cd4f836f071c1d39a --- dialin/dg/valves.py (.../valves.py) (revision 68418c949ee594c0f28b358c674a26f49eb244e6) +++ dialin/dg/valves.py (.../valves.py) (revision ceb2d67297d31ac7c816f01cd4f836f071c1d39a) @@ -121,6 +121,7 @@ self.can_interface = can_interface self.logger = logger self.valves_sensed_states = OrderedDict() + self.dg_valves_states_timestamp = 0.0 if self.can_interface is not None: channel_id = DenaliChannels.dg_sync_broadcast_ch_id @@ -247,6 +248,7 @@ return DEENERGIZED @publish([ + "dg_valves_states_timestamp", "valve_states_all", "valve_state_VRF", "valve_state_VRI", @@ -262,7 +264,7 @@ "valve_state_VPD", "valve_states_enum" ]) - def _handler_valves_sync(self, message): + def _handler_valves_sync(self, message, timestamp=0.0): """ Handles published valves states message. @@ -307,6 +309,8 @@ start = end end += 1 + self.dg_valves_states_timestamp = timestamp + def cmd_valve_sensed_state_override(self, valve: int, state: bool, reset: int = NO_RESET) -> int: """ Constructs and sends the valve sensed state override command. Index: dialin/dg/voltages.py =================================================================== diff -u -racd09d02879e8add4cf7f694f5db8e423a76c341 -rceb2d67297d31ac7c816f01cd4f836f071c1d39a --- dialin/dg/voltages.py (.../voltages.py) (revision acd09d02879e8add4cf7f694f5db8e423a76c341) +++ dialin/dg/voltages.py (.../voltages.py) (revision ceb2d67297d31ac7c816f01cd4f836f071c1d39a) @@ -69,6 +69,7 @@ super().__init__() self.can_interface = can_interface self.logger = logger + self.dg_voltages_timestamp = 0.0 if self.can_interface is not None: channel_id = DenaliChannels.dg_sync_broadcast_ch_id @@ -86,9 +87,10 @@ return self.monitored_voltages @publish([ + "dg_voltages_timestamp", "monitored_voltages" ]) - def _handler_monitored_voltages_sync(self, message): + def _handler_monitored_voltages_sync(self,message,timestamp=0.0): """ Handles published DG monitored voltages data messages. Voltage data are captured for reference. @@ -158,6 +160,7 @@ self.monitored_voltages[DGMonitoredVoltages.MONITORED_LINE_FPGA_VCC_V.value] = int_vcc[0] self.monitored_voltages[DGMonitoredVoltages.MONITORED_LINE_FPGA_AUX_VCC_V.value] = aux_vcc[0] self.monitored_voltages[DGMonitoredVoltages.MONITORED_LINE_FPGA_VPVN_V.value] = vpvn[0] + self.dg_voltages_timestamp = timestamp def cmd_monitored_voltage_override(self, signal: int = 0, volts: float = 0.0, reset: int = NO_RESET) -> int: """