Hello Guest, Welcome to Apnea Board !
As a guest, you are limited to certain areas of the board and there are some features you can't use.
To post a message, you must create a free account using a valid email address.

or Create an Account


New Posts   Today's Posts

Added a new pulse oximeter importer...
#71
RE: Added a new pulse oximeter importer...
On Mac, selecting the enclosing folder for oximetry works ONLY for Data > Import Viatom Data, not the oximetry wizard.

It's working for me with the OSCAR 1.1.1 on macOS. Maybe Catalina behaves differently?
Post Reply Post Reply
#72
RE: Added a new pulse oximeter importer...
A-a-a-a-a-a-a-a-a-g-h!!! I will edit my other post, again.
Crimson Nape
Apnea Board Moderator
www.ApneaBoard.com
___________________________________
Useful Links -or- When All Else Fails:
The Guide to Understanding OSCAR
OSCAR Chart Organization
Attaching Images and Files on Apnea Board
Apnea Helpful Tips

INFORMATION ON APNEA BOARD FORUMS OR ON APNEABOARD.COM SHOULD NOT BE CONSIDERED AS MEDICAL ADVICE. ALWAYS SEEK THE ADVICE OF A PHYSICIAN BEFORE SEEKING TREATMENT FOR MEDICAL CONDITIONS, INCLUDING SLEEP APNEA. INFORMATION POSTED ON THE APNEA BOARD WEB SITE AND FORUMS ARE PERSONAL OPINION ONLY AND NOT NECESSARILY A STATEMENT OF FACT.
Post Reply Post Reply
#73
RE: Added a new pulse oximeter importer...
Well, I have Bluetooth (BLE) transfers working under Linux.  The transfer protocol feels pretty kludge-y.  Basically under the 14839ac4-7d7e-415c-9a42-167340cf2339 service you need to subscribe to notifications on 0734594a-a8e7-4b1a-a6b1-cd5243059a57 and then write commands to 8b00ace7-eb0b-49b0-bbe9-9aee0a26e1a3.  All writes must be broken up into 20 byte blocks, and read blocks need to be stitched together.  I'll try to get my python app cleaned up in the next day or 2 and pushed to Github.

Code:
me@me:~/o2ring/o2r$ python3 main.py
Connecting...
Adding device c8:07:5f:xx:xx:xx
[c8:07:5f:xx:xx:xx] Discovered: O2Ring 45xx
[c8:07:5f:xx:xx:xx] New RSSI: -55
[c8:07:5f:xx:xx:xx] New RSSI: -62
[c8:07:5f:xx:xx:xx] Connected
Starting up for c8:07:5f:xx:xx:xx
[c8:07:5f:xx:xx:xx] Config:
{     'Application': '',
      'BootloaderVer': '1.0.0.0',
      'BranchCode': '24010000',
      'CurBAT': '100%',
      'CurBatState': '2',
      'CurMode': '0',
      'CurMotor': '40',
      'CurOxiThr': '80',
      'CurPedtar': '99999',
      'CurState': '0',
      'CurTIME': '2020-08-17,07:32:27',
      'FileList': '20200816085854,20200816203736,20200817033529,20200817045642,',
      'FileVer': '3',
      'HRHighThr': '125',
      'HRLowThr': '50',
      'HRSwitch': '0',
      'HardwareVer': 'AA',
      'LightStr': '0',
      'LightingMode': '0',
      'Model': '1652',
      'OxiSwitch': '0',
      'Region': 'CE',
      'SN': '20xxxx45xx',
      'SPCPVer': '1.3',
      'SoftwareVer': '1.4.0'}
[c8:07:5f:xx:xx:xx] File List is now ['20200816085854', '20200816203736', '20200817033529', '20200817045642']
[c8:07:5f:xx:xx:xx] Requesting File 20200816085854, saving to 20200816085854.o2r
[c8:07:5f:xx:xx:xx] File 20200816085854.o2r Opened, Size 25720 ------------------------------------|
|==================================================================================================|
[c8:07:5f:xx:xx:xx] Requesting File 20200816203736, saving to 20200816203736.o2r
[c8:07:5f:xx:xx:xx] File 20200816203736.o2r Opened, Size 9935 -------------------------------------|
|==================================================================================================|
[c8:07:5f:xx:xx:xx] Requesting File 20200817033529, saving to 20200817033529.o2r
[c8:07:5f:xx:xx:xx] File 20200817033529.o2r Opened, Size 4375 -------------------------------------|
|==================================================================================================|
[c8:07:5f:xx:xx:xx] Requesting File 20200817045642, saving to 20200817045642.o2r
[c8:07:5f:xx:xx:xx] File 20200817045642.o2r Opened, Size 130 --------------------------------------|
|==================================================================================================|
[c8:07:5f:xx:xx:xx] File Download Complete, Beginning 2-second Polling
[c8:07:5f:xx:xx:xx] O2 0, HR 0, HR Strength 0, motion 0, batt CHGD
[c8:07:5f:xx:xx:xx] O2 0, HR 0, HR Strength 0, motion 0, batt CHGD
[c8:07:5f:xx:xx:xx] O2 0, HR 0, HR Strength 0, motion 0, batt CHGD
[c8:07:5f:xx:xx:xx] O2 0, HR 0, HR Strength 0, motion 0, batt CHGD
[c8:07:5f:xx:xx:xx] O2 0, HR 0, HR Strength 0, motion 0, batt CHGD
[c8:07:5f:xx:xx:xx] O2 98, HR 74, HR Strength 27, motion 10, batt 100%-
[c8:07:5f:xx:xx:xx] O2 98, HR 74, HR Strength 27, motion 0, batt 100%-
[c8:07:5f:xx:xx:xx] O2 98, HR 74, HR Strength 27, motion 0, batt 100%-
[c8:07:5f:xx:xx:xx] O2 98, HR 74, HR Strength 27, motion 0, batt 100%-
[c8:07:5f:xx:xx:xx] O2 98, HR 75, HR Strength 27, motion 0, batt 100%-
[c8:07:5f:xx:xx:xx] O2 98, HR 76, HR Strength 27, motion 0, batt 100%-
[c8:07:5f:xx:xx:xx] O2 98, HR 77, HR Strength 11, motion 0, batt 100%-
[c8:07:5f:xx:xx:xx] O2 98, HR 76, HR Strength 12, motion 0, batt 100%-
[c8:07:5f:xx:xx:xx] O2 98, HR 74, HR Strength 14, motion 0, batt 100%-
[c8:07:5f:xx:xx:xx] O2 98, HR 73, HR Strength 16, motion 0, batt 100%-
Post Reply Post Reply
#74
RE: Added a new pulse oximeter importer...
Nice!

