########################################################################### # # Copyright (c) 2021-2022 Diality Inc. - All Rights Reserved. # # THIS CODE MAY NOT BE COPIED OR REPRODUCED IN ANY FORM, IN PART OR IN # WHOLE, WITHOUT THE EXPLICIT PERMISSION OF THE COPYRIGHT OWNER. # # @file test_dg_records.py # # @author (last) Dara Navaei # @date (last) 12-Oct-2021 # @author (original) Dara Navaei # @date (original) 01-Mar-2021 # ############################################################################ from dialin.dg.dialysate_generator import DG from time import sleep def process_calibration_record(read=False): cal = dg.calibration_record print(cal.dg_calibration_record) try: if read: cal.cmd_request_dg_calibration_record() while True: sleep(0.5) if cal.cal_data != 0: #if cal.is_reading_record_done(): sleep(4) break else: cal.cmd_set_dg_calibration_record() print(cal.dg_calibration_record) except KeyboardInterrupt: pass def process_system_record(read=False): sys = dg.system_record print(sys.dg_system_record) try: if read: sys.get_dg_system_record() while True: sleep(0.5) if sys.is_reading_record_done(): if sys.is_reading_record_done(): break else: sys.set_dg_system_record() print(sys.dg_system_record) except KeyboardInterrupt: pass def process_service_record(read=False): sys = dg.service_record print(sys.dg_service_record) try: if read: sys.get_dg_service_record() while True: sleep(0.5) if sys.is_reading_record_done(): if sys.is_reading_record_done(): break else: sys.set_dg_service_record() print(sys.dg_service_record) except KeyboardInterrupt: pass if __name__ == "__main__": # Create an instance of the DG Class dg = DG(log_level='DEBUG') if dg.cmd_log_in_to_dg() == 0: exit(1) sleep(2) """ dg.calibration_record.cmd_request_dg_calibration_record() sleep(5) dg.calibration_record.cmd_set_dg_calibration_record(dg.calibration_record.dg_calibration_record) sleep(5) dg.calibration_record.cmd_request_dg_calibration_record() sleep(5) dg.calibration_record.cmd_set_dg_calibration_record(dg.calibration_record.dg_calibration_record) sleep(5) """ #process_calibration_record(read=True) #process_system_record(read=True) #process_service_record(read=False)