Index: leahi_dialin/common/msg_ids.py =================================================================== diff -u -r4e55e6d9f6f0be9c7bd903159b7784ea0562fcd9 -r0571a865492bb7439b1dda0d867239efff2c6dd4 --- leahi_dialin/common/msg_ids.py (.../msg_ids.py) (revision 4e55e6d9f6f0be9c7bd903159b7784ea0562fcd9) +++ leahi_dialin/common/msg_ids.py (.../msg_ids.py) (revision 0571a865492bb7439b1dda0d867239efff2c6dd4) @@ -208,17 +208,17 @@ MSG_ID_TD_VITALS_ADJUSTMENT_RESPONSE = 0xB9 MSG_ID_UI_DD_NVM_GET_RECORD_REQUEST = 0xBA MSG_ID_DD_NVM_SYSTEM_RECORD_RESPONSE = 0xBB - MSG_ID_UI_DD_NVM_SET_SYSTEM_RECORD_REQUEST = 0xBC - MSG_ID_DD_NVM_SERVICE_RECORD_RESPONSE = 0xBD - MSG_ID_UI_DD_NVM_SET_SERVICE_RECORD_REQUEST = 0xBE - MSG_ID_DD_NVM_INSTITUTIONAL_RECORD_RESPONSE = 0xBF - MSG_ID_UI_DD_NVM_SET_INSTITUTIONAL_RECORD_REQUEST = 0xC0 - MSG_ID_DD_NVM_USAGE_INFO_RECORD_RESPONSE = 0xC1 - MSG_ID_UI_DD_NVM_SET_USAGE_INFO_RECORD_REQUEST = 0xC2 + MSG_ID_TD_HEMODIAFILTRATION_DATA = 0xBC + MSG_ID_UI_PAUSE_SUB_FLOW_REQUEST = 0xBD + MSG_ID_TD_PAUSE_SUB_FLOW_RESPONSE = 0xBE + MSG_ID_UI_AUTO_SUBSTITUTION_REQUEST = 0xBF + MSG_ID_TD_AUTO_SUBSTITUTION_REPONSE = 0xC0 + MSG_ID_UI_HDF_ADJUSTMENT_REQUEST = 0xC1 + MSG_ID_TD_HDF_ADJUSTMENT_RESPONSE = 0xC2 MSG_ID_DD_NVM_CAL_PRESSURE_SENSOR_RESPONSE = 0xC3 - MSG_ID_UI_DD_NVM_SET_CAL_PRESSURE_SENSOR_REQUEST = 0xC4 - MSG_ID_DD_NVM_CAL_TEMP_SENSOR_RESPONSE = 0xC5 - MSG_ID_UI_DD_NVM_SET_CAL_TEMP_SENSOR_REQUEST = 0xC6 + MSG_ID_TD_DRY_BICARD_DISCONNECT_DATA = 0xC4 + MSG_ID_UI_DRY_BICARD_DISCONNECT_REQUEST = 0xC5 + MSG_ID_TD_DRY_BICARD_DISCONNECT_RESPONSE = 0xC6 MSG_ID_DD_NVM_CAL_CONC_PUMP_RESPONSE = 0xC7 MSG_ID_UI_DD_NVM_SET_CAL_CONC_PUMP_REQUEST = 0xC8 MSG_ID_DD_NVM_CAL_D12_PUMP_RESPONSE = 0xC9 @@ -362,7 +362,11 @@ MSG_ID_TD_SYRINGE_PUMP_FORCE_SENSOR_CALIBRATION_REQUEST = 0x8060 MSG_ID_TD_GET_ALARM_PROPERTIES_REQUEST = 0x8061 MSG_ID_TD_ALARM_PROPERTIES_RESPONSE = 0x8062 + MSG_ID_BATTERY_REGISTERS_OVERRIDE_REQUEST = 0x8063 + MSG_ID_TD_BATTERY_PUBLISH_INTERVAL_OVERRIDE_REQUEST = 0x8064 + MSG_ID_TD_BATTERY_I2C_STATUS_OVERRIDE_REQUEST = 0x8068 + MSG_ID_TD_TRAINING_TEST_OVERRIDE_REQUEST = 0x8999 MSG_ID_DD_TESTER_LOGIN_REQUEST = 0xA000 Index: leahi_dialin/ui/td_messaging.py =================================================================== diff -u -r4e55e6d9f6f0be9c7bd903159b7784ea0562fcd9 -r0571a865492bb7439b1dda0d867239efff2c6dd4 --- leahi_dialin/ui/td_messaging.py (.../td_messaging.py) (revision 4e55e6d9f6f0be9c7bd903159b7784ea0562fcd9) +++ leahi_dialin/ui/td_messaging.py (.../td_messaging.py) (revision 0571a865492bb7439b1dda0d867239efff2c6dd4) @@ -326,6 +326,51 @@ self.can_interface.send(message, 0) + + def td_syringePump(self, PumpState : int , + DeliveryState : int , + SetRate : float, + MeasRate : float, + Position : int , + VolumeDelivered : float, + Home : float, + Force : float, + SafetyVolume : float, + Status : int ): + """ + Broadcasts the current TD voltage data (Msg ID: 0x1D, 29) + Args: + @param line_1_2v (float): Processor 1.2V + @param line_3_3v (float): Logic voltage (3.3V) + @param line_logic_5v (float): Logic voltage (5V) + @param line_24v_1 (float): Actuators voltage (24V) + @param line_24v_2 (float): Actuators voltage (24V) + @param fpga_vcc (float): FPGA input voltage (3V) + @param fpga_vaux (float): FPGA aux. voltage (3V) + @param fpga_vpvn (float): FPGA pvn voltage (1V) + @return: None + """ + if not self.can_enabled: + raise ValueError("CAN Interface is not enabled") + + payload = conversions.unsigned_integer_to_bytearray(PumpState ) + payload += conversions.unsigned_integer_to_bytearray(DeliveryState ) + payload += conversions.float_to_bytearray (SetRate ) + payload += conversions.float_to_bytearray (MeasRate ) + payload += conversions.unsigned_integer_to_bytearray(Position ) + payload += conversions.float_to_bytearray (VolumeDelivered ) + payload += conversions.float_to_bytearray (Home ) + payload += conversions.float_to_bytearray (Force ) + payload += conversions.float_to_bytearray (SafetyVolume ) + payload += conversions.unsigned_integer_to_bytearray(Status ) + message = CAN.CanMessage.build_message( + channel_id=CAN.CanChannels.td_sync_broadcast_ch_id, + message_id=msg_ids.MsgIds.MSG_ID_TD_SYRINGE_PUMP_DATA.value, + payload=payload) + + self.can_interface.send(message, 0) + + def td_voltage(self, line_1_2v : float, line_3_3v : float, line_logic_5v : float, @@ -367,6 +412,7 @@ self.can_interface.send(message, 0) + def td_pressure(self, H2_arterial_pressure : float , H14_venous_pressure : float , @@ -428,8 +474,8 @@ self.can_interface.send(message, 0) def td_heparin( self, - target : float , cumulative : float , + target : float , time_remaining : int ): """ Broadcasts the current TD Heparin data (Msg ID: 0xXX, XX) @@ -443,9 +489,9 @@ raise ValueError("CAN Interface is not enabled") - payload = conversions.float_to_bytearray (target ) - payload += conversions.float_to_bytearray (cumulative ) - payload += conversions.unsigned_integer_to_bytearray(time_remaining ) + payload = conversions.float_to_bytearray (cumulative ) + payload += conversions.float_to_bytearray (target ) + payload += conversions.unsigned_integer_to_bytearray(time_remaining ) message = CAN.CanMessage.build_message( channel_id=CAN.CanChannels.td_sync_broadcast_ch_id, @@ -749,25 +795,66 @@ self.can_interface.send(message, 0) - def td_recirculate_progress(self, vTimeout: int, - vCountdown: int): + def td_dry_bicart_disconnect_data(self, vShowDialog : int, + vTotal : int, + vProgress : int, + vDrainInProgress : int, + vDepressurizeInProgress : int): """ rinseback progress message (Msg ID: 0x8F, 143) Args: @param vTimeout : (int) Total Timeout of Recirculate delivery @param vCountdown : (int) Current Timeout count down of Recirculate delivery @return: None """ - payload = conversions.unsigned_integer_to_bytearray (vTimeout ) - payload += conversions.unsigned_integer_to_bytearray (vCountdown ) + payload = conversions.integer_to_bytearray ( vShowDialog ) + payload += conversions.integer_to_bytearray ( vTotal ) + payload += conversions.integer_to_bytearray ( vProgress ) + payload += conversions.integer_to_bytearray ( vDrainInProgress ) + payload += conversions.integer_to_bytearray ( vDepressurizeInProgress ) message = CAN.CanMessage.build_message( channel_id=CAN.CanChannels.td_to_ui_ch_id, + message_id=msg_ids.MsgIds.MSG_ID_TD_DRY_BICARD_DISCONNECT_DATA.value, + payload=payload) + self.can_interface.send(message, 0) + + + def td_recirculate_progress(self, vCountdown: int): + """ + rinseback progress message (Msg ID: 0x8F, 143) + Args: + @param vCountdown : (int) Current Timeout count down of Recirculate delivery + @return: None + """ + payload = conversions.unsigned_integer_to_bytearray (vCountdown ) + + message = CAN.CanMessage.build_message( + channel_id=CAN.CanChannels.td_to_ui_ch_id, message_id=msg_ids.MsgIds.MSG_ID_TD_RECIRCULATE_DATA.value, payload=payload) self.can_interface.send(message, 0) + def td_dry_bicart_cmd_response(self, vAccepted: int, vRejectionReason: int): + """ + rinseback command response message (Msg ID: 0xC6, 145) + Args: + @param vRejectionReason : (int) rejection reason + @return: None + """ + payload = conversions.integer_to_bytearray(vAccepted) + payload += conversions.integer_to_bytearray(vRejectionReason) + + message = CAN.CanMessage.build_message( + channel_id=CAN.CanChannels.td_to_ui_ch_id, + message_id=msg_ids.MsgIds.MSG_ID_TD_DRY_BICARD_DISCONNECT_RESPONSE.value, + payload=payload) + + self.can_interface.send(message, 0) + + + def td_recirculate_cmd_response(self, vAccepted: int, vRejectionReason: int): """ rinseback command response message (Msg ID: 0x99, 145) @@ -1458,7 +1545,7 @@ def td_rinseback_progress(self, vTargetVolume: float, vDeliveredVolume: float, vFlowRate: int, vTimeout: int, - vCountdown: int, vIsCompleted: int): + vCountdown: int, vIsCompleted: int, vIsAllowed: int): """ rinseback progress message (Msg ID: 0x8F, 143) Args: @@ -1476,6 +1563,7 @@ payload += conversions.unsigned_integer_to_bytearray (vTimeout ) payload += conversions.unsigned_integer_to_bytearray (vCountdown ) payload += conversions.integer_to_bytearray (vIsCompleted ) + payload += conversions.integer_to_bytearray (vIsAllowed ) message = CAN.CanMessage.build_message( channel_id=CAN.CanChannels.td_to_ui_ch_id, @@ -2155,14 +2243,109 @@ payload += conversions.float_to_bytearray(tmpPressure ) payload += conversions.float_to_bytearray(dialysate_temp ) - message = CAN.DenaliMessage.build_message( - channel_id=CAN.DenaliChannels.td_to_ui_ch_id, + message = CAN.CanMessage.build_message( + channel_id=CAN.CanChannels.td_to_ui_ch_id, message_id=msg_ids.MsgIds.MSG_ID_TD_TREATMENT_LOG_AVERAGE_DATA.value, payload=payload) self.can_interface.send(message, 0) + def td_hdf_data(self, HDFState : int, + AutoSubState : int, + reqRate : float, + targetTMP : float, + currentRate : float, + currentTMP : float, + reqVol : float, + totalVol : float, + IsHdfReqState : int) -> None: + """ + send the treatment log data + @param HDFState : (U32) blood flow rate + @param AutoSubState : (U32) dialysate flow rate + @param reqRate : (F32) uf flow rate + @param targetTMP : (F32) arterial Pressure + @param currentRate : (F32) venous Pressure + @param currentTMP : (F32) tmp Pressure + @param reqVol : (F32) dialysate temp + @param totalVol : (F32) dialysate temp + @param IsHdfReqState : (U32) dialysate temp + @return: none + """ + payload = conversions.integer_to_bytearray(HDFState ) + payload += conversions.integer_to_bytearray(AutoSubState ) + payload += conversions.float_to_bytearray (reqRate ) + payload += conversions.float_to_bytearray (targetTMP ) + payload += conversions.float_to_bytearray (currentRate ) + payload += conversions.float_to_bytearray (currentTMP ) + payload += conversions.float_to_bytearray (reqVol ) + payload += conversions.float_to_bytearray (totalVol ) + payload += conversions.integer_to_bytearray(IsHdfReqState ) + + message = CAN.CanMessage.build_message( + channel_id=CAN.CanChannels.td_to_ui_ch_id, + message_id=msg_ids.MsgIds.MSG_ID_TD_HEMODIAFILTRATION_DATA.value, + payload=payload) + + self.can_interface.send(message, 0) + + + def td_hdf_state_cmd_response(self, vAccepted: int, vRejectionReason: int): + """ + rinseback command response message (Msg ID: 0x99, 145) + Args: + @param vRejectionReason : (int) rejection reason + @return: None + """ + payload = conversions.integer_to_bytearray(vAccepted) + payload += conversions.integer_to_bytearray(vRejectionReason) + + message = CAN.CanMessage.build_message( + channel_id=CAN.CanChannels.td_to_ui_ch_id, + message_id=msg_ids.MsgIds.MSG_ID_TD_PAUSE_SUB_FLOW_RESPONSE.value, + payload=payload) + + self.can_interface.send(message, 0) + + + def td_auto_sub_state_response(self, vAccepted: int, vRejectionReason: int): + """ + rinseback command response message (Msg ID: 0x99, 145) + Args: + @param vRejectionReason : (int) rejection reason + @return: None + """ + payload = conversions.integer_to_bytearray(vAccepted) + payload += conversions.integer_to_bytearray(vRejectionReason) + + message = CAN.CanMessage.build_message( + channel_id=CAN.CanChannels.td_to_ui_ch_id, + message_id=msg_ids.MsgIds.MSG_ID_TD_AUTO_SUBSTITUTION_REPONSE.value, + payload=payload) + + self.can_interface.send(message, 0) + + + def td_hdf_adjust_response(self, vAccepted: int, vTxModeRejectionReason: int, vFluidVOlumeRejectionReason: int): + """ + rinseback command response message (Msg ID: 0x99, 145) + Args: + @param vRejectionReason : (int) rejection reason + @return: None + """ + payload = conversions.integer_to_bytearray(vAccepted ) + payload += conversions.integer_to_bytearray(vTxModeRejectionReason ) + payload += conversions.integer_to_bytearray(vFluidVOlumeRejectionReason ) + + message = CAN.CanMessage.build_message( + channel_id=CAN.CanChannels.td_to_ui_ch_id, + message_id=msg_ids.MsgIds.MSG_ID_TD_HDF_ADJUSTMENT_RESPONSE.value, + payload=payload) + + self.can_interface.send(message, 0) + + def cmd_send_general_response(self, message_id: int, accepted: int, reason: int, is_pure_data: bool = False, has_parameters: bool = False,