Index: leahi_dialin/ui/td_messaging.py =================================================================== diff -u -r1b42314e7ec473f90ea1343fe66e985a34fd3fda -rbef7694843f167b21d202396e6c738d49f8514b9 --- leahi_dialin/ui/td_messaging.py (.../td_messaging.py) (revision 1b42314e7ec473f90ea1343fe66e985a34fd3fda) +++ leahi_dialin/ui/td_messaging.py (.../td_messaging.py) (revision bef7694843f167b21d202396e6c738d49f8514b9) @@ -37,7 +37,6 @@ Args: op_mode (int ): operation mode sub_mode (int, optional ): operation sub-mode. Defaults to 0. - """ if not self.can_enabled: raise ValueError("CAN Interface is not enabled") @@ -97,7 +96,6 @@ @param H6_rot_hall_state : Rotor hall state (1=home, 0=not home) @return: None """ - if not self.can_enabled: raise ValueError("CAN Interface is not enabled") @@ -139,7 +137,6 @@ @param controlling : air control @return: None """ - if not self.can_enabled: raise ValueError("CAN Interface is not enabled") @@ -319,7 +316,6 @@ @param fpga_vpvn (float): FPGA pvn voltage (1V) @return: None """ - if not self.can_enabled: raise ValueError("CAN Interface is not enabled") @@ -372,7 +368,6 @@ @param tmp_max (float) : TMP maximum @return: None """ - if not self.can_enabled: raise ValueError("CAN Interface is not enabled") @@ -409,7 +404,6 @@ @param time_remaining (int) : Heparin time remaining @return: None """ - if not self.can_enabled: raise ValueError("CAN Interface is not enabled") @@ -437,7 +431,6 @@ @param heartRate (int ) : heart rate @return: None """ - if not self.can_enabled: raise ValueError("CAN Interface is not enabled") @@ -466,7 +459,6 @@ @param state (int ) : Saline bolus state @return: None """ - if not self.can_enabled: raise ValueError("CAN Interface is not enabled") @@ -497,7 +489,6 @@ @param state (int ) : UF state @return: None """ - if not self.can_enabled: raise ValueError("CAN Interface is not enabled") @@ -513,7 +504,7 @@ payload=payload) self.can_interface.send(message, 0) - + def td_treatment_time( self, tx_duration_s : int , tx_elapsed_s : int , @@ -526,7 +517,6 @@ @param tx_remaining_s (int) : Treatment time remaining (s) @return: None """ - if not self.can_enabled: raise ValueError("CAN Interface is not enabled") @@ -560,7 +550,6 @@ @param max_dial_rate_mLH : Maximum dial rate in mL/H. @return: None """ - if not self.can_enabled: raise ValueError("CAN Interface is not enabled") @@ -591,7 +580,6 @@ @param dialysate_temp (float) : Target Dialysate Temperature @return: None """ - if not self.can_enabled: raise ValueError("CAN Interface is not enabled") @@ -607,6 +595,32 @@ self.can_interface.send(message, 0) + + def td_blood_prime_progress(self, + target_volume : float , + delivered_volume : float ): + """ + Broadcasts blood prime data (Msg ID: 0x97, 151) + Args: + @param target_volume (float) : Target Volume + @param delivered_volume (float) : Delivered Volume + @return: None + """ + + if not self.can_enabled: + raise ValueError("CAN Interface is not enabled") + + payload = conversions.float_to_bytearray (target_volume ) + payload += conversions.float_to_bytearray (delivered_volume ) + + message = CAN.DenaliMessage.build_message( + channel_id=CAN.DenaliChannels.td_sync_broadcast_ch_id, + message_id=msg_ids.MsgIds.MSG_ID_TD_BLOOD_PRIME_PROGRESS_DATA.value, + payload=payload) + + self.can_interface.send(message, 0) + + def td_versions(self, major: int, minor: int, micro: int, build: int, fpga_id: int, fpga_major: int, fpga_minor: int, fpga_lab: int, compatibility_rev: int): @@ -992,7 +1006,7 @@ vRincebackFlowRateDefReason (int, optional): None zero value of rejection reason. Defaults to 0. vSubVolumeMinReason (int, optional): None zero value of rejection reason. Defaults to 0. vSubVolumeMaxReason (int, optional): None zero value of rejection reason. Defaults to 0. - vSubVolumeDefReason (int, optional): None zero value of rejection reason. Defaults to 0. + vSubVolumeDefReason (int, optional): None zero value of rejection reason. Defaults to 0. """ payload = conversions.integer_to_bytearray(vAccepted ) payload += conversions.integer_to_bytearray(vBloodFlowMinReason ) @@ -1167,7 +1181,7 @@ vChlorineWaterSampleCheckMinRejectionReason (int, optional): None zero value of rejection reason. Defaults to 0. vChlorineWaterSampleCheckMaxRejectionReason (int, optional): None zero value of rejection reason. Defaults to 0. vChlorineWaterSampleCheckDefRejectionReason (int, optional): None zero value of rejection reason. Defaults to 0. - vWaterSampleTestResultRequiredDefRejectionReason (int, optional): None zero value of rejection reason. Defaults to 0. + vWaterSampleTestResultRequiredDefRejectionReason (int, optional): None zero value of rejection reason. Defaults to 0. """ payload = conversions.integer_to_bytearray(vAccepted ) payload += conversions.integer_to_bytearray(vMinRORejectionRatioAlarmMaxRejectionReason ) @@ -1224,6 +1238,82 @@ self.can_interface.send(message, 0) + def td_rinseback_progress(self, vTargetVolume: float, vDeliveredVolume: float, vFlowRate: int, vTimeout: int, + vCountdown: int, vIsCompleted: int): + """ + rinseback progress message (Msg ID: 0x8F, 143) + Args: + @param vTargetVolume : (float) target volume (mL) + @param vDeliveredVolume : (float) delivered volume (mL) + @param vFlowRate : (int) flow rate (mL/min) + @param vTimeout : (int) timeout (s) + @param vCountdown : (int) countdown time (s) + @param vIsCompleted : (int) completed flag + @return: None + """ + payload = conversions.float_to_bytearray (vTargetVolume ) + payload += conversions.float_to_bytearray (vDeliveredVolume ) + payload += conversions.unsigned_integer_to_bytearray (vFlowRate ) + payload += conversions.unsigned_integer_to_bytearray (vTimeout ) + payload += conversions.unsigned_integer_to_bytearray (vCountdown ) + payload += conversions.integer_to_bytearray (vIsCompleted ) + + message = CAN.DenaliMessage.build_message( + channel_id=CAN.DenaliChannels.td_to_ui_ch_id, + message_id=msg_ids.MsgIds.MSG_ID_TD_RINSEBACK_PROGRESS.value, + payload=payload) + self.can_interface.send(message, 0) + + + def td_rinseback_cmd_response(self, vRejectionReason: int): + """ + rinseback command response message (Msg ID: 0x91, 145) + Args: + @param vRejectionReason : (int) rejection reason + @return: None + """ + payload = conversions.integer_to_bytearray(1 if vRejectionReason == 0 else 0) + payload += conversions.integer_to_bytearray(vRejectionReason) + + message = CAN.DenaliMessage.build_message( + channel_id=CAN.DenaliChannels.td_to_ui_ch_id, + message_id=msg_ids.MsgIds.MSG_ID_TD_RINSEBACK_CMD_RESPONSE.value, + payload=payload) + self.can_interface.send(message, 0) + + + def td_blood_set_auto_load_response(self,vRejectionReason: int): + """ + the blood set auto eject response message method(Msg ID: 0xXX, XXX) + Args: + None + @return: None + """ + payload = conversions.integer_to_bytearray(1 if vRejectionReason == 0 else 0) + payload += conversions.integer_to_bytearray(vRejectionReason) + + message = CAN.DenaliMessage.build_message( + channel_id=CAN.DenaliChannels.td_to_ui_ch_id, + message_id=msg_ids.MsgIds.MSG_ID_TD_ADJUST_DISPOSABLES_CONFIRM_RESPONSE.value, + payload=payload) + self.can_interface.send(message, 0) + + def td_blood_set_auto_eject_response(self,vRejectionReason: int): + """ + the heparin adjustment response message method(Msg ID: 0xXX, XXX) + Args: + None + @return: None + """ + payload = conversions.integer_to_bytearray(1 if vRejectionReason == 0 else 0) + payload += conversions.integer_to_bytearray(vRejectionReason) + + message = CAN.DenaliMessage.build_message( + channel_id=CAN.DenaliChannels.td_to_ui_ch_id, + message_id=msg_ids.MsgIds.MSG_ID_TD_ADJUST_DISPOSABLES_REMOVAL_CONFIRM_RESPONSE.value, + payload=payload) + self.can_interface.send(message, 0) + def td_Treatment_Parameters_CreateRx(self, vRejectionReason: int): """ TD response to in initiate Treatment and enter Create Rx (Msg ID: 0x46, 70) @@ -1289,7 +1379,6 @@ vHeparinDispensingRateRejectReason (int, optional): None zero value of rejection reason. Defaults to 0. vHeparinBolusVolumeRejectReason (int, optional): None zero value of rejection reason. Defaults to 0. """ - if not self.can_enabled: raise ValueError("CAN Interface is not enabled")