########################################################################### # # Copyright (c) 2021-2024 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) 18-Jan-2023 # @author (original) Dara Navaei # @date (original) 20-Jul-2021 # ############################################################################ import copy import pprint import subprocess 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 dialin.dg.sw_configs import DGSWConfigs from time import sleep """ def process_calibration_record(read=False): dg = DG() 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("