Index: dialin/common/msg_defs.py =================================================================== diff -u -r82e32ae00355b2245a2660569935de152a883799 -r467e3ca526575de128af35761d0e2e7850cf9289 --- dialin/common/msg_defs.py (.../msg_defs.py) (revision 82e32ae00355b2245a2660569935de152a883799) +++ dialin/common/msg_defs.py (.../msg_defs.py) (revision 467e3ca526575de128af35761d0e2e7850cf9289) @@ -78,14 +78,14 @@ MSG_ID_HD_START_TREATMENT_RESPONSE = 0x39 # HD response to user request to initiate a treatment MSG_ID_HD_VALVES_DATA = 0x3A # HD broadcast of valves data MSG_ID_UI_USER_CONFIRM_TREATMENT_PARAMS = 0x3B # UI user confirmation of treatment parameters - MSG_ID_UI_TREATMENT_END_REQUEST = 0x3C # UI user treatment end request - MSG_ID_HD_TREATMENT_END_RESPONSE = 0x3D # HD response to user request to end treatment + MSG_ID_UI_START_PRIME_REQUEST = 0x3C # UI user has requested to start priming + MSG_ID_HD_START_PRIME_RESPONSE = 0x3D # HD response to user request to start priming MSG_ID_HD_AIR_TRAP_DATA = 0x003E # HD broadcast of air trap data MSG_ID_ALARM_CONDITION_CLEARED = 0x3F # Broadcast that the alarm condition has been cleared MSG_ID_UI_ALARM_USER_ACTION = 0x40 # UI user has requested an alarm action MSG_ID_USER_UF_PAUSE_RESUME_RESPONSE = 0x41 # HD response to user request to pause or resume UF MSG_ID_DG_CONCENTRATE_PUMP_DATA = 0x42 # DG broadcast of concentrate pump data - MSG_ID_DG_PRIMING_STATUS_DATA = 0x43 # HD priming status during cartridge prime + MSG_ID_HD_PRIMING_STATUS_DATA = 0x43 # HD priming status during cartridge prime MSG_ID_DG_UV_REACTORS_DATA = 0x44 # DG broadcast UV reactors data MSG_ID_DG_THERMISTORS_DATA = 0x45 # DG broadcast thermistors data MSG_ID_UI_PRESSURE_LIMITS_CHANGE_REQUEST = 0x46 # UI request to change pressure limits @@ -99,13 +99,30 @@ MSG_ID_UI_SET_ALARM_AUDIO_VOLUME_LEVEL_CMD = 0x4E # UI command to set alarm audio volume level MSG_ID_UI_PRE_TREATMENT_UF_REQUEST = 0x4F # UI UF Initialization Request MSG_ID_HD_PRE_TREATMENT_UF_RESPONSE = 0x50 # HD response to user request to adjust the ultrafiltration in pre-treatment + MSG_ID_DG_COMMAND_RESPONSE = 0x51 # DG response to command from HD + MSG_ID_UI_RINSEBACK_CMD = 0x52 # UI rinseback request MSG_ID_HD_RINSEBACK_CMD_RESPONSE = 0x53 # HD rinseback request response + MSG_ID_UI_RECIRC_CMD = 0x54 # UI re-circ request MSG_ID_HD_RECIRC_CMD_RESPONSE = 0x55 # HD re-circ request response MSG_ID_HD_RINSEBACK_PROGRESS = 0x56 # HD broadcast of rinseback progress - MSG_ID_HD_RECIRCULATE_PROGRESS = 0x5A # HD broadcast of recirculate progress - MSG_ID_HD_BLOOD_PRIME_PROGRESS = 0x59 # HD broadcast of blood prime progress MSG_ID_UI_TX_END_CMD = 0x57 # UI end treatment sub-mode user request MSG_ID_HD_TX_END_CMD_RESPONSE = 0x58 # HD end treatment sub-mode user request response + MSG_ID_HD_BLOOD_PRIME_PROGRESS = 0x59 # HD broadcast of blood prime progress + MSG_ID_HD_RECIRC_PROGRESS = 0x5A # HD broadcast of treatment re-circulate progress + MSG_ID_DG_CHANGE_VALVE_SETTING_CMD = 0x5B # HD request to DG to change valve setting + MSG_ID_PRE_TREATMENT_STATE = 0x5C # HD broadcast of pre-treatment state + MSG_ID_UI_SAMPLE_WATER_CMD = 0x5D # UI sample water sub-mode user request + MSG_ID_HD_SAMPLE_WATER_CMD_RESPONSE = 0x5E # HD sample water sub-mode request response + MSG_ID_UI_SAMPLE_WATER_RESULT = 0x5F # UI sample water result message + MSG_ID_DG_FILTER_FLUSH_PROGRESS = 0x60 # DG broadcast of filter flush progress + MSG_ID_HD_NO_CART_SELF_TEST_PROGRESS = 0x61 # HD broadcast of no cartridge self-tests progress + MSG_ID_UI_INSTALLATION_CONFIRM = 0x62 # UI disposable installation user confirmation + MSG_ID_HD_DRY_SELF_TEST_PROGRESS = 0x63 # HD broadcast of dry self-tests progress + MSG_ID_UI_CONTINUE_TO_TREATMENT_REQUEST = 0x64 # UI user has requested to continue to treatment + MSG_ID_HD_CONTINUE_TO_TREATMENT_RESPONSE = 0x65 # HD response to user request to continue to treatment + MSG_ID_UI_PATIENT_CONNECTION_CONFIRM = 0x66 # UI user has confirmed patient connection completed + MSG_ID_HD_PATIENT_CONNECTION_CONFIRM_RESPONSE = 0x67 # HD response to user confirmation of patient connection + MSG_ID_UI_CONSUMABLE_INSTALL_CONFIRM = 0x68 # UI user has confirmed consumable install MSG_ID_UI_HD_SET_RTC_REQUEST = 0x6D # UI to DG Request to set RTC Request MSG_ID_HD_UI_SET_RTC_RESPONSE = 0x6E # DG to UI set RTC Response MSG_ID_UI_DG_SET_RTC_REQUEST = 0x6F # UI to HD request to set RTC Request @@ -127,7 +144,7 @@ MSG_ID_BLOOD_PUMP_MC_MEAS_SPEED_OVERRIDE = 0x800A # Blood pump motor controller speed override request MSG_ID_BLOOD_PUMP_MC_MEAS_CURR_OVERRIDE = 0x800B # Blood pump motor controller current override request MSG_ID_BLOOD_FLOW_SEND_INTERVAL_OVERRIDE = 0x800C # Blood flow broadcast interval override request - MSG_ID___AVAILABLE_1 = 0x800D # This msg ID is available for use + MSG_ID_TREATMENT_TIME_REMAINING_OVERRIDE = 0x800D # This msg ID is available for use MSG_ID_BLOOD_PUMP_MEAS_SPEED_OVERRIDE = 0x800E # Blood pump measured motor speed override request MSG_ID_BLOOD_PUMP_MEAS_ROTOR_SPEED_OVERRIDE = 0x800F # Blood pump measured rotor speed override request MSG_ID_DIAL_IN_FLOW_SET_PT_OVERRIDE = 0x8010 # Dialysate inlet flow set point override request @@ -175,6 +192,16 @@ MSG_ID_SUPER_CLEAR_ALARMS_CMD = 0x803A # Clears all alarms (even if non-recoverable or fault) MSG_ID_HD_REQUEST_CALIBRATION_DATA = 0x803B # Requests calibration data from HD MSG_ID_HD_ERASE_CALIBRATION_DATA = 0x803C # Requests calibration data on HD be erased + MSG_ID_HD_SET_CALIBRATION_RECORD = 0x803D # HD set calibration record that is received from Dialin + MSG_ID_HD_GET_CALIBRATION_RECORD = 0x803E # HD get calibration record that is requested from Dialin + MSG_ID_HD_SEND_CALIBRATION_RECORD = 0x803F # HD send calibration record to CAN bus to be received in Dialin (equivalent to publish) + MSG_ID_HD_SET_SYSTEM_RECORD = 0x8040 # HD set system record that is received from Dialin + MSG_ID_HD_GET_SYSTEM_RECORD = 0x8041 # HD get system record that is requested from Dialin + MSG_ID_HD_SEND_SYSTEM_RECORD = 0x8042 # HD send system record to CAN bus to be received in Dialin (equivalent to publish) + MSG_ID_HD_GET_SERVICE_RECORD = 0x8043 # HD get service record that is requested from Dialin + MSG_ID_HD_SET_SERVICE_RECORD = 0x8044 # HD set service record that is received from Dialin + MSG_ID_HD_SEND_SERVICE_RECORD = 0x8045 # HD send service record to CAN bus to be received in Dialin (equivalent to publish) + MSG_ID_HD_SET_OP_MODE_REQUEST = 0x8046 # HD set operation mode request MSG_ID_DG_TESTER_LOGIN_REQUEST = 0XA000 # DG tester log-in MSG_ID_DG_ALARM_STATE_OVERRIDE = 0xA001 # DG alarm state override message ID Index: dialin/ui/hd_simulator.py =================================================================== diff -u -r82e32ae00355b2245a2660569935de152a883799 -r467e3ca526575de128af35761d0e2e7850cf9289 --- dialin/ui/hd_simulator.py (.../hd_simulator.py) (revision 82e32ae00355b2245a2660569935de152a883799) +++ dialin/ui/hd_simulator.py (.../hd_simulator.py) (revision 467e3ca526575de128af35761d0e2e7850cf9289) @@ -22,7 +22,7 @@ from . import utils, messageBuilder from .hd_simulator_alarms import HDAlarmsSimulator -from ..common.msg_defs import RequestRejectReasons, MsgIds +from ..common.msg_defs import RequestRejectReasons, MsgIds, MsgFieldPositions from ..common.hd_defs import HDDefs from ..protocols.CAN import (DenaliMessage, DenaliCanMessenger, @@ -230,7 +230,7 @@ MsgIds.MSG_ID_UI_USER_CONFIRM_TREATMENT_PARAMS.value, self._handler_ui_confirm_treatment) self.can_interface.register_receiving_publication_function(channel_id, - MsgIds.MSG_ID_UI_TREATMENT_END_REQUEST.value, + MsgIds.MSG_ID_UI_TX_END_CMD.value, self._handler_ui_end_treatment) self.can_interface.register_receiving_publication_function(channel_id, MsgIds.MSG_ID_UI_HD_SET_RTC_REQUEST.value, @@ -542,15 +542,6 @@ self.can_interface.send(message, 0) - def _handler_ui_end_treatment(self, message): - """ - - @param message: - @return: - """ - self.logger.debug("Ending Treatment") - self.cmd_send_end_treatment_response() - def _handler_ui_validate_parameters(self, message): """ @@ -1728,6 +1719,24 @@ self.can_interface.send(message, 0) + def _handler_ui_end_treatment(self, message): + """ + Handler function when received a request to end a treatment + + @param message: (dict) the end treatment request + @return: None + """ + self.logger.debug("End treatment requested") + request = struct.unpack('i', bytearray( + message['message'][MsgFieldPositions.START_POS_FIELD_1:MsgFieldPositions.END_POS_FIELD_1]))[0] + + if request == 0: + self.logger.debug("Request to start rinseback") + self.cmd_send_treatment_adjust_end_response(vAccepted=YES, vReason=0) + else: + self.logger.debug("End treatment unknown request") + + def cmd_send_treatment_adjust_end_response(self, vAccepted, vReason): """ the treatment end state change Response message method