This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Can't read or write characteristic that uses BLE_GAP_CONN_MODE_SET_ENC_NO_MITM

I have an nRF51822 based peripheral running SD 7.0.0, using SDK 6.0.0. It has a custom (vendor specific) characteristic which is read/write.

If I use BLE_GAP_CONN_MODE_SET_OPEN for the characteristic, I can read and write the value for it from an Android app (central) just fine. If I switch to BLE_GAP_CONN_MODE_SET_ENC_NO_MITM, when trying to read the characteristic, bonding happens as expected as far as I can tell from the Sniffer/Wireshark log, and there's no error on the Android app side. But I never get the callback to onCharactersiticRead() in the app.

Here's my Wireshark log: cant_read_chara_with_enc_no_mitm.pcapng

Parents
  • Although as Ulrich mentioned I should be able to read a characteristic that requires bonding and have bonding happen reactively, that's not what I'm seeing in the Android L developer preview. So I've elected to bond with the peripheral explicitly by calling BluetoothDevice.createBond().

    I do this right after service discovery, when I'm already connected to the device and connected to the GATT server. Later on, before I read or write any characteristics that use BLE_GAP_CONN_MODE_SET_ENC_NO_MITM, I first check the bond state on the device and make sure I'm bonded. I'd expect to only have to call createBond() once in any case.

Reply
  • Although as Ulrich mentioned I should be able to read a characteristic that requires bonding and have bonding happen reactively, that's not what I'm seeing in the Android L developer preview. So I've elected to bond with the peripheral explicitly by calling BluetoothDevice.createBond().

    I do this right after service discovery, when I'm already connected to the device and connected to the GATT server. Later on, before I read or write any characteristics that use BLE_GAP_CONN_MODE_SET_ENC_NO_MITM, I first check the bond state on the device and make sure I'm bonded. I'd expect to only have to call createBond() once in any case.

Children
No Data
Related