openyou / libomron

Libraries for accessing data from Omron medical devices
http://qdot.github.com/libomron
Other
93 stars 30 forks source link

HJ720IT pedometer daily data #10

Closed smw1218 closed 13 years ago

smw1218 commented 13 years ago

Hi,

I managed to add the code for the daily data. I changed the struct a bit because the time is actually just for aerobic steps, not daily total. I figure this shouldn't break anyone since the data wasn't filled in anyway (and you're pre 1.0 anyway ;)

I have the device and I tested in in Mac OS 10.6 and it seems to be working. I will test Linux as well later tonight. I will probably also push some test code later as well. This is my first pull request so I hope this is right. If you need any other help with the pedometer code, I'm happy to help.

Thanks, Scott White

smw1218 commented 13 years ago

My branch has fixes for numerous pedometer bugs with the format, includes all the data read by the windows client and includes a delete flag. I've now been using it exclusively for months and the data appears to be 100% correct. I still occasionally get a hang in some of the lower level IO code on Mac OS. Killing the csv read and trying again almost always works the second time. I tried adding a sleep which seems to help, but not completely eliminate this issue. I think when reads happen too fast there are data errors and the internal state machine gets out of sync with the code's expectations.

Sample Process says things like:

Call graph: 862 Thread_331974 DispatchQueue_1: com.apple.main-thread (serial) 862 start 862 main 862 omron_get_device_version 862 omron_dev_info_command 862 omron_exchange_cmd 862 omron_check_mode 862 omron_send_clear 862 omron_read_data 862 libusb_bulk_transfer 862 do_sync_bulk_transfer 862 libusb_handle_events 862 libusb_handle_events_timeout 862 handle_events 862 poll

Call graph: 2612 Thread_591409 DispatchQueue_1: com.apple.main-thread (serial) 2612 start 2612 main 2612 omron_get_pd_hourly_data 2612 omron_exchange_cmd 2612 omron_get_command_return 2612 omron_read_data 2612 libusb_bulk_transfer 2612 do_sync_bulk_transfer 2612 libusb_handle_events 2612 libusb_handle_events_timeout 2612 handle_events 2612 poll 2612 Thread_591412 2612 thread_start 2612 _pthread_start 2612 event_thread_main 2612 CFRunLoopRun 2612 CFRunLoopRunSpecific 2612 __CFRunLoopRun 2612 mach_msg 2612 mach_msg_trap 2612 Thread_591413 DispatchQueue_2: com.apple.libdispatch-manager (serial) 2612 start_wqthread 2612 _pthread_wqthread 2612 _dispatch_worker_thread2 2612 _dispatch_queue_invoke 2612 _dispatch_mgr_invoke 2612 kevent

Call graph: 2600 Thread_196532 DispatchQueue_1: com.apple.main-thread (serial) 2600 start 2600 main 2600 omron_get_device_version 2600 omron_dev_info_command 2600 omron_exchange_cmd 2600 omron_check_mode 2600 omron_send_clear 2600 omron_read_data 2600 libusb_bulk_transfer 2600 do_sync_bulk_transfer 2600 libusb_handle_events 2600 libusb_handle_events_timeout 2600 handle_events 2600 poll 2600 Thread_196537 2600 thread_start 2600 _pthread_start 2600 event_thread_main 2600 CFRunLoopRun 2600 CFRunLoopRunSpecific 2600 __CFRunLoopRun 2600 mach_msg 2600 mach_msg_trap 2600 Thread_196538 DispatchQueue_2: com.apple.libdispatch-manager (serial) 2600 start_wqthread 2600 _pthread_wqthread 2600 _dispatch_worker_thread2 2600 _dispatch_queue_invoke 2600 _dispatch_mgr_invoke 2600 kevent

qdot commented 13 years ago

All merged. May have to go in and fix the unistd thing in the CSV util, since that'll kill windows compatibility, but for now, eh. Thanks for much for the additions, I'll add you to the credits and all. :)

smw1218 commented 13 years ago

Thanks! I had fun hacking on it and I'm very appreciative of your reverse engineering effort.

I can get rid of the unistd stuff, i suppose i can parse a single "-d" without using getopt ;) i didn't even think about the windows compatibility.