Index: dialin/dg/hd_proxy.py =================================================================== diff -u -r26c7b6057f11680681e0a25399b5e5be9b92818d -r1e56201a855d0c77f394195159df961b2988b261 --- dialin/dg/hd_proxy.py (.../hd_proxy.py) (revision 26c7b6057f11680681e0a25399b5e5be9b92818d) +++ dialin/dg/hd_proxy.py (.../hd_proxy.py) (revision 1e56201a855d0c77f394195159df961b2988b261) @@ -490,4 +490,58 @@ return received_message['message'][DenaliMessage.PAYLOAD_START_INDEX] else: self.logger.debug("Timeout!!!!") - return False \ No newline at end of file + return False + + def cmd_hd_send_collect_ro_permeate_sample(self, cmd: int = 0): + """ + Constructs and sends the HD RO permeate sample dispense request. + + @param cmd: (int) - 0 for DISPENSE_MSG_CANCEL, 1 for DISPENSE_MSG_DISPENSE + @return: (int) 1 if successful, zero otherwise + """ + sample = integer_to_bytearray(cmd) + payload = sample + + message = DenaliMessage.build_message(channel_id=DenaliChannels.hd_to_dg_ch_id, + message_id=MsgIds.MSG_ID_HD_SEND_RO_PERMEATE_SAMPLE_DISPENSE_REQUEST_TO_DG.value, + payload=payload) + + self.logger.debug("Sending RO permeate sample dispense request") + + # 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 + + def cmd_hd_send_chem_flush_sample_result(self, result: int = 0): + """ + Constructs and sends the HD chem flush sample result. + + @param result: (int) - 0 for sample fail, 1 for sample pass + @return: (int) 1 if successful, zero otherwise + """ + res = integer_to_bytearray(result) + payload = res + + message = DenaliMessage.build_message(channel_id=DenaliChannels.hd_to_dg_ch_id, + message_id=MsgIds.MSG_ID_HD_SEND_CHEM_FLUSH_SAMPLE_PASS_FAIL_TO_DG.value, + payload=payload) + + self.logger.debug("Sending Chem flush sample result") + + # 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