Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for bonding #111

Open
DoruAdryan opened this issue Jun 9, 2021 · 23 comments · May be fixed by #494
Open

Support for bonding #111

DoruAdryan opened this issue Jun 9, 2021 · 23 comments · May be fixed by #494

Comments

@DoruAdryan
Copy link

DoruAdryan commented Jun 9, 2021

Is there a plan for supporting bonding (pairing) with a bluetooth device gracefully? I think that at connect() time or later on, when reading / writing a characteristic (which could respond with INSUFFICIENT_AUTHENTICATION) would have to do it.
I saw that Advertisement has a BondState property.

@twyatt
Copy link
Member

twyatt commented Jun 9, 2021

It isn't on the short-term roadmap but I've been trying to prioritize GitHub issues by the number of 👍  they have. So, if there are others who also need this feature (and "up vote" it) then I'd be happy to tackle it sooner rather than later.

Long-term I would like to support it, so it will come eventually. Also happy to accept PRs. 😉

@twyatt

This comment was marked as outdated.

@twyatt

This comment was marked as outdated.

@DoruAdryan
Copy link
Author

DoruAdryan commented Jul 25, 2021

There are multiple medical devices that I've come across requiring pairing:
Thermometer (requires pairing at reading measurements stage, not when connecting to it),
Pulse Oximeter
but as mentioned in those articles you posted, the pairing process could be started by the OS at different moments of communication to the bluetooth device, answering with GATT_STATUS - INSUFFICIENT_AUTHENTICATION or GATT_INSUFFICIENT_ENCRYPTION.

@twyatt

This comment was marked as outdated.

@WildStudio
Copy link

WildStudio commented Oct 25, 2021

Hey @twyatt any real advance on this? I would suggest acquiring a stater kit like the one silicon labs have: https://www.silabs.com/development-tools/wireless/bluetooth/bgx220p-bluetooth-xpress-starter-kit
Do you think you need some support on this?

@twyatt

This comment was marked as outdated.

@twyatt
Copy link
Member

twyatt commented Oct 25, 2021

I would suggest acquiring a stater kit like the one silicon labs have: https://www.silabs.com/development-tools/wireless/bluetooth/bgx220p-bluetooth-xpress-starter-kit

@WildStudio Does the starter kit support BLE bonding out-of-the-box, or does it have to be programmed/configured for bonding?

@SkyleKayma
Copy link

Has there been any progress on this part one year later ?
I don't think this has been implemented, or else I missed it.
It's the only thing currently preventing me from using this lib, even though it's really great!

@twyatt

This comment was marked as outdated.

@SkyleKayma
Copy link

Whenever I've done pairing it's by using the Nordic library (https://github.com/NordicSemiconductor/Android-BLE-Library), I've never implemented it from scratch. So I may not be in the best position to provide a test sample.
But I will continue to follow this library and its development closely.

@twyatt
Copy link
Member

twyatt commented Dec 5, 2022

It has recently come up that we may have a need for bonding internally. Meaning that this may end up on our team's project roadmap (so I'd be able to allocate a lot of time to this effort). 🤞

I'm not certain of timelines, but I'm hopeful the effort kicks off sometime in first half of 2023.

@medmaadellaoui
Copy link

Hello @twyatt, Just wondering, how's that feature coming along 😃 ?

@twyatt
Copy link
Member

twyatt commented Jun 3, 2023

Just wondering, how's that feature coming along 😃 ?

I just last week researched what typical Android bonding looks like, here are some great articles I came across:

...that is to say: sorry it has taken so long, but I have finally started on this. Thanks for your patience. ❤️

@twyatt twyatt linked a pull request Jun 4, 2023 that will close this issue
@twyatt
Copy link
Member

twyatt commented Jun 5, 2023

I have a completely untested implementation (#494), based on the great articles I linked. Although I don't (yet) have any devices to test it against.

I have a Beurer PO60 Pulse Oximeter but getting the BLE working on it was super wonky (I ultimately gave up). Additionally, according to this, it doesn't require bonding anyways. 🤷

Does anyone have some recommendations of devices that:

  • require bonding out-of-the-box
  • are simple to setup (BLE just works — no need to flash specific firmware)
  • is affordable

Thank you!

@YSDC
Copy link

YSDC commented Jun 26, 2023

Any update on this? Our company would like to use your library but bonding is a key requirement.

@twyatt
Copy link
Member

twyatt commented Jun 26, 2023

@YSDC do you happen to know of a publicly available (and affordable) device that requires/supports bonding? Or, is the product your company is wanting to developer for available for use as something I can develop against?

The only blocker at this point is me getting a device I can test #494 against.

@DoruAdryan
Copy link
Author

Mentioned a couple of devices that requires bonding with different behaviors here

@twyatt
Copy link
Member

twyatt commented Jun 26, 2023

Mentioned a couple of devices that requires bonding with different behaviors here

Yes, thanks for those recommendations @DoruAdryan!

Unfortunately I could not get the bluetooth on the Beurer PO60 Pulse Oximeter working (the guides in the official app were terrible — could not even get it connected in their app). If you happen to know how to enable bluetooth on that device, then I'll give it another try.

I didn't get very far with the Beurer Thermometer either, as it was difficult to find documentation on how to communicate with it over bluetooth (i.e. what are its characteristic UUIDs, what does the data format look like to communicate with it, etc?).

I was hoping to have a device that was a little more developer friendly (specifically, better documentation) but I'll go back to reverse engineering it if no better device options come up.

@CristianMG
Copy link

CristianMG commented Sep 6, 2023

Hi @twyatt

I'm checking these modifications on my own. The first problem I'm facing is that 'onCharacteristicRead' inside the callback is not firing. It seems like Android is waiting for pairing because my device requires pairing from the initial connection. Maybe this behavior only occurs with devices that require pairing at the initial connection, and not with devices that only require pairing for some protected characteristics.

Perhaps we should add a function to wait for pairing or consider giving access to the bonding state from an external part and keeping that responsibility outside of this library.

Added to this I'm clear code and merge with the main in my own pull request, the broadcast ACTION_BOND_STATE_CHANGED have a problem because is not called. Can you check this?

https://github.com/CristianMG/kable/tree/feature/bonding_v2

as you can see, I have modified some problematic code.

Greetings

@twyatt
Copy link
Member

twyatt commented Sep 6, 2023

Hi @CristianMG, is the peripheral you're working with publicly available?

If not, are you able to provide me with one so that I can test the bonding support against it?
Feel free to reach out to me directly on the Kotlin Slack, user @travis.

@kdkoyamatsu
Copy link

Hello @twyatt, just wanted to check-in and see how this effort was coming along. Bonding support would be an essential requirement.

@twyatt
Copy link
Member

twyatt commented May 7, 2024

Hello @twyatt, just wanted to check-in and see how this effort was coming along. Bonding support would be an essential requirement.

@kdkoyamatsu, the only hold up at this time is that I don't have a device that requires bonding to test against (to complete development of #494).

If you're aware of a publicly available BLE device that requires bonding and has API documentation (i.e. something to reference to spin up a test app for BLE communication) then I'll gladly purchase it to continue development.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

8 participants