Index: dialin/common/msg_ids.py =================================================================== diff -u -r4a0c6600b52ec965a6625a428de986e7040ae2c9 -rb9627a1461cd49df4a798f0a7514aae6a58a767f --- dialin/common/msg_ids.py (.../msg_ids.py) (revision 4a0c6600b52ec965a6625a428de986e7040ae2c9) +++ dialin/common/msg_ids.py (.../msg_ids.py) (revision b9627a1461cd49df4a798f0a7514aae6a58a767f) @@ -370,6 +370,7 @@ MSG_ID_HD_DIAL_OUT_PUMP_HARD_STOP = 0x8090 MSG_ID_HD_BLOOD_PUMP_HARD_STOP = 0x8091 MSG_ID_HD_DIALIN_CHECK_IN = 0x8092 + MSG_ID_HD_ENABLE_VENOUS_BUBBLE_ALARM_DETECTION = 0x8093 MSG_ID_DG_TESTER_LOGIN_REQUEST = 0xA000 MSG_ID_DG_ALARM_STATE_OVERRIDE = 0xA001 Index: dialin/hd/air_bubbles.py =================================================================== diff -u -r9bc00e997e91dab8b404aa877b02ae3d4100d417 -rb9627a1461cd49df4a798f0a7514aae6a58a767f --- dialin/hd/air_bubbles.py (.../air_bubbles.py) (revision 9bc00e997e91dab8b404aa877b02ae3d4100d417) +++ dialin/hd/air_bubbles.py (.../air_bubbles.py) (revision b9627a1461cd49df4a798f0a7514aae6a58a767f) @@ -218,3 +218,37 @@ else: self.logger.debug("ms must be an integer.") return False + + def cmd_venous_bubble_alarm_enable(self, enabled: bool = True) -> int: + """ + Constructs and sends the venous bubble alarm detection enable/disable command + Constraints: + Must be logged into HD. + + @param enabled: bool - True enables alarm detection, False disables alarm detection + @return: 1 if successful, zero otherwise + """ + + ena = 1 if enabled else 0 + + payload = integer_to_bytearray(ena) + + message = DenaliMessage.build_message(channel_id=DenaliChannels.dialin_to_hd_ch_id, + message_id=MsgIds.MSG_ID_HD_ENABLE_VENOUS_BUBBLE_ALARM_DETECTION.value, + payload=payload) + + if enabled: + self.logger.debug("Enable venous bubble alarm detection") + else: + self.logger.debug("Disable venous bubble alarm detection") + + # Send message + 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