Index: dialin/dg/dialysate_generator.py =================================================================== diff -u -r26c7b6057f11680681e0a25399b5e5be9b92818d -rb1aca30a8e2ee9650899faba059f0e484df50809 --- dialin/dg/dialysate_generator.py (.../dialysate_generator.py) (revision 26c7b6057f11680681e0a25399b5e5be9b92818d) +++ dialin/dg/dialysate_generator.py (.../dialysate_generator.py) (revision b1aca30a8e2ee9650899faba059f0e484df50809) @@ -554,12 +554,22 @@ self.logger.debug("Timeout!!!!") return False - def _send_dg_checkin_message(self) -> None: + def _send_dg_checkin_message(self) -> int: """ Constructs and sends an DG Dialin check in message to the DG. @return: none """ message = DenaliMessage.build_message(channel_id=DenaliChannels.dialin_to_dg_ch_id, message_id=MsgIds.MSG_ID_DG_DIALIN_CHECK_IN.value) - self.can_interface.send(message) \ No newline at end of file + received_message = self.can_interface.send(message) + + # If there is content... + if received_message is not None: + self.logger.debug("HD Check-in interval ACK'd" + + str(received_message['message'][DenaliMessage.PAYLOAD_START_INDEX])) + # response payload is OK or not OK + return received_message['message'][DenaliMessage.PAYLOAD_START_INDEX] + else: + self.logger.debug("Timeout!!!!") + return False \ No newline at end of file Index: dialin/hd/dialysate_outlet_flow.py =================================================================== diff -u -ra3a5b61a1c59fa44ec4c826a4c62b7a22ba2eee0 -rb1aca30a8e2ee9650899faba059f0e484df50809 --- dialin/hd/dialysate_outlet_flow.py (.../dialysate_outlet_flow.py) (revision a3a5b61a1c59fa44ec4c826a4c62b7a22ba2eee0) +++ dialin/hd/dialysate_outlet_flow.py (.../dialysate_outlet_flow.py) (revision b1aca30a8e2ee9650899faba059f0e484df50809) @@ -51,9 +51,13 @@ 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 + self.dialysate_outlet_pump_corr_offset = 0.0 + self.dialysate_outlet_pump_calc_rate = 0.0 + self.uf_calculated_rate = 0.0 self.rotor_hall_state = 0 + self.hd_dial_outlet_flow_timestamp = 0.0 + def get_reference_dialysate_outlet_uf_volume(self): """ Gets the reference dialysate outlet uf volume @@ -124,6 +128,9 @@ "measured_dialysate_outlet_pump_speed", "measured_dialysate_outlet_pump_mc_speed", "measured_dialysate_outlet_pump_mc_current", + "dialysate_outlet_pump_corr_offset", + "dialysate_outlet_pump_calc_rate", + "uf_calculated_rate" "pwm_duty_cycle_pct", "rotor_hall_state" ]) @@ -150,8 +157,14 @@ message['message'][MsgFieldPositions.START_POS_FIELD_6:MsgFieldPositions.END_POS_FIELD_6])) pwm = struct.unpack('f', bytearray( message['message'][MsgFieldPositions.START_POS_FIELD_7:MsgFieldPositions.END_POS_FIELD_7])) - hal = struct.unpack('I', bytearray( + dopcoffset = struct.unpack('f', bytearray( + message['message'][MsgFieldPositions.START_POS_FIELD_7:MsgFieldPositions.END_POS_FIELD_7])) + dopcrate = struct.unpack('f', bytearray( message['message'][MsgFieldPositions.START_POS_FIELD_8:MsgFieldPositions.END_POS_FIELD_8])) + ufcrate = struct.unpack('f', bytearray( + message['message'][MsgFieldPositions.START_POS_FIELD_9:MsgFieldPositions.END_POS_FIELD_9])) + hal = struct.unpack('I', bytearray( + message['message'][MsgFieldPositions.START_POS_FIELD_10:MsgFieldPositions.END_POS_FIELD_10])) self.reference_dialysate_outlet_uf_volume = refvol[0] self.measured_dialysate_outlet_uf_volume = measvol[0] @@ -160,6 +173,9 @@ 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.dialysate_outlet_pump_corr_offset = dopcoffset[0] + self.dialysate_outlet_pump_calc_rate = dopcrate[0] + self.uf_calculated_rate = ufcrate[0] self.rotor_hall_state = hal[0] self.hd_dial_outlet_flow_timestamp = timestamp Index: dialin/hd/hemodialysis_device.py =================================================================== diff -u -r0188c0a21079a4c92efca69e298beeccb93ed22c -rb1aca30a8e2ee9650899faba059f0e484df50809 --- dialin/hd/hemodialysis_device.py (.../hemodialysis_device.py) (revision 0188c0a21079a4c92efca69e298beeccb93ed22c) +++ dialin/hd/hemodialysis_device.py (.../hemodialysis_device.py) (revision b1aca30a8e2ee9650899faba059f0e484df50809) @@ -739,13 +739,22 @@ self.logger.debug("Sending an UI version request to the HD.") self.can_interface.send(message, 0) - - def _send_hd_checkin_message(self) -> None: + def _send_hd_checkin_message(self) -> int: """ Constructs and sends an HD Dialin check in message to the HD. @return: none """ message = DenaliMessage.build_message(channel_id=DenaliChannels.dialin_to_hd_ch_id, message_id=MsgIds.MSG_ID_HD_DIALIN_CHECK_IN.value) - self.can_interface.send(message) + received_message = self.can_interface.send(message) + + # If there is content... + if received_message is not None: + self.logger.debug("HD Check-in interval ACK'd" + + str(received_message['message'][DenaliMessage.PAYLOAD_START_INDEX])) + # response payload is OK or not OK + return received_message['message'][DenaliMessage.PAYLOAD_START_INDEX] + else: + self.logger.debug("Timeout!!!!") + return False Index: dialin/hd/ui_proxy.py =================================================================== diff -u -r535bf5f030deddfd0d99edce1d8d011b7797e1e2 -rb1aca30a8e2ee9650899faba059f0e484df50809 --- dialin/hd/ui_proxy.py (.../ui_proxy.py) (revision 535bf5f030deddfd0d99edce1d8d011b7797e1e2) +++ dialin/hd/ui_proxy.py (.../ui_proxy.py) (revision b1aca30a8e2ee9650899faba059f0e484df50809) @@ -159,8 +159,11 @@ self._handler_disinfects_data_publish) self.can_interface.register_receiving_publication_function(DenaliChannels.hd_to_ui_ch_id, MsgIds.MSG_ID_HD_ACTIVE_ALARMS_LIST_REQUEST_RESPONSE.value, - self.handler_active_alarm_list_response) + self._handler_active_alarm_list_response) + self.can_interface.register_receiving_publication_function(DenaliChannels.dg_to_ui_ch_id, + MsgIds.MSG_ID_DG_RO_ONLY_MODE_STATUS_RESPONSE.value, + self._handler_ro_mode_status) self.hd_uf_settings_change_res_timestamp = 0.0 self.hd_uf_settings_change_confirm_res_timestamp = 0.0 @@ -177,6 +180,7 @@ self.hd_tx_end_cmd_res_timestamp = 0.0 self.hd_disinfection_standby_timestamp = 0.0 self.hd_active_alarm_list_timestamp = 0.0 + self.ro_mode_timestamp = 0 # initialize variables that will be populated by HD version response self.hd_version = None self.fpga_version = None @@ -229,6 +233,7 @@ self.active_alarm_list_succeeded = False self.active_alarm_list_reject_reason = 0 self.alarm_list_response = () + self.ro_mode_status = 0 self.reject_reasons = OrderedDict() for attr in RequestRejectReasons: @@ -1053,7 +1058,7 @@ "active_alarm_list_reject_reason", "alarm_list_response", ]) - def handler_active_alarm_list_response(self, message: dict, timestamp=0.0) -> None: + def _handler_active_alarm_list_response(self, message: dict, timestamp=0.0) -> None: rsp = struct.unpack('i', bytearray( message['message'][MsgFieldPositions.START_POS_FIELD_1:MsgFieldPositions.END_POS_FIELD_1]))[0] rea = struct.unpack('i', bytearray( @@ -1102,6 +1107,15 @@ self.disinfects_dg_mode = dg_submode self.hd_disinfection_standby_timestamp = timestamp + @publish(["ro_mode_timestamp", "ro_mode_status"]) + def _handler_ro_mode_status(self, message: dict, timestamp=0.0) -> None: + + romode = struct.unpack('i', bytearray( + message['message'][MsgFieldPositions.START_POS_FIELD_1:MsgFieldPositions.END_POS_FIELD_1]))[0] + + self.ro_mode_status = romode[0] + self.ro_mode_timestamp = timestamp + def cmd_ui_checkin_with_hd(self) -> None: """ Constructs and sends the ui check-in message @@ -1848,4 +1862,29 @@ return received_message['message'][DenaliMessage.PAYLOAD_START_INDEX] else: self.logger.debug("Timeout!!!!") + return False + + def cmd_get_ro_only_mode_status(self) -> int: + """ + Constructs and sends a message to DG to set the status of the RO only mode: + 1 = Enable RO only mode + 0 = Disable RO only mode and be normal mode + + @param status: (int) RO only mode status (1=enable, 0=disable) + @return: 1 if successful, zero otherwise + """ + + message = DenaliMessage.build_message(channel_id=DenaliChannels.dialin_to_dg_ch_id, + message_id=MsgIds.MSG_ID_DG_RO_ONLY_MODE_STATUS_REQUEST.value) + + self.logger.debug("Requesting RO only mode") + + received_message = self.can_interface.send(message) + + # If there is content... + if received_message is not None: + # response payload is OK or not OK + return received_message['message'][DenaliMessage.PAYLOAD_START_INDEX] + else: + self.logger.debug("Timeout!!!!") return False \ No newline at end of file