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

bonding #605

Closed
don opened this issue Jun 13, 2018 · 5 comments
Closed

bonding #605

don opened this issue Jun 13, 2018 · 5 comments
Assignees
Milestone

Comments

@don
Copy link
Owner

don commented Jun 13, 2018

Adding support for bonding has been a feature request. This can be implement on Android. There are no APIs on iOS. Adding some implementation notes so they don't get lost.

ble.createBond(deviceId, success, failure)
BluetoothDevice.createBond returns immediately. Need to add an intent filter for BluetoothDevice.ACTION_BOND_STATE_CHANGED and register a broadcast receiver.

Bond state change notifications could be sent to the success callback or we could make the user register another listener ble.startBondStateChangeNotifications which could send the MAC address and the bonding state. It's a cleaner Javascript API if the plugin handles the bond state change notifications and sends them to the success callback of create bond.

Assume the OS will handle the pin negotiation. Revisit when that's not good enough.

ble.getBondedState(deviceId, success, failure)
Returns BOND_NONE, BOND_BONDING, BOND_BONDED to the success callback

The peripheral JSON should be modified to include the bonded state.

BluetoothDevice does not have a public unbond method.

@imaginae
Copy link

imaginae commented Jul 5, 2019

Hi @don, did you finally work on createBond? There are problems coming when boards are pin protected... We are trying to override plugin with a setPin method, but we have not success so far on using this method to avoid errors on write. On android v7 and 8, password popup coming from android os not working properly... Regards

@don
Copy link
Owner Author

don commented Oct 18, 2019

@imaginae I have not worked on this. Perhaps you can bond the device outside of the app then use ble.bondedDevices()?

@imaginae
Copy link

imaginae commented Oct 21, 2019 via email

@don
Copy link
Owner Author

don commented Oct 21, 2019

That'd be great if you could submit a pull request with your updates.

peitschie added a commit to peitschie/cordova-plugin-ble-central that referenced this issue Apr 14, 2021
@peitschie peitschie self-assigned this Nov 16, 2021
peitschie added a commit to peitschie/cordova-plugin-ble-central that referenced this issue Feb 16, 2023
peitschie added a commit to peitschie/cordova-plugin-ble-central that referenced this issue Feb 16, 2023
peitschie added a commit to peitschie/cordova-plugin-ble-central that referenced this issue Feb 16, 2023
peitschie added a commit to peitschie/cordova-plugin-ble-central that referenced this issue Feb 18, 2023
peitschie added a commit that referenced this issue Feb 18, 2023
Implement createBond/getBondState on Android (#605)
@peitschie peitschie added this to the next milestone Feb 18, 2023
@peitschie
Copy link
Collaborator

Feature has been implemented in 1.6.3

@peitschie peitschie modified the milestones: next, 1.6.3 Feb 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants