Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 67de199

Browse files
add onMtuChanged to BLEServerCallbacks (#5222)
* add onMtuChanged to BLEServerCallbacks Add method onMtuChanged to the BLEServerCallbacks so the application can be notified if the MTU size changes. * Correct missing semicolon and misspelled method. Correct missing semicolon and misspelled method.
1 parent 39155e7 commit 67de199

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

‎libraries/BLE/src/BLEServer.cpp‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,7 @@ void BLEServer::handleGATTServerEvent(esp_gatts_cb_event_t event, esp_gatt_if_t
157157

158158
case ESP_GATTS_MTU_EVT:
159159
updatePeerMTU(param->mtu.conn_id, param->mtu.mtu);
160+
m_pServerCallbacks->onMtuChanged(this, param);
160161
break;
161162

162163
// ESP_GATTS_CONNECT_EVT
@@ -371,6 +372,12 @@ void BLEServerCallbacks::onDisconnect(BLEServer* pServer) {
371372
log_d("BLEServerCallbacks", "<< onDisconnect()");
372373
} // onDisconnect
373374

375+
void BLEServerCallbacks::onMtuChanged(BLEServer* pServer, esp_ble_gatts_cb_param_t* param) {
376+
log_d("BLEServerCallbacks", ">> onMtuChanged(): Default");
377+
log_d("BLEServerCallbacks", "Device: %s MTU: %d", BLEDevice::toString().c_str(), param->mtu.mtu);
378+
log_d("BLEServerCallbacks", "<< onMtuChanged()");
379+
} // onMtuChanged
380+
374381
/* multi connect support */
375382
/* TODO do some more tweaks */
376383
void BLEServer::updatePeerMTU(uint16_t conn_id, uint16_t mtu) {

‎libraries/BLE/src/BLEServer.h‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,16 @@ class BLEServerCallbacks {
134134
* @param [in] pServer A reference to the %BLE server that received the existing client disconnection.
135135
*/
136136
virtual void onDisconnect(BLEServer* pServer);
137+
138+
/**
139+
* @brief Handle a new client connection.
140+
*
141+
* When the MTU changes this method is invoked.
142+
*
143+
* @param [in] pServer A reference to the %BLE server that received the client connection.
144+
* @param [in] param A reference to esp_ble_gatts_cb_param_t.
145+
*/
146+
virtual void onMtuChanged(BLEServer* pServer, esp_ble_gatts_cb_param_t* param);
137147
}; // BLEServerCallbacks
138148

139149

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /