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

Secure connection between nRF51822 and Android Smartphone?

Hello, i'm programming an android app to connect to the nRF51822 (peripheral). Without any security or pairing settings everything works fine. The Problem: Any kind of authentication and encryption is needed, but in the final Product the nRF51822 has no display or keyboard. Is there any way to establish a secure, authenticated connection to the Chip under that conditions?

In addition to the problem, what is the difference between the "Properties" and the "Permissions" of a Characteristic and what are they used for?

Parents
  • Thank you for your helpful answer, Hung Bui.

    Unfortunately I don't get a "Insufficient Authentication" error (Code 5) in the Android app, instead there occurs error code 137 (0x89: GATT_AUTH_FAIL?). Although the solution works anyway it would be interesting to know what's the reason for this!?

    I have one more (off topic) question: Is there any way to abort the connection to an already paired device?

  • I tried it the way you described:

    1. Android device tries to read a Characteristic which permissions (read/write) are set to BLE_GAP_CONN_SEC_MODE_SET_ENC_NO_MITM. That returns 137 (sometimes 133 with Connection loss). By the way, I recognized that MasterControlPanel gets the right error.
    2. After that a Broadcast Receiver on the Android device is waiting for a BluetoothDevice.ACTION_BOND_STATE_CHANGED with state == BluetoothDevice.BOND_BONDED.
    3. By this event the App tires to read the initial Characteristic again. If this returns GATT_SUCCESS, the app state is set to connected.

    After the bonding process the user has to identify by a numeric code and if this fails i want to disonnect from the nRF51822 (peripheral). The disconnect has to be initiated by the nRF51822, is that possible?

Reply
  • I tried it the way you described:

    1. Android device tries to read a Characteristic which permissions (read/write) are set to BLE_GAP_CONN_SEC_MODE_SET_ENC_NO_MITM. That returns 137 (sometimes 133 with Connection loss). By the way, I recognized that MasterControlPanel gets the right error.
    2. After that a Broadcast Receiver on the Android device is waiting for a BluetoothDevice.ACTION_BOND_STATE_CHANGED with state == BluetoothDevice.BOND_BONDED.
    3. By this event the App tires to read the initial Characteristic again. If this returns GATT_SUCCESS, the app state is set to connected.

    After the bonding process the user has to identify by a numeric code and if this fails i want to disonnect from the nRF51822 (peripheral). The disconnect has to be initiated by the nRF51822, is that possible?

Children
No Data
Related