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

Cannot preform multiple pairing #73

Closed
aardrasystems opened this issue Mar 17, 2021 · 5 comments
Closed

Cannot preform multiple pairing #73

aardrasystems opened this issue Mar 17, 2021 · 5 comments
Labels
bug Something isn't working

Comments

@aardrasystems
Copy link

aardrasystems commented Mar 17, 2021

I am not sure if I have found a bug or am I doing something wrong.

What I am trying to do is scan for my ble device, connect to it, start the pairing scheme(typing the in number) and once successful repeat the whole process again. The reason for repeating the process of pairing is incase my device was to fail for any given reason, a user would reset the device and start the pairing process again.

What I am experiencing is that once my device is paired, if I was to repeat the cycle again on my app, I am able to scan and see the device, but when I connect I do not get an option to retype the pin in this 2nd instance. But I was re repeat this process again, the pin input screen does appear. It seems that the screen appears every other time.

Is it possible to force the plugin to unpair a device?

This is my code
`
async ble_test(){
console.log("Starting BLE TEST");

try {

  await BleClient.initialize();


console.log('BLE INT');    
await BleClient.requestLEScan(
  {
   // services: [HEART_RATE_SERVICE],
   name:"3400-DEMO",
  },
  result => {
    console.log('received new scan result', result);     
    this.Azure.ble_device_id = result.device.deviceId;
    this.connecttodevice(this.Azure.ble_device_id);
  },
); 

setTimeout(async () => {
  await BleClient.stopLEScan();
  console.log('stopped scanning');
}, 5000);

} catch (error) {
console.error(error);
}
}
`

@aardrasystems aardrasystems added the bug Something isn't working label Mar 17, 2021
@pwespi
Copy link
Member

pwespi commented Mar 20, 2021

Which platform are you using? iOS? If yes, on iOS there is no API to handle bonding. It is performed automatically when accessing a characteristic that requires security. See e.g. https://devzone.nordicsemi.com/f/nordic-q-a/8507/getting-an-ios-central-app-to-bond

@aardrasystems
Copy link
Author

No I am testing on Android.
What I discovered, I need to manually unpair the device it I want re connect with pin screen. Is there anything in library to force a unpairing?

@pwespi
Copy link
Member

pwespi commented Apr 3, 2021

On Android, there is no public API for removeBond, see BluetoothDevice. So no, there is nothing in the library to force unbonding.

Also this plugin does not yet expose the createBond method on Android, see #50. So I don't even know how you managed to start the bonding process?

@aardrasystems
Copy link
Author

aardrasystems commented Apr 3, 2021

Hi

Maybe it could be my device, Once i start the pairing process, i get this pop up from the device requesting i enter the pin e..g 123456

Should the pairing process not start with this plugin?

Once i enter the pin, how can the plugin acknowledge this so that i can start sending data to the BLE device? At moment it seems i am able to connect to the device even before i have entered the correct pin.

@pwespi
Copy link
Member

pwespi commented Apr 10, 2021

createBond and isBondedhave been added for Android.

@pwespi pwespi closed this as completed Apr 10, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants