jlennox / HeartRate

Bluetooth heart rate monitor
MIT License
109 stars 35 forks source link

Bluetooth Documentation and H10 issue #45

Open primem0ver opened 1 year ago

primem0ver commented 1 year ago

Hi, I just downloaded this because I got an Polar H10 to monitor heart rate during sleep (sleep apnea, just got APAP). Unfortunately the app that comes with the hardware doesn't allow me to do that. So I found this. However, I am getting "Unable to locate heartrate device. Ensure it is connected and paired." According to my settings and list of blue tooth devices, both of these are true (though it does occasionally lose connection as mentioned. Shows up as Polar H10 AFEF5B26). I am wondering what I am doing wrong. First time using c# with bluetooth. I am a decent c# programmer who might add functionality to this if I can figure out how to read bluetooth stuff so if you could just point me in the right direction it would be appreciated. However, your link in the HeartRateService file is no longer valid.

jlennox commented 1 year ago

Boy. Unfortunately a lot of bluetooth errors are massive black holes. I really wish I knew of better means to help diagnose what's happening.

If it's happening inside the monitoring program, %appdata%\HeartRate\log.txt may offer some insight.

To give a fast rundown on what it does for device selection:

Perhaps messing around with InitiateDefaultCore can give some insight.

Perhaps messing around with some of https://social.msdn.microsoft.com/Forums/en-US/58da3fdb-a0e1-4161-8af3-778b6839f4e1/bluetooth-bluetoothledevicefromidasync-does-not-complete-on-10015063?forum=wdk can help?

Let me know if I can be of any help.

primem0ver commented 1 year ago

Yeah... I saw parts of that post earlier because of your registry fix suggestion. Tried it and it didn't work. I suppose I could try some of the other recommendations in that thread like CoInitializeSecurity. Only problem is that I don't know what this string refers too (""O:BAG:BAD:(A;;0x7;;;PS)(A;;0x3;;;SY)(A;;0x7;;;BA)(A;;0x3;;;AC)(A;;0x3;;;LS)(A;;0x3;;;NS)").

Plus... I am not entirely clear exactly what the AppID is in the registry instructions. Here is a copy of what (the reg file) I added to my registry:

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\AppID{C6BFD646-3DF0-4DE5-B7AF-5FFFACB844A5}] @="Winforms Application" "AccessPermission"=hex:01,00,04,80,9C,00,00,00,AC,00,00,00,00,00,00,00,14,00,\ 00,00,02,00,88,00,06,00,00,00,00,00,14,00,07,00,00,00,01,01,00,00,00,00,00,\ 05,0A,00,00,00,00,00,14,00,03,00,00,00,01,01,00,00,00,00,00,05,12,00,00,00,\ 00,00,18,00,07,00,00,00,01,02,00,00,00,00,00,05,20,00,00,00,20,02,00,00,00,\ 00,18,00,03,00,00,00,01,02,00,00,00,00,00,0F,02,00,00,00,01,00,00,00,00,00,\ 14,00,03,00,00,00,01,01,00,00,00,00,00,05,13,00,00,00,00,00,14,00,03,00,00,\ 00,01,01,00,00,00,00,00,05,14,00,00,00,01,02,00,00,00,00,00,05,20,00,00,00,\ 20,02,00,00,01,02,00,00,00,00,00,05,20,00,00,00,20,02,00,00

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\AppID\HeartRate.exe] "AppID"="{C6BFD646-3DF0-4DE5-B7AF-5FFFACB844A5}"

primem0ver commented 1 year ago

Ooops. I forgot to mention that there really isn't much in the log. Just this: 11/15/2022 9:08:57 PM: Starting up 11/15/2022 9:08:57 PM: Loading from D:\Users\Matthew\AppData\Roaming\HeartRate\settings.xml 11/15/2022 9:08:57 PM: Saving to D:\Users\Matthew\AppData\Roaming\HeartRate\settings.xml 11/15/2022 9:09:08 PM: Restarting services...

FlameSoulis commented 1 year ago

Not a Polar H10 (CooSpo), but noticed the same issues around the same time. Log file included.

Can confirm that the registry thing doesn't seem to fix the issue, AND I have noticed this also occurring for YUR and Cardia, with Cardia only listing "Windows.Devices.Enumeration.DeviceInformation" as the only device. Not sure if this helps at all.

logs.txt

FlameSoulis commented 1 year ago

Update: After running a Windows update, it seems to have resolved everything. It sounds like certain updates can cause issues with BTLE devices in general.