btleplug icon indicating copy to clipboard operation
btleplug copied to clipboard

Handle encryption/bonding

Open Roughsketch opened this issue 3 years ago • 5 comments

I hope I'm not missing anything, but I'm unable to find how to do this at the very least.

I am trying to access a certain characteristic of a device (specifically Polar H10's "Control Point" characteristic), but am unable to since I just get back an insufficient encryption error. After lots of googling and looking at Polar's SDK, I am pretty sure I need to bond with the device to setup encryption before reading/writing to that characteristic. The problem is I don't see a way to do that in this library. I'm also not sure if there's a way to handle this externally since I think it requires the library to handle the encrypted communication.

Is there a workaround, plan to include/not include, or just some method I've missed to do this?

Roughsketch avatar Dec 19 '21 07:12 Roughsketch

Have you tried bonding the device with your OS first? That usually does the trick, we don't normally handle bonding inside the library.

qdot avatar Dec 19 '21 07:12 qdot

I'm on Windows 10 so I went to bluetooth settings and paired with it, but it doesn't seem to change the output of the program.

image

Roughsketch avatar Dec 19 '21 07:12 Roughsketch

And just to be clear in case I'm doing something else wrong, specifically what I'm doing is writing two bytes to the device and then getting back a longer response that I believe maps to insufficient encryption. I haven't had any hard confirmation of it besides the first byte matches that error code in several docs I've come across.

Basically: Write [2, 0] (Start monitoring Ecg) Read [15, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] (15 matches Insufficient Encryption, not sure about rest).

Roughsketch avatar Dec 19 '21 07:12 Roughsketch

@Roughsketch What kinda bluetooth dongle/radio are you using? Broadcomm, CSR, Intel, RealTek, etc?

qdot avatar Dec 20 '21 01:12 qdot

From device settings it looks like Intel. I have two to work with, one on my desktop and one on my laptop but both are on the motherboard. I also have a dongle for my old desktop I just updated from, but I don't use it currently. The device I'm using connects fine to Windows and shows up as paired on desktop/laptop, but I continue getting the same [15, 5, 0, ...] response. Is there any way to debug this on my end?

Also the device itself is sort of a black box with an SDK I'm referencing, so if it sounds like this may not be BLE protocol related let me know. I don't want to steal your time on a specific side issue.

Roughsketch avatar Dec 21 '21 00:12 Roughsketch