OSCAR doesn't yet have bluetooth support, but this sort of thing will make it a lot easier to add when we get there...and it might even move it up my priority list. Smile

How did you figure out the BLE protocol?
Post Reply Post Reply
#75
RE: Added a new pulse oximeter importer...
On Android under Developer options I enabled "Enable Bluetooth HCI snoop log" which created btsnoop_hci.log (in the root of Internal storage), and after doing a bunch of stuff in the ViHealth app I copied that file over to my PC (remember to disable Bluetooth before copying so it closes the file) and opened it in Wireshark.  Once I started to figure out what was going on, adding a filter such as "bluetooth.addr==c8:07:5f:xx:xx:xx && btatt.handle==0x17" really helps to zoom in to what the app is sending.

The only tricky part was figuring out the CRC.  As even a single 0 -> 1 change resulted in a completely different checksum, that ruled out simple algorithms such as adding the bytes together or XORing.  I ended up running variations of the data through various algorithms until I got a match (turned out to be the standard CRC-8-CCITT over the entire block).
Post Reply Post Reply
#76
RE: Added a new pulse oximeter importer...
It's still pretty rough and needs a *lot* of cleanup, but github.com/MackeyStingray/o2r
Post Reply Post Reply
#77
RE: Added a new pulse oximeter importer...
Looks pretty good!

Have you had a look at bleak as an alternative python module to use? It seems to be more cross-platform. I've been using it to talk to my BLE accelerometer...
Post Reply Post Reply
#78
RE: Added a new pulse oximeter importer...
Suffice to say, I'd be super psyched to see BT support in OSCAR.

Not only could that allow easier syncing of pulse ox data from devices like these, products like the Dreem headband also work via BTLE (though I'm unsure of the details of what data one might be able to pull out of it over BTLE).
Caveats: I'm just a patient, with no medical training.
Post Reply Post Reply
#79
RE: Added a new pulse oximeter importer...
About OSCAR...  I hate undescriptive file names, so I was saving the files as "O2Ring 45xx - YYYYMMDDHHMMSS.vld" (where 'O2Ring 45xx' is the Bluetooth device name).  I attempted to import a downloaded file into OSCAR only to realize it hardcodes the filename as YYYYMMDDHHMMSS and doesn't allow you to show all files.  It would be really nice if OSCAR would add "*.vld" (and *.*) as an option, but until then you can tell my program to download as that format with
Code:
python3 o2ring.py -e "" -p ""
Post Reply Post Reply
#80
RE: Added a new pulse oximeter importer...
Yes, right now it's filtering based on the canonical names exported by the Viatom software.

I was already considering changing that, since Windows can't support anything other than *.ext filters, which thus required the non-native Qt file dialog on the platform, and since I'm planning for the overhaul of the oximetry wizard to allow selecting any files and leaving OSCAR to figure out what oximeter they belong to.

So, that's on my radar.
Post Reply Post Reply


Possibly Related Threads...
Thread Author Replies Views Last Post
  csv-converter for like nx-8462 oximeter capman 1 150 03-15-2024, 04:45 AM
Last Post: capman
  thumbdrive-oximeter-format-analysis capman 6 194 03-15-2024, 04:29 AM
Last Post: capman
  CMS50F Oximeter Device not Recognized. ThinMountainAir 20 2,410 03-07-2024, 05:13 PM
Last Post: capman
  csv-format for generic oximeter imports into oscar capman 2 158 03-07-2024, 07:06 AM
Last Post: capman
  python file converter for EMAY sleep pulse oximeter joeblough 1 613 03-04-2024, 10:26 PM
Last Post: ElectricalPaul
  Need Computer drivers for Contec CMS50D+ Oximeter TomElgin 3 237 03-02-2024, 05:27 PM
Last Post: Crimson Nape
  OSCAR Reports do not appear to have O2 and Pulse Data SKPC 5 548 12-31-2023, 11:05 PM
Last Post: Crimson Nape


New Posts   Today's Posts


About Apnea Board

Apnea Board is an educational web site designed to empower Sleep Apnea patients.