Index: dialin/common/msg_defs.py =================================================================== diff -u -rec4566a8f8f9731331270672df92100023cb733a -rcff98df963746b055cac8e59ceb899da1903027c --- dialin/common/msg_defs.py (.../msg_defs.py) (revision ec4566a8f8f9731331270672df92100023cb733a) +++ dialin/common/msg_defs.py (.../msg_defs.py) (revision cff98df963746b055cac8e59ceb899da1903027c) @@ -110,6 +110,7 @@ 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_CAN_ERROR_COUNT = 0x999 # test code in support of EMC testing @@ -127,7 +128,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_3 = 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 +176,15 @@ 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_DG_TESTER_LOGIN_REQUEST = 0XA000 # DG tester log-in MSG_ID_DG_ALARM_STATE_OVERRIDE = 0xA001 # DG alarm state override message ID Index: dialin/hd/treatment.py =================================================================== diff -u -r47948eed572c352ffd10cd5246a145f2eec3266d -rcff98df963746b055cac8e59ceb899da1903027c --- dialin/hd/treatment.py (.../treatment.py) (revision 47948eed572c352ffd10cd5246a145f2eec3266d) +++ dialin/hd/treatment.py (.../treatment.py) (revision cff98df963746b055cac8e59ceb899da1903027c) @@ -17,7 +17,6 @@ from ..protocols.CAN import (DenaliMessage, DenaliChannels) from ..utils.base import _AbstractSubSystem, _publish -from ..utils.conversions import integer_to_bytearray, float_to_bytearray from ..common.msg_defs import MsgIds, MsgFieldPositions from logging import Logger from ..utils.conversions import integer_to_bytearray, float_to_bytearray @@ -1067,3 +1066,33 @@ self.logger.debug("Timeout!!!!") return False + def cmd_treatment_time_remaining_override(self, secs_remaining): + """ + Constructs and sends the treatment time remaining override command + Constraints: + Must be logged into HD. + + @param secs_remaining: integer - number of seconds remaining (must be positive) + @return: 1 if successful, zero otherwise + """ + + payload = integer_to_bytearray(secs_remaining) + + message = DenaliMessage.build_message(channel_id=DenaliChannels.dialin_to_hd_ch_id, + message_id=MsgIds.MSG_ID_TREATMENT_TIME_REMAINING_OVERRIDE.value, + payload=payload) + + self.logger.debug("override HD treatment time remaining (in seconds).") + + # Send message + received_message = self.can_interface.send(message) + + # If there is content... + if received_message is not None: + self.logger.debug("Treatment time remaining overridden to " + str(secs_remaining) + " seconds. " + + 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