Index: dialin/common/msg_ids.py =================================================================== diff -u -r8ac75cccb937866cb13c49a97e91bb9e1060a9d8 -r35ab0929ebeabda5c7a2c4eced8f6d0cf1a93435 --- dialin/common/msg_ids.py (.../msg_ids.py) (revision 8ac75cccb937866cb13c49a97e91bb9e1060a9d8) +++ dialin/common/msg_ids.py (.../msg_ids.py) (revision 35ab0929ebeabda5c7a2c4eced8f6d0cf1a93435) @@ -21,7 +21,7 @@ @unique class MsgIds(DialinEnum): MSG_ID_UNUSED = 0x0 - MSG_ID_POWER_OFF = 0x1 + MSG_ID_OFF_BUTTON_PRESS_REQUEST = 0x1 MSG_ID_ALARM_STATUS = 0x2 MSG_ID_ALARM_TRIGGERED = 0x3 MSG_ID_ALARM_CLEARED = 0x4 Index: dialin/hd/ui_proxy.py =================================================================== diff -u -r350a114f0728459afcffd2faf0b0f04debaca36f -r35ab0929ebeabda5c7a2c4eced8f6d0cf1a93435 --- dialin/hd/ui_proxy.py (.../ui_proxy.py) (revision 350a114f0728459afcffd2faf0b0f04debaca36f) +++ dialin/hd/ui_proxy.py (.../ui_proxy.py) (revision 35ab0929ebeabda5c7a2c4eced8f6d0cf1a93435) @@ -1819,4 +1819,33 @@ message_id=MsgIds.MSG_ID_UI_ACTIVE_ALARMS_LIST_REQUEST.value) self.logger.debug("Sending active alarm list request msg to HD.") - self.can_interface.send(message, 0) \ No newline at end of file + self.can_interface.send(message, 0) + + def cmd_ui_off_button_response(self, reponse: int) -> int: + """ + Constructs and sends a message to DG to set the status of the RO only mode: + 0 = OFF_BUTTON_RSP_USER_REQUESTS_POWER_OFF # User requests power off response + 1 = OFF_BUTTON_RSP_USER_CONFIRMS_POWER_OFF # User confirms power off response + 2 = OFF_BUTTON_RSP_USER_REJECTS_POWER_OFF # User rejects power off response + + @param response: (int) off button response to HD + @return: 1 if successful, zero otherwise + """ + res = integer_to_bytearray(reponse) + payload = res + + message = DenaliMessage.build_message(channel_id=DenaliChannels.ui_to_hd_ch_id, + message_id=MsgIds.MSG_ID_OFF_BUTTON_PRESS_REQUEST.value, + payload=payload) + + self.logger.debug("Sending Power off message request with value {}".format(res)) + + 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 \ No newline at end of file