mirror of
https://github.com/h2zero/esp-nimble-cpp.git
synced 2026-02-03 21:55:09 +01:00
[Breaking] Update callbacks to use NimBLEConnInfo.
Change the callback functions that receive a ble_gap_conn_desc pointer to instead receive a NimBLEConnInfo reference. * Add a reason parameter to the server disconnect callback. * Remove connect and disconnect callback that do not receive info parameters. * Remove onRead and onWrite Characteristic callbacks that do not receive info parameters. * Add info parameter to Descriptor onWrite and onRead callbacks. * Add details to migration guide.
This commit is contained in:
@@ -48,11 +48,11 @@ uint32_t value = 0;
|
||||
/** None of these are required as they will be handled by the library with defaults. **
|
||||
** Remove as you see fit for your needs */
|
||||
class MyServerCallbacks: public BLEServerCallbacks {
|
||||
void onConnect(BLEServer* pServer) {
|
||||
void onConnect(BLEServer* pServer, BLEConnInfo& connInfo) {
|
||||
deviceConnected = true;
|
||||
};
|
||||
|
||||
void onDisconnect(BLEServer* pServer) {
|
||||
void onDisconnect(BLEServer* pServer, BLEConnInfo& connInfo, int reason) {
|
||||
deviceConnected = false;
|
||||
}
|
||||
/***************** New - Security handled here ********************
|
||||
@@ -67,7 +67,7 @@ class MyServerCallbacks: public BLEServerCallbacks {
|
||||
return true;
|
||||
}
|
||||
|
||||
void onAuthenticationComplete(ble_gap_conn_desc desc){
|
||||
void onAuthenticationComplete(BLEConnInfo& connInfo){
|
||||
printf("Starting BLE work!\n");
|
||||
}
|
||||
/*******************************************************************/
|
||||
|
||||
Reference in New Issue
Block a user