Index: dialin/hd/battery.py =================================================================== diff -u -r68418c949ee594c0f28b358c674a26f49eb244e6 -r1a02639c3941c0afc248ef93d7e1c521317e8d00 --- dialin/hd/battery.py (.../battery.py) (revision 68418c949ee594c0f28b358c674a26f49eb244e6) +++ dialin/hd/battery.py (.../battery.py) (revision 1a02639c3941c0afc248ef93d7e1c521317e8d00) @@ -46,7 +46,9 @@ self.can_interface.register_receiving_publication_function(channel_id, msg_id, self._handler_battery_manager_sync) msg_id = MsgIds.MSG_ID_HD_BATTERY_STATUS_DATA.value self.can_interface.register_receiving_publication_function(channel_id, msg_id, self._handler_battery_status_sync) - + + self.hd_battery_management_timestamp = 0.0 + self.hd_battery_status_timestamp = 0.0 # values from battery status message self.RemainingCapacity = 0 self.BatteryStatus = 0 @@ -145,8 +147,8 @@ """ return self.manager_values - @publish(['RemainingCapacity', 'BatteryStatus', 'BatteryChargerStatus', 'BatteryCommStatus']) - def _handler_battery_status_sync(self, message): + @publish(["hd_battery_status_timestamp", 'RemainingCapacity', 'BatteryStatus', 'BatteryChargerStatus', 'BatteryCommStatus']) + def _handler_battery_status_sync(self, message, timestamp=0.0): """ Handles published battery data messages. Battery data are captured for reference. @@ -182,14 +184,16 @@ # convert integer to string representing bits temp = struct.unpack('HH', value[0])[0] value[0] = format(temp, 'b') + self.hd_battery_status_timestamp = timestamp - @publish(['RemainingCapacityAlarm', 'RemainingTimeAlarm', 'BatteryMode', 'AtRate', 'AtRateTimeToFull', + @publish(['hd_battery_management_timestamp', + 'RemainingCapacityAlarm', 'RemainingTimeAlarm', 'BatteryMode', 'AtRate', 'AtRateTimeToFull', 'AtRateTimeToEmpty', 'AtRateOK', 'Temperature', 'Voltage', 'Current', 'AverageCurrent', 'MaxError', 'RelativeStateOfCharge', 'AbsoluteStateOfCharge', 'FullChargeCapacity', 'RunTimeToEmpty', 'AverageTimeToEmpty', 'AverageTimeToFull', 'ChargingCurrent', 'ChargingVoltage', 'CycleCount', 'DesignCapacity', 'DesignVoltage', 'SpecificationInfo', 'ManufactureDate', 'SerialNumber', 'ManufacturerName', 'DeviceName', 'DeviceChemistry']) - def _handler_battery_manager_sync(self, message): + def _handler_battery_manager_sync(self, message, timestamp=0.0): """ Handles published battery data messages. Battery data are captured for reference. @@ -225,6 +229,7 @@ # convert integer to string representing bits temp = struct.unpack('HH', value[0])[0] value[0] = format(temp, 'b') + self.hd_battery_management_timestamp = timestamp def cmd_battery_remaining_capacity_override(self, mWh: float, reset: int = NO_RESET) -> int: """ Index: dialin/hd/blood_flow.py =================================================================== diff -u -racd09d02879e8add4cf7f694f5db8e423a76c341 -r1a02639c3941c0afc248ef93d7e1c521317e8d00 --- dialin/hd/blood_flow.py (.../blood_flow.py) (revision acd09d02879e8add4cf7f694f5db8e423a76c341) +++ dialin/hd/blood_flow.py (.../blood_flow.py) (revision 1a02639c3941c0afc248ef93d7e1c521317e8d00) @@ -43,7 +43,7 @@ msg_id = MsgIds.MSG_ID_BLOOD_FLOW_DATA.value self.can_interface.register_receiving_publication_function(channel_id, msg_id, self._handler_blood_flow_sync) - + self.hd_blood_flow_timestamp = 0.0 self.target_blood_flow_rate = 0 self.measured_blood_flow_rate = 0.0 self.measured_blood_pump_rotor_speed = 0.0 @@ -117,10 +117,10 @@ """ return self.rotor_count - @publish(["target_blood_flow_rate", "measured_blood_flow_rate", "measured_blood_pump_rotor_speed", + @publish(["hd_blood_flow_timestamp", "target_blood_flow_rate", "measured_blood_flow_rate", "measured_blood_pump_rotor_speed", "measured_blood_pump_speed", "measured_blood_pump_mc_speed", "measured_blood_pump_mc_current", "pwm_duty_cycle_pct", "rotor_count"]) - def _handler_blood_flow_sync(self, message): + def _handler_blood_flow_sync(self, message, timestamp=0.0): """ Handles published blood flow data messages. Blood flow data are captured for reference. @@ -154,6 +154,7 @@ self.measured_blood_pump_mc_current = mccurr[0] self.pwm_duty_cycle_pct = pwm[0] self.rotor_count = rot[0] + self.hd_blood_flow_timestamp = timestamp def cmd_blood_flow_set_point_override(self, flow: int, mode: int = PUMP_CONTROL_MODE_CLOSED_LOOP, reset: int = NO_RESET) -> int: Index: dialin/hd/blood_leak.py =================================================================== diff -u -r0e68ec6bb733a8ab7b21a82f8b571f1678f9d2cd -r1a02639c3941c0afc248ef93d7e1c521317e8d00 --- dialin/hd/blood_leak.py (.../blood_leak.py) (revision 0e68ec6bb733a8ab7b21a82f8b571f1678f9d2cd) +++ dialin/hd/blood_leak.py (.../blood_leak.py) (revision 1a02639c3941c0afc248ef93d7e1c521317e8d00) @@ -84,6 +84,8 @@ self.can_interface.register_receiving_publication_function(channel_id, msg_id, self._handler_blood_leak_emb_mode_cmd_resp) + self.hd_blood_leak_status_timestamp = 0.0 + self.hd_blood_leak_emb_mode_response_timestamp = 0.0 self.blood_leak_status = self.NO_BLOOD_LEAK_DETECTED self.blood_leak_state = BloodLeakStates.BLOOD_LEAK_INIT_STATE.value self.blood_leak_emb_mode_cmds = dict() @@ -121,8 +123,8 @@ else: self.logger.debug("Invalid command!") - @publish(['blood_leak_status', 'blood_leak_state']) - def _handler_blood_leak_sync(self, message): + @publish(['hd_blood_leak_status_timestamp', 'blood_leak_status', 'blood_leak_state']) + def _handler_blood_leak_sync(self, message, timestamp=0.0): """ Handles published blood leak status messages. Blood leak status is captured for reference. @@ -134,6 +136,7 @@ message['message'][MsgFieldPositions.START_POS_FIELD_1:MsgFieldPositions.END_POS_FIELD_1]))[0] self.blood_leak_state = struct.unpack('i', bytearray( message['message'][MsgFieldPositions.START_POS_FIELD_2:MsgFieldPositions.END_POS_FIELD_2]))[0] + self.hd_blood_leak_status_timestamp = timestamp def cmd_blood_leak_detector_override(self, detected, reset=NO_RESET): """ @@ -291,8 +294,8 @@ else: self.logger.debug("Invalid command!") - @publish(['blood_leak_emb_mode_cmd_response']) - def _handler_blood_leak_emb_mode_cmd_resp(self, message): + @publish(['hd_blood_leak_emb_mode_response_timestamp', 'blood_leak_emb_mode_cmd_response']) + def _handler_blood_leak_emb_mode_cmd_resp(self, message, timestamp=0.0): """ Handles published blood leak status messages. Blood leak status is captured for reference. @@ -313,3 +316,4 @@ blood_leak_emb_mode_cmd_response += chr(char) self.blood_leak_emb_mode_cmds[EmbModeCommands(cmd).name] = blood_leak_emb_mode_cmd_response + self.hd_blood_leak_emb_mode_response_timestamp = timestamp Index: dialin/hd/buttons.py =================================================================== diff -u -racd09d02879e8add4cf7f694f5db8e423a76c341 -r1a02639c3941c0afc248ef93d7e1c521317e8d00 --- dialin/hd/buttons.py (.../buttons.py) (revision acd09d02879e8add4cf7f694f5db8e423a76c341) +++ dialin/hd/buttons.py (.../buttons.py) (revision 1a02639c3941c0afc248ef93d7e1c521317e8d00) @@ -44,6 +44,7 @@ self.can_interface.register_receiving_publication_function(DenaliChannels.hd_to_ui_ch_id, MsgIds.MSG_ID_POWER_OFF.value, self._handler_poweroff_timeout_occurred) + self.hd_power_off_timestamp = 0.0 def get_power_timeout_expired(self): """ @@ -63,8 +64,8 @@ self.poweroff_timeout_expired = False - @publish(["poweroff_timeout_expired"]) - def _handler_poweroff_timeout_occurred(self, message): + @publish(['hd_power_off_timestamp', "poweroff_timeout_expired"]) + def _handler_poweroff_timeout_occurred(self, message, timestamp=0.0): """ Poweroff timeout occurred handler @@ -80,6 +81,7 @@ if len(mode) > 0: self.poweroff_timeout_expired = bool(mode[0]) + self.hd_power_off_timestamp = timestamp def cmd_off_button_override(self, state: int, reset: int = NO_RESET) -> int: """ Index: dialin/hd/calibration_record.py =================================================================== diff -u -racd09d02879e8add4cf7f694f5db8e423a76c341 -r1a02639c3941c0afc248ef93d7e1c521317e8d00 --- dialin/hd/calibration_record.py (.../calibration_record.py) (revision acd09d02879e8add4cf7f694f5db8e423a76c341) +++ dialin/hd/calibration_record.py (.../calibration_record.py) (revision 1a02639c3941c0afc248ef93d7e1c521317e8d00) @@ -177,7 +177,7 @@ self.logger.error("Timeout!!!!") return False - def _handler_hd_calibration_sync(self, message): + def _handler_hd_calibration_sync(self, message, timestamp=0.0): """ Handles published HD calibration_record record messages. DG calibration_record records are captured for processing and updating the HD calibration_record record. @@ -216,6 +216,8 @@ self._utilities.process_received_record_from_fw(self.hd_calibration_record, self._raw_cal_record) self._handler_received_complete_hd_calibration_record() + self.hd_cal_record_timestamp = timestamp + @publish(["hd_calibration_record"]) def _handler_received_complete_hd_calibration_record(self): """ Index: dialin/hd/dialysate_inlet_flow.py =================================================================== diff -u -racd09d02879e8add4cf7f694f5db8e423a76c341 -r1a02639c3941c0afc248ef93d7e1c521317e8d00 --- dialin/hd/dialysate_inlet_flow.py (.../dialysate_inlet_flow.py) (revision acd09d02879e8add4cf7f694f5db8e423a76c341) +++ dialin/hd/dialysate_inlet_flow.py (.../dialysate_inlet_flow.py) (revision 1a02639c3941c0afc248ef93d7e1c521317e8d00) @@ -54,6 +54,7 @@ self.measured_dialysate_inlet_pump_mc_current = 0.0 self.pwm_duty_cycle_pct = 0.0 self.rotor_count = 0 + self.hd_dial_inlet_flow_timestamp = 0.0 def get_target_dialysate_inlet_flow_rate(self): """ @@ -120,6 +121,7 @@ return self.rotor_count @publish([ + "hd_dial_inlet_flow_timestamp", "target_dialysate_inlet_flow_rate", "measured_dialysate_inlet_flow_rate", "measured_dialysate_inlet_pump_rotor_speed", @@ -128,7 +130,7 @@ "measured_dialysate_inlet_pump_mc_current", "pwm_duty_cycle_pct", "rotor_count" ]) - def _handler_dialysate_inlet_flow_sync(self, message): + def _handler_dialysate_inlet_flow_sync(self, message, timestamp=0.0): """ Handles published dialysate inlet flow data messages. Dialysate flow data are captured for reference. @@ -162,6 +164,7 @@ self.measured_dialysate_inlet_pump_mc_current = mccurr[0] self.pwm_duty_cycle_pct = pwm[0] self.rotor_count = rot[0] + self.hd_dial_inlet_flow_timestamp = timestamp def cmd_dialysate_inlet_flow_set_point_override(self, flow: int, Index: dialin/hd/dialysate_outlet_flow.py =================================================================== diff -u -racd09d02879e8add4cf7f694f5db8e423a76c341 -r1a02639c3941c0afc248ef93d7e1c521317e8d00 --- dialin/hd/dialysate_outlet_flow.py (.../dialysate_outlet_flow.py) (revision acd09d02879e8add4cf7f694f5db8e423a76c341) +++ dialin/hd/dialysate_outlet_flow.py (.../dialysate_outlet_flow.py) (revision 1a02639c3941c0afc248ef93d7e1c521317e8d00) @@ -51,6 +51,7 @@ self.measured_dialysate_outlet_pump_mc_speed = 0.0 self.measured_dialysate_outlet_pump_mc_current = 0.0 self.pwm_duty_cycle_pct = 0.0 + self.hd_dial_outlet_flow_timestamp = 0.0 def get_reference_dialysate_outlet_uf_volume(self): """ @@ -107,6 +108,7 @@ return self.pwm_duty_cycle_pct @publish([ + "hd_dial_outlet_flow_timestamp", "reference_dialysate_outlet_uf_volume", "measured_dialysate_outlet_uf_volume", "measured_dialysate_outlet_pump_rotor_speed", @@ -115,7 +117,7 @@ "measured_dialysate_outlet_pump_mc_current", "pwm_duty_cycle_pct" ]) - def _handler_dialysate_outlet_flow_sync(self, message): + def _handler_dialysate_outlet_flow_sync(self, message, timestamp=0.0): """ Handles published dialysate outlet flow data messages. Dialysate flow data are captured for reference. @@ -146,6 +148,7 @@ self.measured_dialysate_outlet_pump_mc_speed = mcspeed[0] self.measured_dialysate_outlet_pump_mc_current = mccurr[0] self.pwm_duty_cycle_pct = pwm[0] + self.hd_dial_outlet_flow_timestamp = timestamp def cmd_dialysate_outlet_flow_set_point_override(self, flow: int, Index: dialin/hd/fans.py =================================================================== diff -u -racd09d02879e8add4cf7f694f5db8e423a76c341 -r1a02639c3941c0afc248ef93d7e1c521317e8d00 --- dialin/hd/fans.py (.../fans.py) (revision acd09d02879e8add4cf7f694f5db8e423a76c341) +++ dialin/hd/fans.py (.../fans.py) (revision 1a02639c3941c0afc248ef93d7e1c521317e8d00) @@ -57,6 +57,7 @@ self.target_rpm = 0.0 self.inlet_1_rpm = 0.0 self.rpm_alarm_time = 0 + self.hd_fans_data_timestamp = 0.0 def get_fans_target_duty_cycle(self): """ @@ -90,8 +91,8 @@ """ return self.rpm_alarm_time - @publish(['duty_cycle', 'target_rpm', 'inlet_1_rpm', 'rpm_alarm_time']) - def _handler_fans_sync(self, message): + @publish(["hd_fans_data_timestamp", 'duty_cycle', 'target_rpm', 'inlet_1_rpm', 'rpm_alarm_time']) + def _handler_fans_sync(self, message,timestamp=0.0): """ Handles published thermistors message. @@ -106,6 +107,7 @@ message['message'][MsgFieldPositions.START_POS_FIELD_3:MsgFieldPositions.END_POS_FIELD_3]))[0] self.rpm_alarm_time = struct.unpack('i', bytearray( message['message'][MsgFieldPositions.START_POS_FIELD_4:MsgFieldPositions.END_POS_FIELD_4]))[0] + self.hd_fans_data_timestamp = timestamp def cmd_fans_rpm_override(self, fan: int, rpm: float, reset: int = NO_RESET) -> int: """ Index: dialin/hd/fluid_leak.py =================================================================== diff -u -r0e68ec6bb733a8ab7b21a82f8b571f1678f9d2cd -r1a02639c3941c0afc248ef93d7e1c521317e8d00 --- dialin/hd/fluid_leak.py (.../fluid_leak.py) (revision 0e68ec6bb733a8ab7b21a82f8b571f1678f9d2cd) +++ dialin/hd/fluid_leak.py (.../fluid_leak.py) (revision 1a02639c3941c0afc248ef93d7e1c521317e8d00) @@ -51,6 +51,7 @@ self._handler_fluid_leak_sync) self.fluid_leak_state = self.NO_FLUID_LEAK_DETECTED_STATE + self.hd_fluid_leak_timestamp = 0.0 def get_fluid_leak_state(self): """ @@ -60,8 +61,8 @@ """ return self.fluid_leak_state - @publish(["fluid_leak_state"]) - def _handler_fluid_leak_sync(self, message): + @publish(["hd_fluid_leak_timestamp", "fluid_leak_state"]) + def _handler_fluid_leak_sync(self, message, timestamp=0.0): """ 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.hd_fluid_leak_timestamp = timestamp def cmd_fluid_leak_detector_override(self, detected_state: int, reset: int = NO_RESET) -> int: """