Index: dialin/common/msg_defs.py =================================================================== diff -u -rdf4353089f674167fa92bebb1447d2278b9b30d9 -r3a5030c08d57bddc2c22dca05d1070375e3cb5f7 --- dialin/common/msg_defs.py (.../msg_defs.py) (revision df4353089f674167fa92bebb1447d2278b9b30d9) +++ dialin/common/msg_defs.py (.../msg_defs.py) (revision 3a5030c08d57bddc2c22dca05d1070375e3cb5f7) @@ -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,34 @@ 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 + MSG_ID_DG_UI_SET_RTC_RESPONSE = 0x70 # HD to UI Set RTC Response MSG_ID_CAN_ERROR_COUNT = 0x999 # test code in support of EMC testing @@ -123,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 @@ -174,12 +195,15 @@ MSG_ID_HD_SET_CALIBRATION_RECORD = 0x803D # HD set calibration_record record that is received from Dialin MSG_ID_HD_GET_CALIBRATION_RECORD = 0x803E # HD get calibration_record record that is requested from Dialin MSG_ID_HD_SEND_CALIBRATION_RECORD = 0x803F # HD send calibration_record record to CAN bus to be received in Dialin (equivalent to publish) + 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_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/dg/accelerometer.py =================================================================== diff -u -r5f050d368a51975a3b983ddd58fba6334c72388a -r3a5030c08d57bddc2c22dca05d1070375e3cb5f7 --- dialin/dg/accelerometer.py (.../accelerometer.py) (revision 5f050d368a51975a3b983ddd58fba6334c72388a) +++ dialin/dg/accelerometer.py (.../accelerometer.py) (revision 3a5030c08d57bddc2c22dca05d1070375e3cb5f7) @@ -242,40 +242,3 @@ else: self.logger.debug("Timeout!!!!") return False - - def cmd_set_accel_calibration(self, x_offset, y_offset, z_offset): - """ - Constructs and sends the DG accelerometer axis calibration offsets message to the DG. - - @param x_offset: float - calibration offset for X axis - @param y_offset: float - calibration offset for Y axis - @param z_offset: float - calibration offset for Z axis - - @return: 1 if successful, zero otherwise - """ - x = float_to_bytearray(x_offset) - y = float_to_bytearray(y_offset) - z = float_to_bytearray(z_offset) - payload = x + y + z - - message = DenaliMessage.build_message(channel_id=DenaliChannels.dialin_to_dg_ch_id, - message_id=MsgIds.MSG_ID_DG_ACCEL_SET_CALIBRATION.value, - payload=payload) - - self.logger.debug("Setting DG accelerometer axis calibration offsets") - - # Send message - received_message = self.can_interface.send(message) - - # If there is content... - if received_message is not None: - self.logger.debug(received_message) - # str_res = str(flow) - self.logger.debug("DG accelerometer calibration axis offsets set to : " + str(x_offset) + ", " + str(y_offset) + ", " + - str(z_offset) + ". " + 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/dg/dialysate_generator.py =================================================================== diff -u -r300390c34a81a42b5eb606e4f4499a1439bfc432 -r3a5030c08d57bddc2c22dca05d1070375e3cb5f7 --- dialin/dg/dialysate_generator.py (.../dialysate_generator.py) (revision 300390c34a81a42b5eb606e4f4499a1439bfc432) +++ dialin/dg/dialysate_generator.py (.../dialysate_generator.py) (revision 3a5030c08d57bddc2c22dca05d1070375e3cb5f7) @@ -30,8 +30,15 @@ from .ro_pump import DGROPump from .samplewater import DGSampleWater from .temperature_sensors import TemperatureSensors +from .conductivity_sensors import ConductivitySensors +from .heat_disinfect import HeatDisinfect from .thermistors import Thermistors from .uv_reactors import UVReactors +from .concentrate_pumps import ConcentratePumps +from .calibration_record import DGCalibrationNVRecord +from .system_record import DGSystemNVRecord +from .service_record import DGServiceNVRecord +from .scheduled_runs_record import DGScheduledRunsNVRecord from .valves import DGValves from ..utils.conversions import integer_to_bytearray from ..protocols.CAN import (DenaliCanMessenger, DenaliMessage, DenaliChannels) @@ -149,15 +156,23 @@ self.ro_pump = DGROPump(self.can_interface, self.logger) self.samplewater = DGSampleWater(self.can_interface, self.logger) self.temperature_sensors = TemperatureSensors(self.can_interface, self.logger) + self.conductivity_sensors = ConductivitySensors(self.can_interface, self.logger) + self.concentrate_pumps = ConcentratePumps(self.can_interface, self.logger) + self.alarms = DGAlarms(self.can_interface, self.logger) + self.heat_disinfect = HeatDisinfect(self.can_interface, self.logger) self.thermistors = Thermistors(self.can_interface, self.logger) self.uv_reactors = UVReactors(self.can_interface, self.logger) + self.calibration_record = DGCalibrationNVRecord(self.can_interface, self.logger) + self.system_record = DGSystemNVRecord(self.can_interface, self.logger) + self.service_record = DGServiceNVRecord(self.can_interface, self.logger) + self.scheduled_runs_record = DGScheduledRunsNVRecord(self.can_interface, self.logger) self.valves = DGValves(self.can_interface, self.logger) def get_version(self): """ Gets the DG version. Assumes DG version has already been requested. - @return: The dg version string + @return: The hd version string """ return self.dg_version Index: dialin/hd/accelerometer.py =================================================================== diff -u -r82e32ae00355b2245a2660569935de152a883799 -r3a5030c08d57bddc2c22dca05d1070375e3cb5f7 --- dialin/hd/accelerometer.py (.../accelerometer.py) (revision 82e32ae00355b2245a2660569935de152a883799) +++ dialin/hd/accelerometer.py (.../accelerometer.py) (revision 3a5030c08d57bddc2c22dca05d1070375e3cb5f7) @@ -241,41 +241,4 @@ return received_message['message'][DenaliMessage.PAYLOAD_START_INDEX] else: self.logger.debug("Timeout!!!!") - return False - - def cmd_set_accel_calibration(self, x_offset, y_offset, z_offset): - """ - Constructs and sends the HD accelerometer axis calibration offsets message to the HD. - - @param x_offset: float - calibration offset for X axis - @param y_offset: float - calibration offset for Y axis - @param z_offset: float - calibration offset for Z axis - - @return: 1 if successful, zero otherwise - """ - x = float_to_bytearray(x_offset) - y = float_to_bytearray(y_offset) - z = float_to_bytearray(z_offset) - payload = x + y + z - - message = DenaliMessage.build_message(channel_id=DenaliChannels.dialin_to_hd_ch_id, - message_id=MsgIds.MSG_ID_HD_ACCEL_SET_CALIBRATION.value, - payload=payload) - - self.logger.debug("Setting HD accelerometer axis calibration offsets") - - # Send message - received_message = self.can_interface.send(message) - - # If there is content... - if received_message is not None: - self.logger.debug(received_message) - # str_res = str(flow) - self.logger.debug("HD accelerometer calibration axis offsets set to : " + str(x_offset) + ", " + str(y_offset) + ", " + - str(z_offset) + ". " + 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 - + return False \ No newline at end of file Index: dialin/hd/hemodialysis_device.py =================================================================== diff -u -r551e0a9620126efd158e93c45e9ed84ee6ec85fb -r3a5030c08d57bddc2c22dca05d1070375e3cb5f7 --- dialin/hd/hemodialysis_device.py (.../hemodialysis_device.py) (revision 551e0a9620126efd158e93c45e9ed84ee6ec85fb) +++ dialin/hd/hemodialysis_device.py (.../hemodialysis_device.py) (revision 3a5030c08d57bddc2c22dca05d1070375e3cb5f7) @@ -30,6 +30,7 @@ from .system_record import HDSystemNVRecords from .service_record import HDServiceNVRecords from .pressure_occlusion import HDPressureOcclusion +from .pretreatment import HDPreTreatment from ..protocols.CAN import (DenaliMessage, DenaliCanMessenger, DenaliChannels) @@ -54,8 +55,7 @@ HD_OP_MODE_SERVICE = 1 HD_OP_MODE_INIT_POST = 2 HD_OP_MODE_STANDBY = 3 - HD_OP_MODE_PRESCRIPTION = 4 - HD_OP_MODE_OP_PARAMS = 5 + HD_OP_MODE_TREATMENT_PARAMS = 4 HD_OP_MODE_PRE_TREATMENT = 6 HD_OP_MODE_TREATMENT = 7 HD_OP_MODE_POST_TREATMENT = 8 @@ -112,6 +112,7 @@ self.dialysate_inlet_flow = HDDialysateInletFlow(self.can_interface, self.logger) self.dialysate_outlet_flow = HDDialysateOutletFlow(self.can_interface, self.logger) self.treatment = HDTreatment(self.can_interface, self.logger) + self.pretreatment = HDPreTreatment(self.can_interface, self.logger) self.pressure_occlusion = HDPressureOcclusion(self.can_interface, self.logger) self.valves = HDValves(self.can_interface, self.logger) self.calibration_record = HDCalibrationNVRecord(self.can_interface, self.logger) @@ -171,6 +172,109 @@ self.logger.debug("Login Timeout!!!!") return False + def cmd_hd_request_calibration_data(self): + """ + Constructs and sends an HD calibration data request command via CAN bus. + Constraints: + Must be logged into HD. + + \returns response message if received, False if no response received + + @return: 1 if successful, zero otherwise + + """ + message = DenaliMessage.build_message(channel_id=DenaliChannels.dialin_to_hd_ch_id, + message_id=MsgIds.MSG_ID_HD_REQUEST_CALIBRATION_DATA.value) + + self.logger.debug("requesting HD calibration data.") + + # Send message + received_message = self.can_interface.send(message) + + if received_message is not None: + if received_message['message'][DenaliMessage.PAYLOAD_START_INDEX] == 1: + self.logger.debug("HD calibration data request accepted.") + else: + self.logger.debug("HD calibration data request failed.") + return received_message['message'][DenaliMessage.PAYLOAD_START_INDEX] + else: + self.logger.debug("Timeout!!!!") + return False + + def cmd_hd_erase_calibration_data(self): + """ + Constructs and sends an erase HD calibration data request command via CAN bus. + Constraints: + Must be logged into HD. + + \returns response message if received, False if no response received + + @return: 1 if successful, zero otherwise + + """ + key = integer_to_bytearray(-758926171) # 0xD2C3B4A5 + + message = DenaliMessage.build_message(channel_id=DenaliChannels.dialin_to_hd_ch_id, + message_id=MsgIds.MSG_ID_HD_ERASE_CALIBRATION_DATA.value, + payload=key) + + self.logger.debug("requesting HD calibration data be erased.") + + # Send message + received_message = self.can_interface.send(message) + + if received_message is not None: + if received_message['message'][DenaliMessage.PAYLOAD_START_INDEX] == 1: + self.logger.debug("HD calibration data erasure request accepted.") + else: + self.logger.debug("HD calibration data erasure request failed.") + return received_message['message'][DenaliMessage.PAYLOAD_START_INDEX] + else: + self.logger.debug("Timeout!!!!") + return False + + def cmd_hd_set_operation_mode(self, newMode=0): + """ + Constructs and sends a set operation mode request command via CAN bus. + Constraints: + Must be logged into HD. + Transition from current to requested op mode must be legal. + + @param newMode: ID of operation mode to transition to + HD_OP_MODE_FAULT = 0 + HD_OP_MODE_SERVICE = 1 + HD_OP_MODE_INIT_POST = 2 + HD_OP_MODE_STANDBY = 3 + HD_OP_MODE_TREATMENT_PARAMS = 4 + HD_OP_MODE_PRE_TREATMENT = 6 + HD_OP_MODE_TREATMENT = 7 + HD_OP_MODE_POST_TREATMENT = 8 + + @return: 1 if successful, zero otherwise + + """ + + payload = integer_to_bytearray(newMode) + + message = DenaliMessage.build_message(channel_id=DenaliChannels.dialin_to_hd_ch_id, + message_id=MsgIds.MSG_ID_HD_SET_OP_MODE_REQUEST.value, + payload=payload) + + self.logger.debug("Requesting HD mode change to " + str(newMode)) + + # Send message + received_message = self.can_interface.send(message) + + if received_message is not None: + if received_message['message'][DenaliMessage.PAYLOAD_START_INDEX] == 1: + self.logger.debug("Success: Mode change accepted") + else: + self.logger.debug("Failure: Mode change rejected.") + return received_message['message'][DenaliMessage.PAYLOAD_START_INDEX] + else: + self.logger.debug("HD mode change request Timeout!!!!") + return False + def cmd_hd_safety_shutdown_override(self, active=True, reset=NO_RESET): """ Constructs and sends an HD safety shutdown override command via CAN bus. Index: dialin/ui/hd_simulator.py =================================================================== diff -u -r467e3ca526575de128af35761d0e2e7850cf9289 -r3a5030c08d57bddc2c22dca05d1070375e3cb5f7 --- dialin/ui/hd_simulator.py (.../hd_simulator.py) (revision 467e3ca526575de128af35761d0e2e7850cf9289) +++ dialin/ui/hd_simulator.py (.../hd_simulator.py) (revision 3a5030c08d57bddc2c22dca05d1070375e3cb5f7) @@ -1807,7 +1807,7 @@ def cmd_send_accelerometer_dg_data(self, vX, vY, vZ, vXMax, vYMax, vZMax, vXTilt, vYTilt, vZTilt ): """ - the accelerometer dg data message method + the accelerometer hd data message method | MSG | CAN ID | Box | Type | Ack | Src | Dst | Description | |:----:|:------:|:---:|:------:|:---:|:---:|:---:|:-----------: | |0x3400| 0x080 | 8 | 1Hz | N | HD | UI | DG Accelerometer data | @@ -1883,7 +1883,7 @@ def cmd_send_version_dg_data(self, vMajor, vMinor, vMicro, vBuild, vFPGA_id, vFPGA_Major, vFPGA_Minor, vFPGA_Lab ): """ - the dg version response message method + the hd version response message method :param vMajor: Major version number :param vMinor: Minor version number :param vMicro: Micro version number Index: tests/test_uf.py =================================================================== diff -u -r3cfd47dcddb9ca34212ed9b7d29a76124c23044c -r3a5030c08d57bddc2c22dca05d1070375e3cb5f7 --- tests/test_uf.py (.../test_uf.py) (revision 3cfd47dcddb9ca34212ed9b7d29a76124c23044c) +++ tests/test_uf.py (.../test_uf.py) (revision 3a5030c08d57bddc2c22dca05d1070375e3cb5f7) @@ -34,7 +34,7 @@ # log in to HD and DG as tester # if hd.cmd_log_in_to_hd() == 0: # exit(1) -# if dg.cmd_log_in_to_dg() == 0: +# if hd.cmd_log_in_to_dg() == 0: # exit(1) # sleep(1)