esp-nimble-cpp  1.4.1
NimBLEServerCallbacks Class Reference

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

Public Member Functions

virtual void onConnect (NimBLEServer *pServer)
 Handle a client connection. This is called when a client connects. More...
 
virtual void onConnect (NimBLEServer *pServer, ble_gap_conn_desc *desc)
 Handle a client connection. This is called when a client connects. More...
 
virtual void onDisconnect (NimBLEServer *pServer)
 Handle a client disconnection. This is called when a client disconnects. More...
 
virtual void onDisconnect (NimBLEServer *pServer, ble_gap_conn_desc *desc)
 Handle a client disconnection. This is called when a client discconnects. More...
 
virtual void onMTUChange (uint16_t MTU, ble_gap_conn_desc *desc)
 Called when the connection MTU changes. More...
 
virtual uint32_t onPassKeyRequest ()
 Called when a client requests a passkey for pairing. More...
 
virtual void onAuthenticationComplete (ble_gap_conn_desc *desc)
 Called when the pairing procedure is complete. More...
 
virtual bool onConfirmPIN (uint32_t pin)
 Called when using numeric comparision for pairing. More...
 

Detailed Description

Callbacks associated with the operation of a BLE server.

Member Function Documentation

◆ onAuthenticationComplete()

void NimBLEServerCallbacks::onAuthenticationComplete ( ble_gap_conn_desc *  desc)
virtual

Called when the pairing procedure is complete.

Parameters
[in]descA pointer to the struct containing the connection information.
This can be used to check the status of the connection encryption/pairing.

◆ onConfirmPIN()

bool NimBLEServerCallbacks::onConfirmPIN ( uint32_t  pin)
virtual

Called when using numeric comparision for pairing.

Parameters
[in]pinThe pin to compare with the client.
Returns
True to accept the pin.

◆ onConnect() [1/2]

void NimBLEServerCallbacks::onConnect ( NimBLEServer pServer)
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.

Default callback handlers

◆ onConnect() [2/2]

void NimBLEServerCallbacks::onConnect ( NimBLEServer pServer,
ble_gap_conn_desc *  desc 
)
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]descA pointer to the connection description structure containig information about the connection parameters.

◆ onDisconnect() [1/2]

void NimBLEServerCallbacks::onDisconnect ( NimBLEServer pServer)
virtual

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

Parameters
[in]pServerA reference to the BLE server that received the existing client disconnection.

◆ onDisconnect() [2/2]

void NimBLEServerCallbacks::onDisconnect ( NimBLEServer pServer,
ble_gap_conn_desc *  desc 
)
virtual

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

Parameters
[in]pServerA pointer to the BLE server that received the client disconnection.
[in]descA pointer to the connection description structure containing information about the connection.

◆ onMTUChange()

void NimBLEServerCallbacks::onMTUChange ( uint16_t  MTU,
ble_gap_conn_desc *  desc 
)
virtual

Called when the connection MTU changes.

Parameters
[in]MTUThe new MTU value.
[in]descA pointer to the connection description structure containing information about the connection.

◆ onPassKeyRequest()

uint32_t NimBLEServerCallbacks::onPassKeyRequest ( )
virtual

Called when a client requests a passkey for pairing.

Returns
The passkey to be sent to the client.