3

I want to pair my Android cellphone with a BLE device using createBond and setPin as in this StackOverflow question.

I'm using a TI SensorTag, and I am able to get it to connect, but I want to get it to bond so that I don't have to scan for it later.

Unfortunately, when I use createBond (or when I try to pair through Android Bluetooth Settings), my phone wants a PIN. I have not been able to find the PIN online, and some people I've asked say that BLE devices can't bond (that they only use the Just Works method). Does anyone know the SensorTag PIN, where to find it, or whether I'm just completely off base?

Community
  • 1
  • 1
Zatricion
  • 142
  • 1
  • 2
  • 8
  • No as per my knowledge you can not Bond bluetooth low energy device as it works on profile mechanism. Not like traditional core bluetooth devices. – user370305 Feb 28 '14 at 11:43
  • Let me know if you find any additional info. Thanks. – user370305 Feb 28 '14 at 11:46
  • 4
    According to [nordic](https://devzone.nordicsemi.com/documentation/nrf51/5.0.0/html/ble_pairing_guide.html), you can definitely bond BLE devices – Zatricion Mar 01 '14 at 18:26
  • 1
    @Zatricion, your link is dead. Do you have an alternate link? – Mike Holler Dec 15 '14 at 22:48
  • 1
    @MikeHoller I don't know if this is the same link, but it is all I could find. https://devzone.nordicsemi.com/documentation/nrf51/5.2.0/html/a00138.html – Zatricion Dec 19 '14 at 01:40

4 Answers4

1

My experience with the TI SensorTag data using Android is that it does not bond. The TI SensorTag uses the Just Works BLE method.

This is the sequence I use to communicate with the TI SensorTag, based on the information in http://developer.android.com/guide/topics/connectivity/bluetooth-le.html

  1. press the button on the SensorTag. This will cause it to listen for Scan requests.
  2. call startLeScan(). Wait for callback.
  3. in your onLeScan() callback, save the device of the discovered TISensorTag.
  4. On the UI thread, call device.connectGatt() and wait for callback.
  5. In your onConnectionStateChange(), call discoverServices() and wait for callback.
  6. In your onServicesDiscovered(), notify your UI thread that you are connected.
  7. In your UI thread, start a read of a GATT Characteristic with readCharacteristic(). Wait for callback.
  8. In your onCharacteristicRead(), call one of the getValue() methods.
  9. Call BluetoothGatt.close(). This call is important. If your app exits without calling close(), the Bluetooth Stack may become unusable and you will need to reboot your phone.
  • 3
    I'd like to either bond the device or in some way make it possible to connect without having to scan. In this [document](http://padovan.org/pub/bluetooth/bluetooth-security-article.pdf) it says that Just Works uses the same method as Numeric Comparison. Does that mean I could initiate a comparison with no data and get the devices to bond? – Zatricion Mar 03 '14 at 02:14
1

Android notwithstanding, BLE is a branch of Bluetooth 4.0 and, as such, should supporting pairing and bonding.

Technically, the "Just Works" method still implies bonding. However, in my experience it isn't necessary for both Android and iOS devices to connect and read from BLE devices that have authentication disabled.

Kevin
  • 1,829
  • 1
  • 21
  • 22
  • Calling of createbond() API works for BLE? I've issues in pairing. Will it show in the settings list that I've paired? Or am I trying something not possible/correct? – Ramya K Sharma Nov 17 '14 at 06:27
1

I make my phone bonded to 2540 peripheral, and the PIN is 00000000,eight 0s;I am not sure if it works on TI sensor Tag, you can try. And I also have a question, how I use A bonded device.

Wen Xing
  • 11
  • 2
0

I was able to bond the SensorTag with 000000 as PIN.

Ben
  • 258
  • 3
  • 11