8000 Add onConnect callback with parameter to allow retrieve client MAC · Netoperz/esp32-snippets@49d6aba · GitHub
[go: up one dir, main page]

Skip to content

Commit 49d6aba

Browse files
committed
Add onConnect callback with parameter to allow retrieve client MAC
1 parent caa546a commit 49d6aba

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

cpp_utils/BLEServer.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,7 @@ void BLEServer::handleGATTServerEvent(
202202
m_connId = param->connect.conn_id; // Save the connection id.
203203
if (m_pServerCallbacks != nullptr) {
204204
m_pServerCallbacks->onConnect(this);
205+
m_pServerCallbacks->onConnect(this, param);
205206
}
206207
m_connectedCount++; // Increment the number of connected devices count.
207208
break;

cpp_utils/BLEServer.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ class BLEServer {
6464
void startAdvertising();
6565
void removeService(BLEService *service);
6666

67+
6768
private:
6869
BLEServer();
6970
friend class BLEService;
@@ -103,7 +104,7 @@ class BLEServerCallbacks {
103104
* @param [in] pServer A reference to the %BLE server that received the client connection.
104105
*/
105106
virtual void onConnect(BLEServer* pServer);
106-
107+
virtual void onConnect(BLEServer* pServer, esp_ble_gatts_cb_param_t *param);
107108
/**
108109
* @brief Handle an existing client disconnection.
109110
*

0 commit comments

Comments
 (0)
0