Index: tests/test_hd_records.py =================================================================== diff -u -ra2cdbc7e007c6bd73e12344b4c89356a20b53f4f -rab49c2b2e6bd03745f5a910780791d4b18000fd1 --- tests/test_hd_records.py (.../test_hd_records.py) (revision a2cdbc7e007c6bd73e12344b4c89356a20b53f4f) +++ tests/test_hd_records.py (.../test_hd_records.py) (revision ab49c2b2e6bd03745f5a910780791d4b18000fd1) @@ -1,6 +1,8 @@ import sys +import struct sys.path.append("..") from dialin.hd.hemodialysis_device import HD +from dialin.utils.utils import Utils from time import sleep @@ -13,36 +15,45 @@ sleep(2) cal = hd.calibration_record + utilities = Utils() - print(cal.hd_calibration_record) + sys = hd.system_record - #cal.hd_calibration_record['pumps']['bp']['pwm_to_speed'][1] = 17.0 - #print(cal.hd_calibration_record) - status = False + 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() + #cal.get_hd_calibration_record() + sys.get_hd_system_record() while True: sleep(0.2) - #print(cal.current_message, cal.total_messages, cal.cal_data) + #print(cal.current_message, cal.total_messages, cal.sys_data) - if cal.cal_data != 0: - #f.write(str(cal.cal_data) + '\r') - dara.append(cal.cal_data) + if sys.sys_data != 0: + #f.write(str(cal.sys_data) + '\r') + #dara.append(cal.sys_data) - if cal.current_message == cal.total_messages: + if sys.current_message == sys.total_messages: #f.close() break else: - cal.set_hd_calibration_record() + #cal.set_hd_calibration_record() + sys.set_hd_system_record() - print(cal.hd_calibration_record) + #print(cal.hd_calibration_record) + print(sys.hd_system_record) except KeyboardInterrupt: #f.close() pass - - #cal.set_hd_calibration_record() \ No newline at end of file