Index: dialin/hd/air_trap.py =================================================================== diff -u -r3b8ec241845f0bfbeebc3f6e14160b9e7148fc3b -r045eb4c25850caf5b77a3fabcb0e6eefa7407380 --- dialin/hd/air_trap.py (.../air_trap.py) (revision 3b8ec241845f0bfbeebc3f6e14160b9e7148fc3b) +++ dialin/hd/air_trap.py (.../air_trap.py) (revision 045eb4c25850caf5b77a3fabcb0e6eefa7407380) @@ -121,7 +121,7 @@ payload = rst + det + idx message = DenaliMessage.build_message(channel_id=DenaliChannels.dialin_to_hd_ch_id, - message_id=MsgIds.MSG_ID_DG_AIR_TRAP_LEVEL_SENSOR_OVERRIDE.value, + message_id=MsgIds.MSG_ID_HD_AIR_TRAP_LEVEL_SENSOR_OVERRIDE.value, payload=payload) self.logger.debug("override air trap level sensor detection value for sensor " + str(sensor)) @@ -154,7 +154,7 @@ payload = rst + mis message = DenaliMessage.build_message(channel_id=DenaliChannels.dialin_to_hd_ch_id, - message_id=MsgIds.MSG_ID_DG_AIR_TRAP_DATA_BROADCAST_INTERVAL_OVERRIDE.value, + message_id=MsgIds.MSG_ID_HD_AIR_TRAP_SEND_INTERVAL_OVERRIDE.value, payload=payload) self.logger.debug("override HD air trap data broadcast interval") Index: dialin/hd/hemodialysis_device.py =================================================================== diff -u -r211f04b9e9ff6558bc34f99ee805e18ad9c30579 -r045eb4c25850caf5b77a3fabcb0e6eefa7407380 --- dialin/hd/hemodialysis_device.py (.../hemodialysis_device.py) (revision 211f04b9e9ff6558bc34f99ee805e18ad9c30579) +++ dialin/hd/hemodialysis_device.py (.../hemodialysis_device.py) (revision 045eb4c25850caf5b77a3fabcb0e6eefa7407380) @@ -174,8 +174,9 @@ """ message = DenaliMessage.build_message(channel_id=DenaliChannels.dialin_to_hd_ch_id, - message_id=MsgIds.MSG_ID_HD_REQUEST_CALIBRATION_DATA.value) + message_id=MsgIds.MSG_ID_HD_GET_CALIBRATION_RECORD.value) + self.logger.debug("requesting HD calibration data.") # Send message @@ -191,38 +192,6 @@ 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. Index: dialin/hd/treatment.py =================================================================== diff -u -r02eff24a2b116fe3d71d8275eeb78f419302efd6 -r045eb4c25850caf5b77a3fabcb0e6eefa7407380 --- dialin/hd/treatment.py (.../treatment.py) (revision 02eff24a2b116fe3d71d8275eeb78f419302efd6) +++ dialin/hd/treatment.py (.../treatment.py) (revision 045eb4c25850caf5b77a3fabcb0e6eefa7407380) @@ -67,8 +67,6 @@ UF_START_STATE = 0 # Start state of the ultrafiltration state machine UF_PAUSED_STATE = 1 # Paused state of the ultrafiltration state machine UF_RUNNING_STATE = 2 # Running state of the ultrafiltration state machine - UF_OFF_STATE = 3 # Completed/off state of the ultrafiltration state machine - UF_COMPLETED_STATE = 4 # Completed state of ultrafiltration state machine # Saline bolus states SALINE_BOLUS_STATE_IDLE = 0 # No saline bolus delivery is in progress Index: dialin/hd/valves.py =================================================================== diff -u -rb24ebf6f50d919d88ff58f10b010cfdfcff8b2a9 -r045eb4c25850caf5b77a3fabcb0e6eefa7407380 --- dialin/hd/valves.py (.../valves.py) (revision b24ebf6f50d919d88ff58f10b010cfdfcff8b2a9) +++ dialin/hd/valves.py (.../valves.py) (revision 045eb4c25850caf5b77a3fabcb0e6eefa7407380) @@ -122,21 +122,21 @@ self.hd_air_trap_status = 0 - def get_valves_status(self): - """ - Returns the valve status dictionary - @return: (dict) the valve statuses - """ - return self.valves_status - - def get_hd_air_trap_status(self): """ Returns the hd air trap status @return: (str) the HD air trap status """ return self.hd_air_trap_status + def get_hd_valves_status(self): + """ + Gets the hd valves status + + @return: (dict) the hd valves status + """ + return self.valves_status + def cmd_hd_valves_broadcast_interval_override(self, ms, reset=NO_RESET): """ Constructs and sends broadcast time interval Index: dialin/ui/hd_simulator.py =================================================================== diff -u -r641f6cb4d7b26d132ab353b279a421f8603a354c -r045eb4c25850caf5b77a3fabcb0e6eefa7407380 --- dialin/ui/hd_simulator.py (.../hd_simulator.py) (revision 641f6cb4d7b26d132ab353b279a421f8603a354c) +++ dialin/ui/hd_simulator.py (.../hd_simulator.py) (revision 045eb4c25850caf5b77a3fabcb0e6eefa7407380) @@ -20,7 +20,8 @@ import time import subprocess -from . import utils, messageBuilder +from . import messageBuilder +from ..common import TreatmentParameterRejections, GuiActionType, EResponse, TXStates from .hd_simulator_alarms import HDAlarmsSimulator from ..common.msg_defs import RequestRejectReasons, MsgIds, MsgFieldPositions from ..common.hd_defs import HDOpModes @@ -31,166 +32,7 @@ from ..utils.conversions import integer_to_bytearray, float_to_bytearray, byte_to_bytearray, short_to_bytearray from ..utils import YES -class TreatmentParameterRejections: - def __init__(self): - self.param_request_valid = RequestRejectReasons.REQUEST_REJECT_REASON_NONE - self.param_blood_flow_rate = RequestRejectReasons.REQUEST_REJECT_REASON_NONE - self.param_dialysate_flow_rate = RequestRejectReasons.REQUEST_REJECT_REASON_NONE - self.param_duration = RequestRejectReasons.REQUEST_REJECT_REASON_NONE - self.param_heparin_stop_time = RequestRejectReasons.REQUEST_REJECT_REASON_NONE - self.param_saline_bolus = RequestRejectReasons.REQUEST_REJECT_REASON_NONE - self.param_acid_concentrate = RequestRejectReasons.REQUEST_REJECT_REASON_NONE - self.param_bicarbonate_concentrate = RequestRejectReasons.REQUEST_REJECT_REASON_NONE - self.param_dialyzer_type = RequestRejectReasons.REQUEST_REJECT_REASON_NONE - self.param_blood_pressure_measure_interval = RequestRejectReasons.REQUEST_REJECT_REASON_NONE - self.param_rinseback_flow_rate = RequestRejectReasons.REQUEST_REJECT_REASON_NONE - self.param_arterial_pressure_limit_low = RequestRejectReasons.REQUEST_REJECT_REASON_NONE - self.param_arterial_pressure_limit_high = RequestRejectReasons.REQUEST_REJECT_REASON_NONE - self.param_venous_pressure_limit_low = RequestRejectReasons.REQUEST_REJECT_REASON_NONE - self.param_venous_pressure_limit_high = RequestRejectReasons.REQUEST_REJECT_REASON_NONE - self.param_heparin_dispensing_rate = RequestRejectReasons.REQUEST_REJECT_REASON_NONE - self.param_heparin_bolus_volume = RequestRejectReasons.REQUEST_REJECT_REASON_NONE - self.param_dialysate_temp = RequestRejectReasons.REQUEST_REJECT_REASON_NONE - def set_all_valid(self): - """ - Sets all parameters as valid - - @return: None - """ - for attr in dir(self): - if not callable(getattr(self, attr)) and attr.startswith("param_"): - self.__dict__[attr] = RequestRejectReasons.REQUEST_REJECT_REASON_NONE - - def set_all_invalid(self): - """ - Sets all treatment parameters to be invalid - - @return: None - """ - for attr in dir(self): - if not callable(getattr(self, attr)) and attr.startswith("param_"): - self.__dict__[attr] = RequestRejectReasons.REQUEST_REJECT_REASON_NOT_ALLOWED_IN_CURRENT_MODE - - -class TXStates: - # Sub Mode - TREATMENT_START_STATE = 0 # Start treatment - initialize treatment and go to blood prime state - TREATMENT_BLOOD_PRIME_STATE = 1 # Prime blood-side of dialyzer with gradual ramp for 1 min. while dialyzer is bypassed. No dialysis or UF taking place. No treatment time. - TREATMENT_DIALYSIS_STATE = 2 # Perform dialysis. Deliver Heparin as prescribed. Deliver UF as prescribed. Handle saline boluses as requested - TREATMENT_STOP_STATE = 3 # Treatment stopped. All pumps off. Dializer bypassed - TREATMENT_RINSEBACK_STATE = 4 # Perform rinseback with saline. Dialyzer bypassed. Dialysate recirculating - TREATMENT_RECIRC_STATE = 5 # Recirculate saline and dialysate while patient disconnected. Blood lines open and shunted. Dialyzer is bypassed - TREATMENT_END_STATE = 6 # Dialysis has ended. Blood pump slowed. Dialyzer is bypassed. Dialysate is recirculated. User can rinseback - - # Saline states - SALINE_BOLUS_STATE_IDLE = 0 # No saline bolus delivery is in progress - SALINE_BOLUS_STATE_WAIT_FOR_PUMPS_STOP = 1 # Wait for pumps to stop before starting bolus - SALINE_BOLUS_STATE_IN_PROGRESS = 2 # A saline bolus delivery is in progress - SALINE_BOLUS_STATE_MAX_DELIVERED = 3 # Maximum saline bolus volume reached - no more saline bolus deliveries allowed - - # UF states - UF_START_STATE = 0 # Start state of the ultrafiltration state machine - UF_PAUSED_STATE = 1 # Paused state of the ultrafiltration state machine - UF_RUNNING_STATE = 2 # Running state of the ultrafiltration state machine - UF_OFF_STATE = 3 # Completed/off state of the ultrafiltration state machine - UF_COMPLETED_STATE = 4 # Completed state of ultrafiltration state machine - - # Sub Mode - # UI only cares about the actual state and _NOT could be any other state - TREATMENT_START_STATE = 0 - TREATMENT_BLOOD_PRIME_STATE = 1 - TREATMENT_DIALYSIS_STATE = 2 - TREATMENT_STOP_STATE = 3 - TREATMENT_RINSEBACK_STATE = 4 - TREATMENT_RECIRC_STATE = 5 - TREATMENT_END_STATE = 6 - - # Heparin states - HEPARIN_STATE_OFF = 0 # No heparin delivery is in progress - HEPARIN_STATE_PAUSED = 1 # Heparin delivery paused - HEPARIN_STATE_INITIAL_BOLUS = 2 # Initial heparin bolus delivery in progress - HEPARIN_STATE_DISPENSING = 3 # Gradual heparin dispensing in progress - HEPARIN_STATE_COMPLETED = 4 # Heparin delivery stopped due to the set stop time before treatment end - HEPARIN_STATE_EMPTY = 5 # Heparin Syringe empty - - # Rinseback states - RINSEBACK_STOP_INIT_STATE = 0 # Start state (stopped) of the rinseback sub-mode state machine - RINSEBACK_RUN_STATE = 1 # Rinseback running state of the rinseback sub-mode state machine - RINSEBACK_PAUSED_STATE = 2 # Rinseback paused state of the rinseback sub-mode state machine - RINSEBACK_STOP_STATE = 3 # Rinseback stopped (done) state of the rinseback sub-mode state machine - RINSEBACK_RUN_ADDITIONAL_STATE = 4 # Additional rinseback volume (10 mL) state of the rinseback sub-mode state machine - - # Recirculate - TREATMENT_RECIRC_RECIRC_STATE = 0 # Re-circulate state of the treatment re-circulate sub-mode state machine - TREATMENT_RECIRC_STOPPED_STATE = 1 # Stopped state of the treatment re-circulate sub-mode state machine - - # Blood Prime - BLOOD_PRIME_RAMP_STATE = 0 # Ramp state of the blood prime sub-mode state machine - - # Treatment End - TREATMENT_END_WAIT_FOR_RINSEBACK_STATE = 0 # Wait for rinseback state of the treatment end sub-mode state machine - TREATMENT_END_PAUSED_STATE = 1 # Paused state of the treatment end sub-mode state machine - - # Treatment Stop - TREATMENT_STOP_RECIRC_STATE = 0 # Dialysate re-circulation state of the treatment stop sub-mode state machine - TREATMENT_STOP_NO_RECIRC_STATE = 1 # No dialysate re-circulation state of the treatment stop sub-mode state machine - - -class EResponse: - Rejected = 0 - Accepted = 1 - - -class GuiActionType: - Unknown = 0 - PowerOff = 1 - KeepAlive = 7 - BloodFlow = 5 - DialysateInletFlow = 8 - DialysateOutletFlow = 11 - TreatmentTime = 13 - PowerOffBroadcast = 14 - - AlarmStatus = 2 - AlarmTriggered = 3 - AlarmCleared = 4 - - PressureOcclusion = 9 - - DGDrainPumpData = 36 - DGHeatersData = 44 - LoadCellReadings = 12 - DGPressuresData = 32 - TemperatureSensors = 45 - - CanBUSFaultCount = 2457 - HDDebugText = 0xFFF1 - DGDebugText = 0xFFF2 - - AdjustBloodDialysateReq = 23 - AdjustBloodDialysateRsp = 24 - - AdjustDurationReq = 22 - AdjustDurationRsp = 27 - - AdjustUltrafiltrationStateReq = 16 - AdjustUltrafiltrationStateRsp = 65 - AdjustUltrafiltrationEditReq = 17 - AdjustUltrafiltrationEditRsp = 19 - AdjustUltrafiltrationConfirmReq = 21 - AdjustUltrafiltrationConfirmRsp = 46 - - AdjustPressuresLimitsReq = 70 - AdjustPressuresLimitsRsp = 71 - - TreatmentRanges = 26 - - String = 65279 - Acknow = 65535 - AcknowGeneric = 0 # Generic Acknowledgment is not a unique message ID and inherits its Id from the actual message. Zero is a placeholder - - class HDSimulator(_AbstractSubSystem): NUM_TREATMENT_PARAMETERS = 18 instanceCount = 0 @@ -218,10 +60,10 @@ if self.can_interface is not None: channel_id = DenaliChannels.ui_to_hd_ch_id self.can_interface.register_receiving_publication_function(channel_id, - MsgIds.MSG_ID_UI_START_TREATMENT.value, + MsgIds.MSG_ID_UI_START_TREATMENT_REQUEST.value, self._handler_ui_start_treatment) self.can_interface.register_receiving_publication_function(channel_id, - MsgIds.MSG_ID_UI_PRE_TREATMENT_UF_REQUEST.value, + MsgIds.MSG_ID_UI_SET_UF_VOLUME_PARAMETER.value, self._handler_ui_pre_treatment_uf_request) self.can_interface.register_receiving_publication_function(channel_id, MsgIds.MSG_ID_UI_NEW_TREATMENT_PARAMS.value, @@ -385,24 +227,6 @@ self.can_interface.send(message, 0) - def cmd_send_priming_time_remaining(self, state, seconds_remaining, seconds_total): - """ - Broadcasts the number of seconds remaining in priming to the UI - - @return: None - """ - - payload = bytearray() - payload += integer_to_bytearray(state) - payload += integer_to_bytearray(seconds_remaining) - payload += integer_to_bytearray(seconds_total) - - message = DenaliMessage.build_message(channel_id=DenaliChannels.hd_sync_broadcast_ch_id, - message_id=MsgIds.MSG_ID_DG_PRIMING_STATUS_DATA.value, - payload=payload) - - self.can_interface.send(message, 0) - def _handler_ui_confirm_treatment(self, message): """ Handler function to detect when a treatment is confirmed @@ -523,7 +347,7 @@ payload += float_to_bytearray(volume) message = DenaliMessage.build_message(channel_id=DenaliChannels.hd_to_ui_ch_id, - message_id=MsgIds.MSG_ID_HD_PRE_TREATMENT_UF_RESPONSE.value, + message_id=MsgIds.MSG_ID_HD_SET_UF_VOLUME_PARAMETER_RESPONSE.value, payload=payload) self.can_interface.send(message, 0) @@ -537,7 +361,7 @@ payload = integer_to_bytearray(YES) message = DenaliMessage.build_message(channel_id=DenaliChannels.hd_to_ui_ch_id, - message_id=MsgIds.MSG_ID_HD_TREATMENT_END_RESPONSE.value, + message_id=MsgIds.MSG_ID_HD_TX_END_CMD_RESPONSE.value, payload=payload) self.can_interface.send(message, 0) @@ -616,20 +440,6 @@ self.can_interface.send(message, 0) - def cmd_send_checkin_dg(self): - """ - check-in (keep alive) message from DG - :return: none - """ - - payload = ["A5", "01", "00", "06", "00", "00", "76", "00"] - payload = [int(each, 16) for each in payload] - - message = {"channel_id": DenaliChannels.dg_to_hd_ch_id, - "message": payload} - - self.can_interface.send(message, 0) - def cmd_show_poweroff_dialog(self): """ the message from HD to UI to show the power off dialog @@ -697,18 +507,6 @@ time.sleep(delay) @staticmethod - def build_dg_debug_text(vText): - """ - the debug text message from DG builder method - :param vText: (str) the debug text - :return: none - """ - message_length = 40 - txt = messageBuilder.textToByte(vText, message_length) # + 1 null term - msg = messageBuilder.buildMessage(GuiActionType.DGDebugText, 1 * (message_length + 1), False, txt) - return messageBuilder.toFrames(msg) - - @staticmethod def build_hd_debug_text(vText): """ the debug text message from HD builder method @@ -959,7 +757,7 @@ payload += float_to_bytearray(vVolume) message = DenaliMessage.build_message(channel_id=DenaliChannels.hd_to_ui_ch_id, - message_id=MsgIds.MSG_ID_HD_PRE_TREATMENT_UF_RESPONSE.value, + message_id=MsgIds.MSG_ID_HD_SET_UF_VOLUME_PARAMETER_RESPONSE.value, payload=payload) self.can_interface.send(message, 0) @@ -1133,240 +931,6 @@ self.can_interface.send(message, 0) - def cmd_set_dg_ro_pump_data(self, vSetPtPressure, vFlowRate, vPWM): - """ - the DG RO Pump Data message setter/sender method - - | MSG | CAN ID | Box | Type | Ack | Src | Dst | Description | #1:(U32) | #2:(F32) | #3:(F32) | - |:----:|:------:|:---:|:------:|:---:|:---:|:---:|:-----------: |:--: |:--: |:--: | - |0x1F00| 0x080 | 8 | 1 Hz | N | DG | All | DG RO Pump Data | \ref Data::mPressure | \ref Data::mFlowRate | \ref Data::mPWM | :param vSetPtPressure: - - :param vSetPtPressure: (int) set Point Pressure - :param vFlowRate: (float) Flow Rate - :param vPWM: (float) PWM - :return: none - """ - - payload = integer_to_bytearray(vSetPtPressure) - payload += float_to_bytearray(vFlowRate) - payload += float_to_bytearray(vPWM) - - message = DenaliMessage.build_message(channel_id=DenaliChannels.dg_sync_broadcast_ch_id, - message_id=MsgIds.MSG_ID_RO_PUMP_DATA.value, - payload=payload) - - self.can_interface.send(message, 0) - - def cmd_set_dg_pressures_data(self, vROInletPSI, vROOutletPSI, vDrainInletPSI, vDrainOutletPSI): - """ - the DG Pressures Data message setter/sender method - - | MSG | CAN ID | Box | Type | Ack | Src | Dst | Description | #1:(F32) | #2:(F32) | #3:(F32) | #4:(F32) | - |:----:|:------:|:---:|:------:|:---:|:---:|:---:|:-----------: |:--: |:--: |:--: |:--: | - |0x2000| 0x080 | 8 | 1 Hz | N | DG | All | DG Pressures Data | \ref Data::mROInletPSI | \ref Data::mROOutletPSI | \ref Data::mDrainInletPSI | \ref Data::mDrainOutletPSI | - - :param vROInletPSI: (float) RO Inlet PSI - :param vROOutletPSI: (float) RO Outlet PSI - :param vDrainInletPSI: (float) Drain Inlet PSI - :param vDrainOutletPSI: (float) Drain Outlet PSI - :return: none - """ - - payload = float_to_bytearray(vROInletPSI) - payload += float_to_bytearray(vROOutletPSI) - payload += float_to_bytearray(vDrainInletPSI) - payload += float_to_bytearray(vDrainOutletPSI) - - message = DenaliMessage.build_message(channel_id=DenaliChannels.dg_sync_broadcast_ch_id, - message_id=MsgIds.MSG_ID_DG_PRESSURES_DATA.value, - payload=payload) - - self.can_interface.send(message, 0) - - def cmd_set_dg_drain_pump_data(self, vSetPtRPM, vDACValue): - """ - the DG Drain Pump Data message setter/sender method - - | MSG | CAN ID | Box | Type | Ack | Src | Dst | Description | #1:(U32) | #2:(U32) | - |:----:|:------:|:---:|:------:|:---:|:---:|:---:|:-----------: |:--: |:--: | - |0x2400| 0x080 | 8 | 1 Hz | N | DG | All | DG Drain Pump Data | \ref Data::mRPM | \ref Data::mDAC | - - :param vSetPtRPM: (int) Set Point RPM - :param vDACValue: (int) DAC Value - :return: none - """ - - payload = integer_to_bytearray(vSetPtRPM) - payload += integer_to_bytearray(vDACValue) - - message = DenaliMessage.build_message(channel_id=DenaliChannels.dg_sync_broadcast_ch_id, - message_id=MsgIds.MSG_ID_DRAIN_PUMP_DATA.value, - payload=payload) - - self.can_interface.send(message, 0) - - def cmd_set_dg_operation_mode(self, vDGOpMode): - """ - the DG Operation Mode Data message setter/sender method - - | MSG | CAN ID | Box | Type | Ack | Src | Dst | Description | #1:(U32) | - |:----:|:------:|:---:|:------:|:---:|:---:|:---:|:-----------: |:--: | - |0x2700| 0x080 | 8 | 1 Hz | N | DG | All | DG Operation Mode Data | \ref Data::mOpMode | - - :param vDGOpMode: (int) DG Operation Mode - :return: none - """ - - payload = integer_to_bytearray(vDGOpMode) - - message = DenaliMessage.build_message(channel_id=DenaliChannels.dg_sync_broadcast_ch_id, - message_id=MsgIds.MSG_ID_DG_OP_MODE.value, - payload=payload) - - self.can_interface.send(message, 0) - - def cmd_set_dg_reservoir_data(self, vActiveReservoir, vFillToVolML, vDrainToVolML): - """ - the DG Reservoir Data message setter/sender method - - | MSG | CAN ID | Box | Type | Ack | Src | Dst | Description | #1:(U32) | #2:(U32) | #3:(U32) | - |:----:|:------:|:---:|:------:|:---:|:---:|:---:|:-----------: |:--: |:--: |:--: | - |0x2800| 0x080 | 8 | 1 Hz | N | DG | All | DG Reservoir Data | \ref Data::mActiveReservoir | \ref Data::mFillToVol | \ref Data::mDrainToVol | - - :param vActiveReservoir: (int) Active Reservoir - :param vFillToVolML: (int) Fill To Volume ML - :param vDrainToVolML: (int) Drain To Vol ML - :return: none - """ - - payload = integer_to_bytearray(vActiveReservoir) - payload += integer_to_bytearray(vFillToVolML) - payload += integer_to_bytearray(vDrainToVolML) - - message = DenaliMessage.build_message(channel_id=DenaliChannels.dg_sync_broadcast_ch_id, - message_id=MsgIds.MSG_ID_DG_RESERVOIR_DATA.value, - payload=payload) - - self.can_interface.send(message, 0) - - def cmd_set_dg_valves_states(self, vValvesStates): - """ - the DG Valves States Data message setter/sender method - - | MSG | CAN ID | Box | Type | Ack | Src | Dst | Description | #1:(U16) | - |:----:|:------:|:---:|:------:|:---:|:---:|:---:|:-----------: |:--: | - |0x2A00| 0x080 | 8 | 2 Hz | N | DG | All | DG Valves States Data | \ref Data::mStates | - - :param vValvesStates: (int)Valves states - :return: none - """ - - payload = integer_to_bytearray(vValvesStates) - - message = DenaliMessage.build_message(channel_id=DenaliChannels.dg_sync_broadcast_ch_id, - message_id=MsgIds.MSG_ID_DG_VALVES_STATES.value, - payload=payload) - - self.can_interface.send(message, 0) - - def cmd_set_dg_heaters_data(self, vMainPriMaryDC, vSmallPrimaryDC, vTrimmerDC): - """ - the DG Heaters Data message setter/sender method - | MSG | CAN ID | Box | Type | Ack | Src | Dst | Description | #1:(U32) | #2:(U32) | #3:(U32) | - |:----:|:------:|:---:|:------:|:---:|:---:|:---:|:-----------: |:--: |:--: |:--: | - |0x2C00| 0x080 | 8 | 2 Hz | N | DG | All | DG Heaters Data | \ref Data::mMainPrimaryDC | \ref Data::mSmallPrimaryDC | \ref Data::mTrimmerDC | - - :param vMainPriMaryDC: (int) Main PriMary DC - :param vSmallPrimaryDC: (int) Small Primary DC - :param vTrimmerDC: (int) Trimmer DC - :return: none - """ - - payload = integer_to_bytearray(vMainPriMaryDC) - payload += integer_to_bytearray(vSmallPrimaryDC) - payload += integer_to_bytearray(vTrimmerDC) - - message = DenaliMessage.build_message(channel_id=DenaliChannels.dg_sync_broadcast_ch_id, - message_id=MsgIds.MSG_ID_DG_HEATERS_DATA.value, - payload=payload) - - self.can_interface.send(message, 0) - - def cmd_set_dg_load_cell_readings_data(self, vRs1Prim, vRs1Bkup, vRs2Prim, vRs2Bkup): - """ - The DG Load Cell Readings Data message setter/sender method - | MSG | CAN ID | Box | Type | Ack | Src | Dst | Description | #1:(F32) | #2:(F32) | #3:(F32) | #4:(F32) | - |:----:|:------:|:---:|:------:|:---:|:---:|:---:|:-----------: |:--: |:--: |:--: |:--: | - |0x0C00| 0x080 | 8 | 10 Hz | N | DG | All | DG Load Cell Readings Data | \ref Data::mReservoir1Prim | \ref Data::mReservoir1Bkup | \ref Data::mReservoir2Prim | \ref Data::mReservoir2Bkup | - :param vRs1Prim: (float) Reservoir 1 Primary - :param vRs1Bkup: (float) Reservoir 1 Backup - :param vRs2Prim: (float) Reservoir 2 Primary - :param vRs2Bkup: (float) Reservoir 2 Backup - :return: none - """ - - payload = float_to_bytearray(vRs1Prim) - payload += float_to_bytearray(vRs1Bkup) - payload += float_to_bytearray(vRs2Prim) - payload += float_to_bytearray(vRs2Bkup) - - message = DenaliMessage.build_message(channel_id=DenaliChannels.dg_sync_broadcast_ch_id, - message_id=MsgIds.MSG_ID_LOAD_CELL_READINGS.value, - payload=payload) - - self.can_interface.send(message, 0) - - def cmd_set_dg_temperatures_data(self, vInletPrimaryHeater, vOutletPrimaryHeater, vConductivitySensor1, vConductivitySensor2, - vOutletRedundancy, vInletDialysate, vPrimaryHeaterThermocouple, vTrimmerHeaterThermocouple, - vPrimaryHeaterColdJunction, vTrimmerHeaterColdJunction, vPrimaryHeaterInternalTemperature, - vTrimmerHeaterInternalTemperature): - """ - the DG Temperatures Data message setter/sender method - | MSG | CAN ID | Box | Type | Ack | Src | Dst | Description | #1:(F32) | #2:(F32) | #3:(F32) | - |:----:|:------:|:---:|:------:|:---:|:---:|:---:|:-----------: |:--: |:--: |:--: | - |0x2D00| 0x080 | 8 | 2 Hz | N | DG | All | DG Temperatures Data | \ref Data::mInletPrimaryHeater | \ref Data::mOutletPrimaryHeater | \ref Data::mConductivitySensor1 | - - | #4:(F32) | #5:(F32) | #6:(F32) | #7:(F32) | #8:(F32) | - |:--: |:--: |:--: |:--: |:--: | - | \ref Data::mConductivitySensor2 | \ref Data::mOutletRedundancy | \ref Data::mInletDialysate | \ref Data::mPrimaryHeaterThermoCouple | \ref Data::mTrimmerHeaterThermoCouple | - - | #9:(F32) | #10:(F32) | #11:(F32) | #12:(F32) | - | :--: |:--: |:--: |:--: | - | \ref Data::mPrimaryHeaterColdJunction | \ref Data::mTrimmerHeaterColdJunction | \ref Data::mPrimaryHeaterInternal | \ref Data::mTrimmerHeaterInternal | - :param vInletPrimaryHeater: (float) Inlet Primary Heater - :param vOutletPrimaryHeater: (float) Outlet Primary Heater - :param vConductivitySensor1: (float) Conductivity Sensor 1 - :param vConductivitySensor2: (float) Conductivity Sensor 2 - :param vOutletRedundancy: (float) Outlet Redundancy - :param vInletDialysate: (float) Inlet Dialysate - :param vPrimaryHeaterThermocouple: (float) Primary Heater Thermocouple - :param vTrimmerHeaterThermocouple: (float) Trimmer Heater Thermocouple - :param vPrimaryHeaterColdJunction: (float) Primary Heater ColdJunction - :param vTrimmerHeaterColdJunction: (float) Trimmer Heater ColdJunction - :param vPrimaryHeaterInternalTemperature: (float) Primary Heater Internal Temperature - :param vTrimmerHeaterInternalTemperature: (float) Trimmer HeaterInternal Temperature - :return: none - """ - - payload = float_to_bytearray(vInletPrimaryHeater) - payload += float_to_bytearray(vOutletPrimaryHeater) - payload += float_to_bytearray(vConductivitySensor1) - payload += float_to_bytearray(vConductivitySensor2) - payload += float_to_bytearray(vOutletRedundancy) - payload += float_to_bytearray(vInletDialysate) - payload += float_to_bytearray(vPrimaryHeaterThermocouple) - payload += float_to_bytearray(vTrimmerHeaterThermocouple) - payload += float_to_bytearray(vPrimaryHeaterColdJunction) - payload += float_to_bytearray(vTrimmerHeaterColdJunction) - payload += float_to_bytearray(vPrimaryHeaterInternalTemperature) - payload += float_to_bytearray(vTrimmerHeaterInternalTemperature) - - message = DenaliMessage.build_message(channel_id=DenaliChannels.dg_sync_broadcast_ch_id, - message_id=MsgIds.MSG_ID_DG_TEMPERATURE_DATA.value, - payload=payload) - - self.can_interface.send(message, 0) - def cmd_set_treatment_states_data(self, vSubMode, vUFState, vSalineState, vHeparingState, vRinsebackState, vRecirculateState, @@ -1523,20 +1087,6 @@ self.can_interface.send(message, 0) - def cmd_send_unknown_dg(self): - """ - the unknown message from DG setter/sender method - :return: none - """ - - payload = integer_to_bytearray(0) - - message = DenaliMessage.build_message(channel_id=DenaliChannels.dg_to_ui_ch_id, - message_id=MsgIds.MSG_ID_UNUSED.value, - payload=payload) - - self.can_interface.send(message, 0) - def cmd_set_treatment_heparin_data(self, vCumulative): """ the Treatment Heparin Data message setter/sender method @@ -1672,7 +1222,7 @@ payload += integer_to_bytearray(vTimeoutCountDown) message = DenaliMessage.build_message(channel_id=DenaliChannels.hd_to_ui_ch_id, - message_id=MsgIds.MSG_ID_HD_RECIRCULATE_PROGRESS.value, + message_id=MsgIds.MSG_ID_HD_RECIRC_PROGRESS.value, payload=payload) self.can_interface.send(message, 0) @@ -1736,7 +1286,6 @@ 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 @@ -1805,53 +1354,6 @@ self.can_interface.send(message, 0) - def cmd_send_accelerometer_dg_data(self, vX, vY, vZ, vXMax, vYMax, vZMax, vXTilt, vYTilt, vZTilt ): - """ - 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 | - - | #1:(F32) | #2:(F32) | #3:(U32) | - |:--: |:--: |:--: | - | \ref Data::mX | \ref Data::mY | \ref Data::mX | - - | #4:(F32) | #5:(F32) | #6:(U32) | - |:--: |:--: |:--: | - | \ref Data::mXMax | \ref Data::mYMax | \ref Data::mXMax | - - | #7:(F32) | #8:(F32) | #9:(U32) | - |:--: |:--: |:--: | - | \ref Data::mXTilt | \ref Data::mYTilt | \ref Data::mXTilt | - - :param vX: x axis - :param vY: y axis - :param vZ: z axis - :param vXMax: x axis max - :param vYMax: y axis max - :param vZMax: z axis max - :param vXTilt: x axis tilt - :param vYTilt: y axis tilt - :param vZTilt: z axis tilt - :return: None - """ - - payload = float_to_bytearray(vX) - payload += float_to_bytearray(vY) - payload += float_to_bytearray(vZ) - payload += float_to_bytearray(vXMax) - payload += float_to_bytearray(vYMax) - payload += float_to_bytearray(vZMax) - payload += float_to_bytearray(vXTilt) - payload += float_to_bytearray(vYTilt) - payload += float_to_bytearray(vZTilt) - - message = DenaliMessage.build_message(channel_id=DenaliChannels.dg_to_ui_ch_id, - message_id=MsgIds.MSG_ID_DG_ACCELEROMETER_DATA.value, - payload=payload) - - self.can_interface.send(message, 0) - def cmd_send_version_hd_data(self, vMajor, vMinor, vMicro, vBuild, vFPGA_id, vFPGA_Major, vFPGA_Minor, vFPGA_Lab ): """ the hd version response message method @@ -1880,32 +1382,3 @@ payload=payload) self.can_interface.send(message, 0) - - def cmd_send_version_dg_data(self, vMajor, vMinor, vMicro, vBuild, vFPGA_id, vFPGA_Major, vFPGA_Minor, vFPGA_Lab ): - """ - the hd version response message method - :param vMajor: Major version number - :param vMinor: Minor version number - :param vMicro: Micro version number - :param vBuild: Build version number - :param vFPGA_id: FPGA id version number - :param vFPGA_Major: FPGA Major version number - :param vFPGA_Minor: FPGA Minor version number - :param vFPGA_Lab: FPGA Lab version number - :return: None - """ - - payload = byte_to_bytearray(vMajor) - payload += byte_to_bytearray(vMinor) - payload += byte_to_bytearray(vMicro) - payload += short_to_bytearray(vBuild) - payload += byte_to_bytearray(vFPGA_id) - payload += byte_to_bytearray(vFPGA_Major) - payload += byte_to_bytearray(vFPGA_Minor) - payload += byte_to_bytearray(vFPGA_Lab) - - message = DenaliMessage.build_message(channel_id=DenaliChannels.dg_to_ui_ch_id, - message_id=MsgIds.MSG_ID_DG_VERSION.value, - payload=payload) - - self.can_interface.send(message, 0)