Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions libraries/BLE/src/BLEServer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,7 @@ void BLEServer::handleGATTServerEvent(esp_gatts_cb_event_t event, esp_gatt_if_t

case ESP_GATTS_MTU_EVT:
updatePeerMTU(param->mtu.conn_id, param->mtu.mtu);
m_pServerCallbacks->onMtuChanges(this, param);
break;

// ESP_GATTS_CONNECT_EVT
Expand Down Expand Up @@ -371,6 +372,12 @@ void BLEServerCallbacks::onDisconnect(BLEServer* pServer) {
log_d("BLEServerCallbacks", "<< onDisconnect()");
} // onDisconnect

void BLEServerCallbacks::onMtuChanged(BLEServer* pServer, esp_ble_gatts_cb_param_t* param) {
log_d("BLEServerCallbacks", ">> onMtuChanged(): Default");
log_d("BLEServerCallbacks", "Device: %s MTU: %d", BLEDevice::toString().c_str(), param->mtu.mtu);
log_d("BLEServerCallbacks", "<< onMtuChanged()");
} // onDisconnect

/* multi connect support */
/* TODO do some more tweaks */
void BLEServer::updatePeerMTU(uint16_t conn_id, uint16_t mtu) {
Expand Down
10 changes: 10 additions & 0 deletions libraries/BLE/src/BLEServer.h
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,16 @@ class BLEServerCallbacks {
* @param [in] pServer A reference to the %BLE server that received the existing client disconnection.
*/
virtual void onDisconnect(BLEServer* pServer);

/**
* @brief Handle a new client connection.
*
* When the MTU changes this method is invoked.
*
* @param [in] pServer A reference to the %BLE server that received the client connection.
* @param [in] param A reference to esp_ble_gatts_cb_param_t.
*/
virtual void onMtuChanged(BLEServer* pServer, esp_ble_gatts_cb_param_t* param)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Something is missing here ;.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah I saw that. I corrected the code and committed it to my fork. Let me know if I need to do anything more.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Odd, i commented this 2 days ago.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmmm, just got an email this morning of the failure.

}; // BLEServerCallbacks


Expand Down