Index: leahi_dialin/ui/td_messaging.py =================================================================== diff -u -reb3e8ec85b8c2cfd7215d762117c617b8084be45 -r30fdc3039aa879ecc484f45f30ebe93fb1787e83 --- leahi_dialin/ui/td_messaging.py (.../td_messaging.py) (revision eb3e8ec85b8c2cfd7215d762117c617b8084be45) +++ leahi_dialin/ui/td_messaging.py (.../td_messaging.py) (revision 30fdc3039aa879ecc484f45f30ebe93fb1787e83) @@ -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") @@ -397,38 +392,33 @@ self.can_interface.send(message, 0) - def td_saline( self, - target_volume : int , - cumulative_volume : float , - bolus_volume : float , - state : int ): + def td_heparin( self, + target : float , + cumulative : float , + time_remaining : int ): """ - Broadcasts the current TD Saline data (Msg ID: 0x3D, 61) + Broadcasts the current TD Heparin data (Msg ID: 0xXX, XX) Args: - @param target_volume (int ) : Saline target volume - @param cumulative_volume (float) : Saline cumulative volume - @param bolus_volume (float) : Saline bolus set volume - @param state (int ) : Saline bolus state + @param target (float) : Heparin target volume + @param cumulative (float) : Heparin cumulative volume + @param time_remaining (int) : Heparin time remaining @return: None """ - if not self.can_enabled: raise ValueError("CAN Interface is not enabled") - payload = conversions.unsigned_integer_to_bytearray(target_volume ) - payload += conversions.float_to_bytearray (cumulative_volume ) - payload += conversions.float_to_bytearray (bolus_volume ) - payload += conversions.unsigned_integer_to_bytearray(state ) + payload = conversions.float_to_bytearray (target ) + payload += conversions.float_to_bytearray (cumulative ) + payload += conversions.unsigned_integer_to_bytearray(time_remaining ) message = CAN.DenaliMessage.build_message( channel_id=CAN.DenaliChannels.td_sync_broadcast_ch_id, - message_id=msg_ids.MsgIds.MSG_ID_TD_SALINE_BOLUS_DATA.value, + message_id=msg_ids.MsgIds.MSG_ID_TD_HEPARIN_DATA.value, payload=payload) self.can_interface.send(message, 0) - def td_vitals( self, systolic : int , diastolic : int , @@ -441,7 +431,6 @@ @param heartRate (int ) : heart rate @return: None """ - if not self.can_enabled: raise ValueError("CAN Interface is not enabled") @@ -456,6 +445,36 @@ payload=payload) self.can_interface.send(message, 0) + def td_saline( self, + target_volume : int , + cumulative_volume : float , + bolus_volume : float , + state : int ): + """ + Broadcasts the current TD Saline data (Msg ID: 0x3D, 61) + Args: + @param target_volume (int ) : Saline target volume + @param cumulative_volume (float) : Saline cumulative volume + @param bolus_volume (float) : Saline bolus set volume + @param state (int ) : Saline bolus state + @return: None + """ + if not self.can_enabled: + raise ValueError("CAN Interface is not enabled") + + + payload = conversions.unsigned_integer_to_bytearray(target_volume ) + payload += conversions.float_to_bytearray (cumulative_volume ) + payload += conversions.float_to_bytearray (bolus_volume ) + payload += conversions.unsigned_integer_to_bytearray(state ) + + message = CAN.DenaliMessage.build_message( + channel_id=CAN.DenaliChannels.td_sync_broadcast_ch_id, + message_id=msg_ids.MsgIds.MSG_ID_TD_SALINE_BOLUS_DATA.value, + payload=payload) + + self.can_interface.send(message, 0) + def td_ultrafiltration( self, set_volume : float , target_rate : float , @@ -470,7 +489,6 @@ @param state (int ) : UF state @return: None """ - if not self.can_enabled: raise ValueError("CAN Interface is not enabled") @@ -499,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") @@ -533,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") @@ -564,7 +580,6 @@ @param dialysate_temp (float) : Target Dialysate Temperature @return: None """ - if not self.can_enabled: raise ValueError("CAN Interface is not enabled") @@ -647,6 +662,7 @@ self.can_interface.send(message, 0) + def td_vitals_adjustment_response(self,vRejectionReason: int): """ the vitals adjustment response message method(Msg ID: 0x64, 100) @@ -663,6 +679,615 @@ payload=payload) self.can_interface.send(message, 0) + + def td_date_time_response(self,vRejectionReason: int): + """ + the TD Date/ Time response message method(Msg ID: 0x6D, 100) + 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_DATE_AND_TIME_RESPONSE.value, + payload=payload) + self.can_interface.send(message, 0) + + def td_heparin_adjustment_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_HEPARIN_RESPONSE.value, + payload=payload) + self.can_interface.send(message, 0) + + def td_end_tx_response(self,vRejectionReason: int): + """ + the end treatment 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_END_TREATMENT_RESPONSE.value, + payload=payload) + self.can_interface.send(message, 0) + + def td_institutional_response(self, vRejectionReason : int, + vBloodFlowMin : int, + vBloodFlowMax : int, + vBloodFlowDef : int, + vDialysateFlowMin : int, + vDialysateFlowMax : int, + vDialysateFlowDef : int, + vTxDurationMin : int, + vTxDurationMax : int, + vTxDurationDef : int, + vHepBolVolumeMin : float, + vHepBolVolumeMax : float, + vHepBolVolumeDef : float, + vHepDispRateMin : float, + vHepDispRateMax : float, + vHepDispRateDef : float, + vHepStopTimeMin : int, + vHepStopTimeMax : int, + vDialysateTempMin : float, + vDialysateTempMax : float, + vDialysateTempDef : float, + vPotassiumMin : float, + vPotassiumMax : float, + vCalciumMin : float, + vCalciumMax : float, + DialysateBicarbMin : int, + DialysateBicarbMax : int, + DialysateBicarbDef : int, + SodiumBicarbMin : int, + SodiumBicarbMax : int, + SodiumBicarbDef : int, + vFluidBolusMin : int, + vFluidBolusMax : int, + vFluidBolusDef : int, + vArtPressLimitWindowMin : int, + vArtPressLimitWindowMax : int, + vArtPressLimitWindowDef : int, + vVenPressLimitWindowMin : int, + vVenPressLimitWindowMax : int, + vVenPressLimitWindowDef : int, + vVenAsymLimitWindowMin : int, + vVenAsymLimitWindowMax : int, + vVenAsymLimitWindowDef : int, + vTMPPressLimitWindowMin : int, + vTMPPressLimitWindowMax : int, + vTMPPressLimitWindowDef : int, + vUltrafiltrationVolumeMin : float, + vUltrafiltrationVolumeMax : float, + vUltrafiltrationVolumeDef : float, + vVitalsIntervalDef : int, + RinsebackVolumeMin : int, + RinsebackVolumeMax : int, + RinsebackVolumeDef : int, + RinsebackFlowRateMin : int, + RinsebackFlowRateMax : int, + RinsebackFlowRateDef : int, + vSubstitutionVolumeMin : float, + vSubstitutionVolumeMax : float, + vSubstitutionVolumeDef : float): + """ + the institutiuonal records 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) + payload += conversions.integer_to_bytearray(vBloodFlowMin) + payload += conversions.integer_to_bytearray(vBloodFlowMax) + payload += conversions.integer_to_bytearray(vBloodFlowDef) + payload += conversions.integer_to_bytearray(vDialysateFlowMin) + payload += conversions.integer_to_bytearray(vDialysateFlowMax) + payload += conversions.integer_to_bytearray(vDialysateFlowDef) + payload += conversions.integer_to_bytearray(vTxDurationMin) + payload += conversions.integer_to_bytearray(vTxDurationMax) + payload += conversions.integer_to_bytearray(vTxDurationDef) + payload += conversions.float_to_bytearray(vHepBolVolumeMin) + payload += conversions.float_to_bytearray(vHepBolVolumeMax) + payload += conversions.float_to_bytearray(vHepBolVolumeDef) + payload += conversions.float_to_bytearray(vHepDispRateMin) + payload += conversions.float_to_bytearray(vHepDispRateMax) + payload += conversions.float_to_bytearray(vHepDispRateDef) + payload += conversions.integer_to_bytearray(vHepStopTimeMin) + payload += conversions.integer_to_bytearray(vHepStopTimeMax) + payload += conversions.float_to_bytearray(vDialysateTempMin) + payload += conversions.float_to_bytearray(vDialysateTempMax) + payload += conversions.float_to_bytearray(vDialysateTempDef) + payload += conversions.float_to_bytearray(vPotassiumMin) + payload += conversions.float_to_bytearray(vPotassiumMax) + payload += conversions.float_to_bytearray(vCalciumMin) + payload += conversions.float_to_bytearray(vCalciumMax) + payload += conversions.integer_to_bytearray(DialysateBicarbMin) + payload += conversions.integer_to_bytearray(DialysateBicarbMax) + payload += conversions.integer_to_bytearray(DialysateBicarbDef) + payload += conversions.integer_to_bytearray(SodiumBicarbMin) + payload += conversions.integer_to_bytearray(SodiumBicarbMax) + payload += conversions.integer_to_bytearray(SodiumBicarbDef) + payload += conversions.integer_to_bytearray(vFluidBolusMin) + payload += conversions.integer_to_bytearray(vFluidBolusMax) + payload += conversions.integer_to_bytearray(vFluidBolusDef) + payload += conversions.integer_to_bytearray(vArtPressLimitWindowMin) + payload += conversions.integer_to_bytearray(vArtPressLimitWindowMax) + payload += conversions.integer_to_bytearray(vArtPressLimitWindowDef) + payload += conversions.integer_to_bytearray(vVenPressLimitWindowMin) + payload += conversions.integer_to_bytearray(vVenPressLimitWindowMax) + payload += conversions.integer_to_bytearray(vVenPressLimitWindowDef) + payload += conversions.integer_to_bytearray(vVenAsymLimitWindowMin) + payload += conversions.integer_to_bytearray(vVenAsymLimitWindowMax) + payload += conversions.integer_to_bytearray(vVenAsymLimitWindowDef) + payload += conversions.integer_to_bytearray(vTMPPressLimitWindowMin) + payload += conversions.integer_to_bytearray(vTMPPressLimitWindowMax) + payload += conversions.integer_to_bytearray(vTMPPressLimitWindowDef) + payload += conversions.float_to_bytearray(vUltrafiltrationVolumeMin) + payload += conversions.float_to_bytearray(vUltrafiltrationVolumeMax) + payload += conversions.float_to_bytearray(vUltrafiltrationVolumeDef) + payload += conversions.integer_to_bytearray(vVitalsIntervalDef) + payload += conversions.integer_to_bytearray(RinsebackVolumeMin) + payload += conversions.integer_to_bytearray(RinsebackVolumeMax) + payload += conversions.integer_to_bytearray(RinsebackVolumeDef) + payload += conversions.integer_to_bytearray(RinsebackFlowRateMin) + payload += conversions.integer_to_bytearray(RinsebackFlowRateMax) + payload += conversions.integer_to_bytearray(RinsebackFlowRateDef) + payload += conversions.float_to_bytearray(vSubstitutionVolumeMin) + payload += conversions.float_to_bytearray(vSubstitutionVolumeMax) + payload += conversions.float_to_bytearray(vSubstitutionVolumeDef) + + message = CAN.DenaliMessage.build_message( + channel_id=CAN.DenaliChannels.td_to_ui_ch_id, + message_id=msg_ids.MsgIds.MSG_ID_TD_INSTITUTIONAL_RECORD_RESPONSE.value, + payload=payload) + self.can_interface.send(message, 0) + + def td_Adjust_Institutional_Records ( self, vAccepted : int = 1, + vBloodFlowMinReason : int = 0, + vBloodFlowMaxReason : int = 0, + vBloodFlowDefReason : int = 0, + vDialysateFlowMinReason : int = 0, + vDialysateFlowMaxReason : int = 0, + vDialysateFlowDefReason : int = 0, + vTreatmentDurationMinReason : int = 0, + vTreatmentDurationMaxReason : int = 0, + vTreatmentDurationDefReason : int = 0, + vHepBolusVolumeMinReason : int = 0, + vHepBolusVolumeMaxReason : int = 0, + vHepBolusVolumeDefReason : int = 0, + vHepDispRateMinReason : int = 0, + vHepDispRateMaxReason : int = 0, + vHepDispRateDefReason : int = 0, + vHepStopTimeMinReason : int = 0, + vHepStopTimeMaxReason : int = 0, + vDialysateTempMinReason : int = 0, + vDialysateTempMaxReason : int = 0, + vDialysateTempDefReason : int = 0, + vPotassiumMinReason : int = 0, + vPotassiumMaxReason : int = 0, + vCalciumMinReason : int = 0, + vCalciumMaxReason : int = 0, + vDialysateBicarbMinReason : int = 0, + vDialysateBicarbMaxReason : int = 0, + vDialysateBicarbDefReason : int = 0, + vSodiumBicarbMinReason : int = 0, + vSodiumBicarbMaxReason : int = 0, + vSodiumBicarbDefReason : int = 0, + vFluidBolusVolumeMinReason : int = 0, + vFluidBolusVolumeMaxReason : int = 0, + vFluidBolusVolumeDefReason : int = 0, + vArterialPressureMinReason : int = 0, + vArterialPressureMaxReason : int = 0, + vArterialPressureDefReason : int = 0, + vVenousPressureMinReason : int = 0, + vVenousPressureMaxReason : int = 0, + vVenousPressureDefReason : int = 0, + vVenousAsymmetricMinReason : int = 0, + vVenousAsymmetricMaxReason : int = 0, + vVenousAsymmetricDefReason : int = 0, + vTmpPressureMinReason : int = 0, + vTmpPressureMaxReason : int = 0, + vTmpPressureDefReason : int = 0, + vUfVolumeMinReason : int = 0, + vUfVolumeMaxReason : int = 0, + vUfVolumeDefReason : int = 0, + vVitalsIntervalReason : int = 0, + vRincebackVolumeMinReason : int = 0, + vRincebackVolumeMaxReason : int = 0, + vRincebackVolumeDefReason : int = 0, + vRincebackFlowRateMinReason : int = 0, + vRincebackFlowRateMaxReason : int = 0, + vRincebackFlowRateDefReason : int = 0, + vSubVolumeMinReason : int = 0, + vSubVolumeMaxReason : int = 0, + vSubVolumeDefReason : int = 0 + ): + """TD Treatment Parameter Validation Response to the SW validation request with sent values of the same parameters.(Msg ID: 0x40, 64) + Args: + vAccepted (int, optional): Zero value if rejected. Defaults to 1. + vBloodFlowMinReason (int, optional): None zero value of rejection reason. Defaults to 0. + vBloodFlowMaxReason (int, optional): None zero value of rejection reason. Defaults to 0. + vBloodFlowDefReason (int, optional): None zero value of rejection reason. Defaults to 0. + vDialysateFlowMinReason (int, optional): None zero value of rejection reason. Defaults to 0. + vDialysateFlowMaxReason (int, optional): None zero value of rejection reason. Defaults to 0. + vDialysateFlowDefReason (int, optional): None zero value of rejection reason. Defaults to 0. + vTreatmentDurationMinReason (int, optional): None zero value of rejection reason. Defaults to 0. + vTreatmentDurationMaxReason (int, optional): None zero value of rejection reason. Defaults to 0. + vTreatmentDurationDefReason (int, optional): None zero value of rejection reason. Defaults to 0. + vHepBolusVolumeMinReason (int, optional): None zero value of rejection reason. Defaults to 0. + vHepBolusVolumeMaxReason (int, optional): None zero value of rejection reason. Defaults to 0. + vHepBolusVolumeDefReason (int, optional): None zero value of rejection reason. Defaults to 0. + vHepDispRateMinReason (int, optional): None zero value of rejection reason. Defaults to 0. + vHepDispRateMaxReason (int, optional): None zero value of rejection reason. Defaults to 0. + vHepDispRateDefReason (int, optional): None zero value of rejection reason. Defaults to 0. + vHepStopTimeMinReason (int, optional): None zero value of rejection reason. Defaults to 0. + vHepStopTimeMaxReason (int, optional): None zero value of rejection reason. Defaults to 0. + vDialysateTempMinReason (int, optional): None zero value of rejection reason. Defaults to 0. + vDialysateTempMaxReason (int, optional): None zero value of rejection reason. Defaults to 0. + vDialysateTempDefReason (int, optional): None zero value of rejection reason. Defaults to 0. + vPotassiumMinReason (int, optional): None zero value of rejection reason. Defaults to 0. + vPotassiumMaxReason (int, optional): None zero value of rejection reason. Defaults to 0. + vCalciumMinReason (int, optional): None zero value of rejection reason. Defaults to 0. + vCalciumMaxReason (int, optional): None zero value of rejection reason. Defaults to 0. + vDialysateBicarbMinReason (int, optional): None zero value of rejection reason. Defaults to 0. + vDialysateBicarbMaxReason (int, optional): None zero value of rejection reason. Defaults to 0. + vDialysateBicarbDefReason (int, optional): None zero value of rejection reason. Defaults to 0. + vSodiumBicarbMinReason (int, optional): None zero value of rejection reason. Defaults to 0. + vSodiumBicarbMaxReason (int, optional): None zero value of rejection reason. Defaults to 0. + vSodiumBicarbDefReason (int, optional): None zero value of rejection reason. Defaults to 0. + vFluidBolusVolumeMinReason (int, optional): None zero value of rejection reason. Defaults to 0. + vFluidBolusVolumeMaxReason (int, optional): None zero value of rejection reason. Defaults to 0. + vFluidBolusVolumeDefReason (int, optional): None zero value of rejection reason. Defaults to 0. + vArterialPressureMinReason (int, optional): None zero value of rejection reason. Defaults to 0. + vArterialPressureMaxReason (int, optional): None zero value of rejection reason. Defaults to 0. + vArterialPressureDefReason (int, optional): None zero value of rejection reason. Defaults to 0. + vVenousPressureMinReason (int, optional): None zero value of rejection reason. Defaults to 0. + vVenousPressureMaxReason (int, optional): None zero value of rejection reason. Defaults to 0. + vVenousPressureDefReason (int, optional): None zero value of rejection reason. Defaults to 0. + vVenousAsymmetricMinReason (int, optional): None zero value of rejection reason. Defaults to 0. + vVenousAsymmetricMaxReason (int, optional): None zero value of rejection reason. Defaults to 0. + vVenousAsymmetricDefReason (int, optional): None zero value of rejection reason. Defaults to 0. + vTmpPressureMinReason (int, optional): None zero value of rejection reason. Defaults to 0. + vTmpPressureMaxReason (int, optional): None zero value of rejection reason. Defaults to 0. + vTmpPressureDefReason (int, optional): None zero value of rejection reason. Defaults to 0. + vUfVolumeMinReason (int, optional): None zero value of rejection reason. Defaults to 0. + vUfVolumeMaxReason (int, optional): None zero value of rejection reason. Defaults to 0. + vUfVolumeDefReason (int, optional): None zero value of rejection reason. Defaults to 0. + vVitalsIntervalReason (int, optional): None zero value of rejection reason. Defaults to 0. + vRincebackVolumeMinReason (int, optional): None zero value of rejection reason. Defaults to 0. + vRincebackVolumeMaxReason (int, optional): None zero value of rejection reason. Defaults to 0. + vRincebackVolumeDefReason (int, optional): None zero value of rejection reason. Defaults to 0. + vRincebackFlowRateMinReason (int, optional): None zero value of rejection reason. Defaults to 0. + vRincebackFlowRateMaxReason (int, optional): None zero value of rejection reason. Defaults to 0. + 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. + """ + payload = conversions.integer_to_bytearray(vAccepted ) + payload += conversions.integer_to_bytearray(vBloodFlowMinReason ) + payload += conversions.integer_to_bytearray(vBloodFlowMaxReason ) + payload += conversions.integer_to_bytearray(vBloodFlowDefReason ) + payload += conversions.integer_to_bytearray(vDialysateFlowMinReason ) + payload += conversions.integer_to_bytearray(vDialysateFlowMaxReason ) + payload += conversions.integer_to_bytearray(vDialysateFlowDefReason ) + payload += conversions.integer_to_bytearray(vTreatmentDurationMinReason ) + payload += conversions.integer_to_bytearray(vTreatmentDurationMaxReason ) + payload += conversions.integer_to_bytearray(vTreatmentDurationDefReason ) + payload += conversions.integer_to_bytearray(vHepBolusVolumeMinReason ) + payload += conversions.integer_to_bytearray(vHepBolusVolumeMaxReason ) + payload += conversions.integer_to_bytearray(vHepBolusVolumeDefReason ) + payload += conversions.integer_to_bytearray(vHepDispRateMinReason ) + payload += conversions.integer_to_bytearray(vHepDispRateMaxReason ) + payload += conversions.integer_to_bytearray(vHepDispRateDefReason ) + payload += conversions.integer_to_bytearray(vHepStopTimeMinReason ) + payload += conversions.integer_to_bytearray(vHepStopTimeMaxReason ) + payload += conversions.integer_to_bytearray(vDialysateTempMinReason ) + payload += conversions.integer_to_bytearray(vDialysateTempMaxReason ) + payload += conversions.integer_to_bytearray(vDialysateTempDefReason ) + payload += conversions.integer_to_bytearray(vPotassiumMinReason ) + payload += conversions.integer_to_bytearray(vPotassiumMaxReason ) + payload += conversions.integer_to_bytearray(vCalciumMinReason ) + payload += conversions.integer_to_bytearray(vCalciumMaxReason ) + payload += conversions.integer_to_bytearray(vDialysateBicarbMinReason ) + payload += conversions.integer_to_bytearray(vDialysateBicarbMaxReason ) + payload += conversions.integer_to_bytearray(vDialysateBicarbDefReason ) + payload += conversions.integer_to_bytearray(vSodiumBicarbMinReason ) + payload += conversions.integer_to_bytearray(vSodiumBicarbMaxReason ) + payload += conversions.integer_to_bytearray(vSodiumBicarbDefReason ) + payload += conversions.integer_to_bytearray(vFluidBolusVolumeMinReason ) + payload += conversions.integer_to_bytearray(vFluidBolusVolumeMaxReason ) + payload += conversions.integer_to_bytearray(vFluidBolusVolumeDefReason ) + payload += conversions.integer_to_bytearray(vArterialPressureMinReason ) + payload += conversions.integer_to_bytearray(vArterialPressureMaxReason ) + payload += conversions.integer_to_bytearray(vArterialPressureDefReason ) + payload += conversions.integer_to_bytearray(vVenousPressureMinReason ) + payload += conversions.integer_to_bytearray(vVenousPressureMaxReason ) + payload += conversions.integer_to_bytearray(vVenousPressureDefReason ) + payload += conversions.integer_to_bytearray(vVenousAsymmetricMinReason ) + payload += conversions.integer_to_bytearray(vVenousAsymmetricMaxReason ) + payload += conversions.integer_to_bytearray(vVenousAsymmetricDefReason ) + payload += conversions.integer_to_bytearray(vTmpPressureMinReason ) + payload += conversions.integer_to_bytearray(vTmpPressureMaxReason ) + payload += conversions.integer_to_bytearray(vTmpPressureDefReason ) + payload += conversions.integer_to_bytearray(vUfVolumeMinReason ) + payload += conversions.integer_to_bytearray(vUfVolumeMaxReason ) + payload += conversions.integer_to_bytearray(vUfVolumeDefReason ) + payload += conversions.integer_to_bytearray(vVitalsIntervalReason ) + payload += conversions.integer_to_bytearray(vRincebackVolumeMinReason ) + payload += conversions.integer_to_bytearray(vRincebackVolumeMaxReason ) + payload += conversions.integer_to_bytearray(vRincebackVolumeDefReason ) + payload += conversions.integer_to_bytearray(vRincebackFlowRateMinReason ) + payload += conversions.integer_to_bytearray(vRincebackFlowRateMaxReason ) + payload += conversions.integer_to_bytearray(vRincebackFlowRateDefReason ) + payload += conversions.integer_to_bytearray(vSubVolumeMinReason ) + payload += conversions.integer_to_bytearray(vSubVolumeMaxReason ) + payload += conversions.integer_to_bytearray(vSubVolumeDefReason ) + message = CAN.DenaliMessage.build_message( + channel_id=CAN.DenaliChannels.td_to_ui_ch_id, + message_id=msg_ids.MsgIds.MSG_ID_TD_ADJUST_INSTITUTIONAL_RECORD_RESPONSE.value, + payload=payload) + self.can_interface.send(message, 0) + + def td_advanced_institutional_response(self, vRejectionReason : int, + vMinRORejectionRatioAlarmMin : int, + vMinRORejectionRatioAlarmMax : int, + vMinRORejectionRatioAlarmDef : int, + vDisinfectionFrequencyMin : int, + vDisinfectionFrequencyMax : int, + vDisinfectionFrequencyDef : int, + vDisinfectionParametersCycleTimeMin : int, + vDisinfectionParametersCycleTimeMax : int, + vDisinfectionParametersCycleTimeDef : int, + vMaxBloodPumpStopTimeMin : int, + vMaxBloodPumpStopTimeMax : int, + vMaxBloodPumpStopTimeDef : int, + vInletWaterCondLowThresholdMin : int, + vInletWaterCondLowThresholdMax : int, + vInletWaterCondLowThresholdDef : int, + vInletWaterCondHighThresholdMin : int, + vInletWaterCondHighThresholdMax : int, + vInletWaterCondHighThresholdDef : int, + vChlorineWaterSampleCheckMin : int, + vChlorineWaterSampleCheckMax : int, + vChlorineWaterSampleCheckDef : int, + vWaterSampleTestResultRequiredDef : int): + """ + the advanced institutiuonal records 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) + payload += conversions.integer_to_bytearray(vMinRORejectionRatioAlarmMin ) + payload += conversions.integer_to_bytearray(vMinRORejectionRatioAlarmMax ) + payload += conversions.integer_to_bytearray(vMinRORejectionRatioAlarmDef ) + payload += conversions.integer_to_bytearray(vDisinfectionFrequencyMin ) + payload += conversions.integer_to_bytearray(vDisinfectionFrequencyMax ) + payload += conversions.integer_to_bytearray(vDisinfectionFrequencyDef ) + payload += conversions.integer_to_bytearray(vDisinfectionParametersCycleTimeMin) + payload += conversions.integer_to_bytearray(vDisinfectionParametersCycleTimeMax) + payload += conversions.integer_to_bytearray(vDisinfectionParametersCycleTimeDef) + payload += conversions.integer_to_bytearray(vMaxBloodPumpStopTimeMin ) + payload += conversions.integer_to_bytearray(vMaxBloodPumpStopTimeMax ) + payload += conversions.integer_to_bytearray(vMaxBloodPumpStopTimeDef ) + payload += conversions.integer_to_bytearray(vInletWaterCondLowThresholdMin ) + payload += conversions.integer_to_bytearray(vInletWaterCondLowThresholdMax ) + payload += conversions.integer_to_bytearray(vInletWaterCondLowThresholdDef ) + payload += conversions.integer_to_bytearray(vInletWaterCondHighThresholdMin ) + payload += conversions.integer_to_bytearray(vInletWaterCondHighThresholdMax ) + payload += conversions.integer_to_bytearray(vInletWaterCondHighThresholdDef ) + payload += conversions.integer_to_bytearray(vChlorineWaterSampleCheckMin ) + payload += conversions.integer_to_bytearray(vChlorineWaterSampleCheckMax ) + payload += conversions.integer_to_bytearray(vChlorineWaterSampleCheckDef ) + payload += conversions.integer_to_bytearray(vWaterSampleTestResultRequiredDef ) + + + message = CAN.DenaliMessage.build_message( + channel_id=CAN.DenaliChannels.td_to_ui_ch_id, + message_id=msg_ids.MsgIds.MSG_ID_TD_ADVANCED_INSTITUTIONAL_RECORD_RESPONSE.value, + payload=payload) + self.can_interface.send(message, 0) + + def td_Adjust_Advanced_Institutional_Records ( self, vAccepted : int = 1, + vMinRORejectionRatioAlarmMaxRejectionReason : int = 0, + vMinRORejectionRatioAlarmMinRejectionReason : int = 0, + vMinRORejectionRatioAlarmDefRejectionReason : int = 0, + vDisinfectionFrequencyMinRejectionReason : int = 0, + vDisinfectionFrequencyMaxRejectionReason : int = 0, + vDisinfectionFrequencyDefRejectionReason : int = 0, + vDisinfectionParametersCycleTimeMinRejectionReason : int = 0, + vDisinfectionParametersCycleTimeMaxRejectionReason : int = 0, + vDisinfectionParametersCycleTimeDefRejectionReason : int = 0, + vMaxBloodPumpStopTimeMinRejectionReason : int = 0, + vMaxBloodPumpStopTimeMaxRejectionReason : int = 0, + vMaxBloodPumpStopTimeDefRejectionReason : int = 0, + vInletWaterCondLowThresholdMinRejectionReason : int = 0, + vInletWaterCondLowThresholdMaxRejectionReason : int = 0, + vInletWaterCondLowThresholdDefRejectionReason : int = 0, + vInletWaterCondHighThresholdMinRejectionReason : int = 0, + vInletWaterCondHighThresholdMaxRejectionReason : int = 0, + vInletWaterCondHighThresholdDefRejectionReason : int = 0, + vChlorineWaterSampleCheckMinRejectionReason : int = 0, + vChlorineWaterSampleCheckMaxRejectionReason : int = 0, + vChlorineWaterSampleCheckDefRejectionReason : int = 0, + vWaterSampleTestResultRequiredDefRejectionReason : int = 0): + """TD Treatment Parameter Validation Response to the SW validation request with sent values of the same parameters.(Msg ID: 0x40, 64) + Args: + vAccepted (int, optional): Zero value if rejected. Defaults to 1. + vMinRORejectionRatioAlarmMaxRejectionReason (int, optional): None zero value of rejection reason. Defaults to 0. + vMinRORejectionRatioAlarmMinRejectionReason (int, optional): None zero value of rejection reason. Defaults to 0. + vMinRORejectionRatioAlarmDefRejectionReason (int, optional): None zero value of rejection reason. Defaults to 0. + vDisinfectionFrequencyMinRejectionReason (int, optional): None zero value of rejection reason. Defaults to 0. + vDisinfectionFrequencyMaxRejectionReason (int, optional): None zero value of rejection reason. Defaults to 0. + vDisinfectionFrequencyDefRejectionReason (int, optional): None zero value of rejection reason. Defaults to 0. + vDisinfectionParametersCycleTimeMinRejectionReason (int, optional): None zero value of rejection reason. Defaults to 0. + vDisinfectionParametersCycleTimeMaxRejectionReason (int, optional): None zero value of rejection reason. Defaults to 0. + vDisinfectionParametersCycleTimeDefRejectionReason (int, optional): None zero value of rejection reason. Defaults to 0. + vMaxBloodPumpStopTimeMinRejectionReason (int, optional): None zero value of rejection reason. Defaults to 0. + vMaxBloodPumpStopTimeMaxRejectionReason (int, optional): None zero value of rejection reason. Defaults to 0. + vMaxBloodPumpStopTimeDefRejectionReason (int, optional): None zero value of rejection reason. Defaults to 0. + vInletWaterCondLowThresholdMinRejectionReason (int, optional): None zero value of rejection reason. Defaults to 0. + vInletWaterCondLowThresholdMaxRejectionReason (int, optional): None zero value of rejection reason. Defaults to 0. + vInletWaterCondLowThresholdDefRejectionReason (int, optional): None zero value of rejection reason. Defaults to 0. + vInletWaterCondHighThresholdMinRejectionReason (int, optional): None zero value of rejection reason. Defaults to 0. + vInletWaterCondHighThresholdMaxRejectionReason (int, optional): None zero value of rejection reason. Defaults to 0. + vInletWaterCondHighThresholdDefRejectionReason (int, optional): None zero value of rejection reason. Defaults to 0. + 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. + """ + payload = conversions.integer_to_bytearray(vAccepted ) + payload += conversions.integer_to_bytearray(vMinRORejectionRatioAlarmMaxRejectionReason ) + payload += conversions.integer_to_bytearray(vMinRORejectionRatioAlarmMinRejectionReason ) + payload += conversions.integer_to_bytearray(vMinRORejectionRatioAlarmDefRejectionReason ) + payload += conversions.integer_to_bytearray(vDisinfectionFrequencyMinRejectionReason ) + payload += conversions.integer_to_bytearray(vDisinfectionFrequencyMaxRejectionReason ) + payload += conversions.integer_to_bytearray(vDisinfectionFrequencyDefRejectionReason ) + payload += conversions.integer_to_bytearray(vDisinfectionParametersCycleTimeMinRejectionReason ) + payload += conversions.integer_to_bytearray(vDisinfectionParametersCycleTimeMaxRejectionReason ) + payload += conversions.integer_to_bytearray(vDisinfectionParametersCycleTimeDefRejectionReason ) + payload += conversions.integer_to_bytearray(vMaxBloodPumpStopTimeMinRejectionReason ) + payload += conversions.integer_to_bytearray(vMaxBloodPumpStopTimeMaxRejectionReason ) + payload += conversions.integer_to_bytearray(vMaxBloodPumpStopTimeDefRejectionReason ) + payload += conversions.integer_to_bytearray(vInletWaterCondLowThresholdMinRejectionReason ) + payload += conversions.integer_to_bytearray(vInletWaterCondLowThresholdMaxRejectionReason ) + payload += conversions.integer_to_bytearray(vInletWaterCondLowThresholdDefRejectionReason ) + payload += conversions.integer_to_bytearray(vInletWaterCondHighThresholdMinRejectionReason ) + payload += conversions.integer_to_bytearray(vInletWaterCondHighThresholdMaxRejectionReason ) + payload += conversions.integer_to_bytearray(vInletWaterCondHighThresholdDefRejectionReason ) + payload += conversions.integer_to_bytearray(vChlorineWaterSampleCheckMinRejectionReason ) + payload += conversions.integer_to_bytearray(vChlorineWaterSampleCheckMaxRejectionReason ) + payload += conversions.integer_to_bytearray(vChlorineWaterSampleCheckDefRejectionReason ) + payload += conversions.integer_to_bytearray(vWaterSampleTestResultRequiredDefRejectionReason ) + + message = CAN.DenaliMessage.build_message( + channel_id=CAN.DenaliChannels.td_to_ui_ch_id, + message_id=msg_ids.MsgIds.MSG_ID_TD_ADVANCED_ADJUST_INSTITUTIONAL_RECORD_RESPONSE.value, + payload=payload) + self.can_interface.send(message, 0) + + def td_duration_validate_response(self, vRejectionReason: int, vDuration: int, vUFVolumeGoal: float, vUFRate: float): + """ + the duration validate response message method(Msg ID: 0x84, 132) + Args: + @param vRejectionReason (int) : response rejection reason, + if rejection reason is 0, then accepted (0) will be sent, + otherwise rejected (1) + @param vDuration (int) : treatment duration (min) + @param vUFVolumeGoal (float) : UF volume goal (mL) + @param vUFRate (float) : UF rate (L/hr) + @return: None + """ + payload = conversions.integer_to_bytearray(1 if vRejectionReason == 0 else 0 ) + payload += conversions.integer_to_bytearray(vRejectionReason ) + payload += conversions.integer_to_bytearray(vDuration ) + payload += conversions.float_to_bytearray(vUFVolumeGoal ) + payload += conversions.float_to_bytearray(vUFRate ) + + message = CAN.DenaliMessage.build_message( + channel_id=CAN.DenaliChannels.td_to_ui_ch_id, + message_id=msg_ids.MsgIds.MSG_ID_TD_DURATION_VALIDATE_RESPONSE .value, + payload=payload) + 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) @@ -684,74 +1309,73 @@ def td_Treatment_Parameters_Validation( self, - vAccepted : int = 1, - vBloodFlowRateRejectReason : int = 0, - vDialysateFlowRateRejectReason : int = 0, - vTreatmentDurationRejectReason : int = 0, - vSalineBolusVolumeRejectReason : int = 0, - vHeparinStopTimeRejectReason : int = 0, - vHeparinTypeRejectReason : int = 0, - vAcidConcentrateRejectReason : int = 0, - vBicarbonateConcentrateRejectReason : int = 0, - vDialyzerTypeRejectReason : int = 0, - vBloodPressureMeasureIntervalRejectReason : int = 0, - vRinsebackFlowRateRejectReason : int = 0, - vRinsebackVolumeRejectReason : int = 0, - vArterialPressureLimitWindowRejectReason : int = 0, - vVenousPressureLimitWindowRejectReason : int = 0, - vVenousPressureLimitAsymtrcRejectReason : int = 0, - vTrancembrncPressureLimitWindowRejectReason : int = 0, - vDialysateTempRejectReason : int = 0, - vHeparinDispensingRateRejectReason : int = 0, - vHeparinBolusVolumeRejectReason : int = 0 + vAccepted : int = 1, + vBloodFlowRateRejectReason : int = 0, + vDialysateFlowRateRejectReason : int = 0, + vTreatmentDurationRejectReason : int = 0, + vSalineBolusVolumeRejectReason : int = 0, + vHeparinStopTimeRejectReason : int = 0, + vHeparinTypeRejectReason : int = 0, + vAcidConcentrateRejectReason : int = 0, + vBicarbonateConcentrateRejectReason : int = 0, + vDialyzerTypeRejectReason : int = 0, + vBloodPressureMeasureIntervalRejectReason : int = 0, + vRinsebackFlowRateRejectReason : int = 0, + vRinsebackVolumeRejectReason : int = 0, + vArterialPressureLimitWindowRejectReason : int = 0, + vVenousPressureLimitWindowRejectReason : int = 0, + vVenousPressureLimitAsymtrcRejectReason : int = 0, + vTransmembranePressureLimitWindowRejectReason : int = 0, + vDialysateTempRejectReason : int = 0, + vHeparinDispensingRateRejectReason : int = 0, + vHeparinBolusVolumeRejectReason : int = 0 ): """TD Treatment Parameter Validation Response to the SW validation request with sent values of the same parameters.(Msg ID: 0x40, 64) Args: - vAccepted (int, optional): Zero value if rejected. Defaults to 1. - vBloodFlowRateRejectReason (int, optional): None zero value of rejection reason. Defaults to 0. - vDialysateFlowRateRejectReason (int, optional): None zero value of rejection reason. Defaults to 0. - vTreatmentDurationRejectReason (int, optional): None zero value of rejection reason. Defaults to 0. - vSalineBolusVolumeRejectReason (int, optional): None zero value of rejection reason. Defaults to 0. - vHeparinStopTimeRejectReason (int, optional): None zero value of rejection reason. Defaults to 0. - vHeparinTypeRejectReason (int, optional): None zero value of rejection reason. Defaults to 0. - vAcidConcentrateRejectReason (int, optional): None zero value of rejection reason. Defaults to 0. - vBicarbonateConcentrateRejectReason (int, optional): None zero value of rejection reason. Defaults to 0. - vDialyzerTypeRejectReason (int, optional): None zero value of rejection reason. Defaults to 0. - vBloodPressureMeasureIntervalRejectReason (int, optional): None zero value of rejection reason. Defaults to 0. - vRinsebackFlowRateRejectReason (int, optional): None zero value of rejection reason. Defaults to 0. - vRinsebackVolumeRejectReason (int, optional): None zero value of rejection reason. Defaults to 0. - vArterialPressureLimitWindowRejectReason (int, optional): None zero value of rejection reason. Defaults to 0. - vVenousPressureLimitWindowRejectReason (int, optional): None zero value of rejection reason. Defaults to 0. - vVenousPressureLimitAsymtrcRejectReason (int, optional): None zero value of rejection reason. Defaults to 0. - vTrancembrncPressureLimitWindowRejectReason (int, optional): None zero value of rejection reason. Defaults to 0. - vDialysateTempRejectReason (int, optional): None zero value of rejection reason. Defaults to 0. - vHeparinDispensingRateRejectReason (int, optional): None zero value of rejection reason. Defaults to 0. - vHeparinBolusVolumeRejectReason (int, optional): None zero value of rejection reason. Defaults to 0. + vAccepted (int, optional): Zero value if rejected. Defaults to 1. + vBloodFlowRateRejectReason (int, optional): None zero value of rejection reason. Defaults to 0. + vDialysateFlowRateRejectReason (int, optional): None zero value of rejection reason. Defaults to 0. + vTreatmentDurationRejectReason (int, optional): None zero value of rejection reason. Defaults to 0. + vSalineBolusVolumeRejectReason (int, optional): None zero value of rejection reason. Defaults to 0. + vHeparinStopTimeRejectReason (int, optional): None zero value of rejection reason. Defaults to 0. + vHeparinTypeRejectReason (int, optional): None zero value of rejection reason. Defaults to 0. + vAcidConcentrateRejectReason (int, optional): None zero value of rejection reason. Defaults to 0. + vBicarbonateConcentrateRejectReason (int, optional): None zero value of rejection reason. Defaults to 0. + vDialyzerTypeRejectReason (int, optional): None zero value of rejection reason. Defaults to 0. + vBloodPressureMeasureIntervalRejectReason (int, optional): None zero value of rejection reason. Defaults to 0. + vRinsebackFlowRateRejectReason (int, optional): None zero value of rejection reason. Defaults to 0. + vRinsebackVolumeRejectReason (int, optional): None zero value of rejection reason. Defaults to 0. + vArterialPressureLimitWindowRejectReason (int, optional): None zero value of rejection reason. Defaults to 0. + vVenousPressureLimitWindowRejectReason (int, optional): None zero value of rejection reason. Defaults to 0. + vVenousPressureLimitAsymtrcRejectReason (int, optional): None zero value of rejection reason. Defaults to 0. + vTransmembranePressureLimitWindowRejectReason (int, optional): None zero value of rejection reason. Defaults to 0. + vDialysateTempRejectReason (int, optional): None zero value of rejection reason. Defaults to 0. + 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") - payload = conversions.integer_to_bytearray(vAccepted ) - payload += conversions.integer_to_bytearray(vBloodFlowRateRejectReason ) - payload += conversions.integer_to_bytearray(vDialysateFlowRateRejectReason ) - payload += conversions.integer_to_bytearray(vTreatmentDurationRejectReason ) - payload += conversions.integer_to_bytearray(vSalineBolusVolumeRejectReason ) - payload += conversions.integer_to_bytearray(vHeparinStopTimeRejectReason ) - payload += conversions.integer_to_bytearray(vHeparinTypeRejectReason ) - payload += conversions.integer_to_bytearray(vAcidConcentrateRejectReason ) - payload += conversions.integer_to_bytearray(vBicarbonateConcentrateRejectReason ) - payload += conversions.integer_to_bytearray(vDialyzerTypeRejectReason ) - payload += conversions.integer_to_bytearray(vBloodPressureMeasureIntervalRejectReason ) - payload += conversions.integer_to_bytearray(vRinsebackFlowRateRejectReason ) - payload += conversions.integer_to_bytearray(vRinsebackVolumeRejectReason ) - payload += conversions.integer_to_bytearray(vArterialPressureLimitWindowRejectReason ) - payload += conversions.integer_to_bytearray(vVenousPressureLimitWindowRejectReason ) - payload += conversions.integer_to_bytearray(vVenousPressureLimitAsymtrcRejectReason ) - payload += conversions.integer_to_bytearray(vTrancembrncPressureLimitWindowRejectReason ) - payload += conversions.integer_to_bytearray(vDialysateTempRejectReason ) - payload += conversions.integer_to_bytearray(vHeparinDispensingRateRejectReason ) - payload += conversions.integer_to_bytearray(vHeparinBolusVolumeRejectReason ) + payload = conversions.integer_to_bytearray(vAccepted ) + payload += conversions.integer_to_bytearray(vBloodFlowRateRejectReason ) + payload += conversions.integer_to_bytearray(vDialysateFlowRateRejectReason ) + payload += conversions.integer_to_bytearray(vTreatmentDurationRejectReason ) + payload += conversions.integer_to_bytearray(vSalineBolusVolumeRejectReason ) + payload += conversions.integer_to_bytearray(vHeparinStopTimeRejectReason ) + payload += conversions.integer_to_bytearray(vHeparinTypeRejectReason ) + payload += conversions.integer_to_bytearray(vAcidConcentrateRejectReason ) + payload += conversions.integer_to_bytearray(vBicarbonateConcentrateRejectReason ) + payload += conversions.integer_to_bytearray(vDialyzerTypeRejectReason ) + payload += conversions.integer_to_bytearray(vBloodPressureMeasureIntervalRejectReason ) + payload += conversions.integer_to_bytearray(vRinsebackFlowRateRejectReason ) + payload += conversions.integer_to_bytearray(vRinsebackVolumeRejectReason ) + payload += conversions.integer_to_bytearray(vArterialPressureLimitWindowRejectReason ) + payload += conversions.integer_to_bytearray(vVenousPressureLimitWindowRejectReason ) + payload += conversions.integer_to_bytearray(vVenousPressureLimitAsymtrcRejectReason ) + payload += conversions.integer_to_bytearray(vTransmembranePressureLimitWindowRejectReason ) + payload += conversions.integer_to_bytearray(vDialysateTempRejectReason ) + payload += conversions.integer_to_bytearray(vHeparinDispensingRateRejectReason ) + payload += conversions.integer_to_bytearray(vHeparinBolusVolumeRejectReason ) message = CAN.DenaliMessage.build_message( channel_id=CAN.DenaliChannels.td_to_ui_ch_id, @@ -803,7 +1427,48 @@ payload=payload) self.can_interface.send(message, 0) - + + + def td_treatment_log_alarm(self, alarm_id: int, parameter1: float, parameter2: float) -> None: + """ + send the treatment log data + @param alarm_id: (U32) alarm ID + @param parameter1: (F32) paramter 1 (it's not clear yet how many paramters with what type is required and this is only plceholder) + @param parameter2: (F32) paramter 2 (it's not clear yet how many paramters with what type is required and this is only plceholder) + @return: None + """ + payload = conversions.integer_to_bytearray(alarm_id) + payload += conversions.float_to_bytearray(parameter1) + payload += conversions.float_to_bytearray(parameter2) + + message = CAN.DenaliMessage.build_message( + channel_id=CAN.DenaliChannels.td_to_ui_ch_id, + message_id=msg_ids.MsgIds.MSG_ID_TD_TREATMENT_LOG_ALARM_EVENT.value, + payload=payload) + + self.can_interface.send(message, 0) + + + def td_treatment_log_event(self, event_id: int, old_value: float, new_value: float) -> None: + """ + send the treatment log data + @param event_id: (U32) alarm ID + @param old_value: (F32) the old value + @param new_value: (F32) the new value + @return: none + """ + payload = conversions.integer_to_bytearray(event_id) + payload += conversions.float_to_bytearray(old_value) + payload += conversions.float_to_bytearray(new_value) + + message = CAN.DenaliMessage.build_message( + channel_id=CAN.DenaliChannels.td_to_ui_ch_id, + message_id=msg_ids.MsgIds.MSG_ID_TD_TREATMENT_LOG_EVENT.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,