Skip to content

Create example of requesting security pin when ble connecting #289

Open
@vovagorodok

Description

@vovagorodok

Created topic:
https://forum.arduino.cc/t/arduinoble-clarification-and-examples-about-ble-security/1093188
But no response for this moment. Currently I'm stuck with this issue.
I've spend couple days on analyzing ArduinoBLE and can't create solution for requesting pin when ble connecting.
Lets create example for future developers. It additionally unblock me to finish work at open source BLE firmware uploads library.
For NimBLE-Arduino library I'm using:

BLEDevice::setSecurityPasskey(123456);
BLEDevice::setSecurityAuth(true, true, true); // bonding, mitm, sc 
BLEDevice::setSecurityIOCap(BLE_HS_IO_DISPLAY_ONLY);

And start security on connected callback:

void ArduinoBleOTAClass::onConnect(BLEServer* pServer, ble_gap_conn_desc* desc)
{
  BLEDevice::startSecurity(desc->conn_handle);
}

Initially at ArduinoBLE, as I see, to achieve BLE_HS_IO_DISPLAY_ONLY we shoud BLE.setDisplayCode() and not BLE.setBinaryConfirmPairing().
How to start security when ble connecting?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions