import sys import struct from dialin import HD, AbstractObserver sys.path.append("../") from dialin.dg.dialysate_generator import DG from dialin.utils.nv_ops_utils import NVOpsUtils from time import sleep def process_calibration_record(read=False): cal = dg.calibration_record print(cal.tmp_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(): break else: cal.cmd_set_dg_calibration_record() print(cal.tmp_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.cmd_request_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 def test_crc(): val = NVOpsUtils.crc_16(b''.join([ struct.pack("