Does Pairing imply connecting?

My Peripheral device (nrf Connect SDK, nrf52840) will pair using NFC with an Android (8.0.0) phone.  But although the Nordic device shows it is connected (in its UART output), the phone does not show connected.

If I hit 'Connect' on the phone, it will connect and discover services and everything looks normal, otherwise, if I walk away with the phone, then the Peripheral disconnects.

Is this normal behavior?  I would expect that pairing implies connecting--it certainly did for the Peripheral side.

Am I missing some thing my app should do to continue on to connecting?

Here's my debug log:

field-ON
T2T-Read
field-Off
Gateway 0x20006630 Peripheral Connected 7D:D0:29:76:95:EC (random)
[00:00:14.152,862] 1;33m<wrn> bt_hci_core: opcode 0x200a status 0x09
[00:00:14.152,923] <dbg> bt_smp: bt_smp_accept: conn 0x20006630 handle 5
[00:00:14.152,923] <dbg> bt_smp: bt_smp_connected: chan 0x20006c5c cid 0x0006
[00:00:14.153,350] <dbg> bt_smp: smp_send_security_req:
[00:00:14.153,900] <dbg> bt_smp: smp_init: prnd e71eb66673775d5e7b6600237c1358ba
[00:00:14.302,368] <dbg> bt_smp: bt_smp_recv: Received SMP code 0x01 len 6
[00:00:14.302,368] <dbg> bt_smp: smp_pairing_req:
[00:00:14.594,757] <dbg> bt_smp: bt_smp_recv: Received SMP code 0x0c len 64
[00:00:14.594,757] <dbg> bt_smp: smp_public_key:
[00:00:14.620,971] <dbg> bt_smp: bt_smp_dhkey_ready: 0x2000f39b
[00:00:14.771,148] <dbg> bt_smp: bt_smp_recv: Received SMP code 0x04 len 16
[00:00:14.771,179] <dbg> bt_smp: smp_pairing_random:
[00:00:14.823,669] <dbg> bt_smp: bt_smp_recv: Received SMP code 0x0d len 16
[00:00:14.823,669] <dbg> bt_smp: smp_dhkey_check:
[00:00:14.823,730] <dbg> bt_smp: smp_f5: w 55d6824c3ffd1a1b1d9f24c1f069f5f59ddb778b691f6708875abd3a4b32491f
[00:00:14.823,760] <dbg> bt_smp: smp_f5: n1 2087ff8c8d8afc213a0d0d97794fdfeb
[00:00:14.823,791] <dbg> bt_smp: smp_f5: n2 77354d61b3477af844ad24d2f7740049
[00:00:14.824,493] <dbg> bt_smp: smp_f5: t 3e8a796166940e59fba4ad60576e7052
[00:00:14.825,561] <dbg> bt_smp: smp_f5: mackey cf446ecf1c5c69a1bee6fa3d9e0f0d07
[00:00:14.826,660] <dbg> bt_smp: smp_f5: ltk a8be53dcba3590405f09c32df6760928
[00:00:14.826,690] <dbg> bt_smp: smp_f6: w 070d0f9e3dfae6bea1695c1ccf6e44cf
[00:00:14.826,721] <dbg> bt_smp: smp_f6: n1 77354d61b3477af844ad24d2f7740049
[00:00:14.826,751] <dbg> bt_smp: smp_f6: n2 2087ff8c8d8afc213a0d0d97794fdfeb
Security changed: 7D:D0:29:76:95:EC (random) level 4
[00:00:15.004,943] <dbg> bt_smp: smp_pairing_complete: status 0x0

Parents
  • Hello,

    What do you mean by

    the phone does not show connected

    Are you talking about Bluetooth settings in Android Settings, or in your app you're not getting STATE_CONNECTED?

    Try nRF Connect app for Android.:

    1. Open nRF Connect, go to Menu -> Configure GATT Server -> in the top drop down select any configuration - can be Sample or a new one, even empty) - this will enable GATT Server in nRF Connect - the app will be listening to incoming notifications

    2. Having nRF Connect open - connect to your device (using NFC)

    3. The device should start connecting / pairing - you should see a new tab for the device showing up in nRF Connect.

    4. You should be able to communicate with the device now.

    You may also launch nRF Connect after the pairing when you believe your device is connected. It should also discover active connection and open the new tab.

    In order to receive similar functionality in your app (get an event when a device connects) you may either open GATT server or listen to ACL_CONNECTED broadcasts.

    Please, try this and come back to us.

  • BluetoothGatt object is a virtual connection only. You may have multiple virtual connections active to the same physical device. You may disconnect each of them separately, but the physical connection (maintained by the OS) will be only terminated when the last virtual connection is closed. Other apps (like nRF Connect, Android Settings) may also be connected to the same BLE device, having their own virtual connections.

    What you may observe, if I understand correctly, is that Android did connect and pair and holds a virtual connection to the device, but you will not get any connection state event in your BluetoothGattCallback. However, if you have the server open, the BluetoothGattServerCallback will receive state change events whenever a device disconnects or reconnects.

Reply
  • BluetoothGatt object is a virtual connection only. You may have multiple virtual connections active to the same physical device. You may disconnect each of them separately, but the physical connection (maintained by the OS) will be only terminated when the last virtual connection is closed. Other apps (like nRF Connect, Android Settings) may also be connected to the same BLE device, having their own virtual connections.

    What you may observe, if I understand correctly, is that Android did connect and pair and holds a virtual connection to the device, but you will not get any connection state event in your BluetoothGattCallback. However, if you have the server open, the BluetoothGattServerCallback will receive state change events whenever a device disconnects or reconnects.

Children
No Data
Related