esp-nimble-cpp 2.0.1
Loading...
Searching...
No Matches
NimBLEServerCallbacks Class Reference

Callbacks associated with the operation of a BLE server. More...

#include <NimBLEServer.h>

Public Member Functions

virtual void onConnect (NimBLEServer *pServer, NimBLEConnInfo &connInfo)
 Handle a client connection. This is called when a client connects.
 
virtual void onDisconnect (NimBLEServer *pServer, NimBLEConnInfo &connInfo, int reason)
 Handle a client disconnection. This is called when a client disconnects.
 
virtual void onMTUChange (uint16_t MTU, NimBLEConnInfo &connInfo)
 Called when the connection MTU changes.
 
virtual uint32_t onPassKeyDisplay ()
 Called when a client requests a passkey for pairing (display).
 
virtual void onConfirmPassKey (NimBLEConnInfo &connInfo, uint32_t pin)
 Called when using numeric comparision for pairing.
 
virtual void onAuthenticationComplete (NimBLEConnInfo &connInfo)
 Called when the pairing procedure is complete.
 
virtual void onIdentity (NimBLEConnInfo &connInfo)
 Called when the peer identity address is resolved.
 
virtual void onConnParamsUpdate (NimBLEConnInfo &connInfo)
 Called when connection parameters are updated following a request to update via NimBLEServer::updateConnParams.
 
virtual void onPhyUpdate (NimBLEConnInfo &connInfo, uint8_t txPhy, uint8_t rxPhy)
 Called when the PHY update procedure is complete.
 

Detailed Description

Callbacks associated with the operation of a BLE server.

Member Function Documentation

◆ onAuthenticationComplete()

void NimBLEServerCallbacks::onAuthenticationComplete ( NimBLEConnInfo connInfo)
virtual

Called when the pairing procedure is complete.

Parameters
[in]connInfoA reference to a NimBLEConnInfo instance with information about the peer connection parameters.

◆ onConfirmPassKey()

void NimBLEServerCallbacks::onConfirmPassKey ( NimBLEConnInfo connInfo,
uint32_t  pin 
)
virtual

Called when using numeric comparision for pairing.

Parameters
[in]connInfoA reference to a NimBLEConnInfo instance with information Should be passed back to NimBLEDevice::injectConfirmPasskey
[in]pinThe pin to compare with the client.

◆ onConnect()

void NimBLEServerCallbacks::onConnect ( NimBLEServer pServer,
NimBLEConnInfo connInfo 
)
virtual

Handle a client connection. This is called when a client connects.

Parameters
[in]pServerA pointer to the BLE server that received the client connection.
[in]connInfoA reference to a NimBLEConnInfo instance with information. about the peer connection parameters.

Default callback handlers

◆ onConnParamsUpdate()

void NimBLEServerCallbacks::onConnParamsUpdate ( NimBLEConnInfo connInfo)
virtual

Called when connection parameters are updated following a request to update via NimBLEServer::updateConnParams.

Parameters
[in]connInfoA reference to a NimBLEConnInfo instance containing the updated connection parameters.

◆ onDisconnect()

void NimBLEServerCallbacks::onDisconnect ( NimBLEServer pServer,
NimBLEConnInfo connInfo,
int  reason 
)
virtual

Handle a client disconnection. This is called when a client disconnects.

Parameters
[in]pServerA pointer to the BLE server that received the client disconnection.
[in]connInfoA reference to a NimBLEConnInfo instance with information about the peer connection parameters.
[in]reasonThe reason code for the disconnection.

◆ onIdentity()

void NimBLEServerCallbacks::onIdentity ( NimBLEConnInfo connInfo)
virtual

Called when the peer identity address is resolved.

Parameters
[in]connInfoA reference to a NimBLEConnInfo instance with information

◆ onMTUChange()

void NimBLEServerCallbacks::onMTUChange ( uint16_t  MTU,
NimBLEConnInfo connInfo 
)
virtual

Called when the connection MTU changes.

Parameters
[in]MTUThe new MTU value.
[in]connInfoA reference to a NimBLEConnInfo instance with information about the peer connection parameters.

◆ onPassKeyDisplay()

uint32_t NimBLEServerCallbacks::onPassKeyDisplay ( )
virtual

Called when a client requests a passkey for pairing (display).

Returns
The passkey to be sent to the client.

◆ onPhyUpdate()

void NimBLEServerCallbacks::onPhyUpdate ( NimBLEConnInfo connInfo,
uint8_t  txPhy,
uint8_t  rxPhy 
)
virtual

Called when the PHY update procedure is complete.

Parameters
[in]connInfoA reference to a NimBLEConnInfo instance with information about the peer connection parameters.
[in]txPhyThe transmit PHY.
[in]rxPhyThe receive PHY. Possible values:
  • BLE_GAP_LE_PHY_1M
  • BLE_GAP_LE_PHY_2M
  • BLE_GAP_LE_PHY_CODED