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 sys = hd.system_record srv = hd.service_record utilities = Utils() #print(cal.hd_calibration_record) print(srv.dg_service_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.dg_system_record) #sys.dg_service_record['system_record']['top_level_pn'][1] = 'abcd-12345' #sys.dg_service_record['system_record']['mfg_date'][1] = utilities.get_current_time_in_epoch() #srv.dg_service_record['service_record']['service_date'][1] = utilities.get_current_time_in_epoch() status = True try: if status: dara = [] #cal.get_hd_calibration_record() #sys.get_hd_system_record() srv.get_dg_service_record() while True: sleep(0.2) #print(cal.current_message, cal.total_messages, cal.service_data) if srv.service_data != 0: #f.write(str(cal.service_data) + '\r') #dara.append(cal.service_data) if srv.current_message == srv.total_messages: #f.close() break else: #cal.set_hd_calibration_record() #sys.set_hd_system_record() srv.set_dg_service_record() #print(cal.hd_calibration_record) #print(sys.dg_system_record) print(srv.dg_service_record) except KeyboardInterrupt: #f.close() pass