import sys import struct sys.path.append("..") from dialin.hd.hemodialysis_device import HD from dialin.utils.utils import Utils from time import sleep if __name__ == "__main__": # create an HD object called hd hd = HD(log_level='DEBUG') if hd.cmd_log_in_to_hd() == 0: exit(1) sleep(2) cal = hd.calibration_record utilities = Utils() sys = hd.system_record #print(cal.hd_calibration_record) cal.hd_calibration_record['accelerometer_sensor']['accelerometer']['x_offset'][1] = 952.12 cal.hd_calibration_record['accelerometer_sensor']['accelerometer']['y_offset'][1] = 45.2 cal.hd_calibration_record['accelerometer_sensor']['accelerometer']['z_offset'][1] = 712.58 cal.hd_calibration_record['accelerometer_sensor']['accelerometer']['cal_time'][1] = utilities.get_current_time_in_epoch() print(sys.hd_system_record) #sys.hd_system_record['system_record']['top_level_pn'][1] = 'abcd-12345' #sys.hd_system_record['system_record']['mfg_date'][1] = utilities.get_current_time_in_epoch() status = True try: if status: dara = [] #cal.get_hd_calibration_record() sys.get_hd_system_record() while True: sleep(0.2) #print(cal.current_message, cal.total_messages, cal.sys_data) if sys.sys_data != 0: #f.write(str(cal.sys_data) + '\r') #dara.append(cal.sys_data) if sys.current_message == sys.total_messages: #f.close() break else: #cal.set_hd_calibration_record() sys.set_hd_system_record() #print(cal.hd_calibration_record) print(sys.hd_system_record) except KeyboardInterrupt: #f.close() pass