ble.setPairingMode()

Description

Sets whether to use security and when to initiate it.

Syntax

ble.setPairingMode(pairingMode);

Parameters

pairingMode: The mode to use.

  • BLE_SECURITY_NONE: No security.
  • BLE_SECURITY_WAIT_FOR_REQUEST: Wait for the client to request security.
  • BLE_SECURITY_INITIATE_UPON_CONNECTION: Request that the NP initiate security when a connection is formed.

 

Returns

Status code

Example

#include <BLE.h>

void setup() {
  Serial.begin(115200);
  ble.begin();
  ble.setPairingMode(BLE_SECURITY_WAIT_FOR_REQUEST);
  ble.setIoCapabilities(BLE_DISPLAY_YES_NO);
  ble.useBonding(true);
}

void loop() {
  ble.handleEvents();
}

Reference Home || BLE Library