Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
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
15 changes: 15 additions & 0 deletions src/BLEServer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,21 @@ uint32_t BLEServer::getConnectedCount() {
} // getConnectedCount


/**
* @brief Disconnect Client
*
* Force a client to disconnect
*/
void BLEServer::disconnectClient() {
ESP_LOGD(LOG_TAG, ">> disconnectClient()");
esp_err_t errRc = ::esp_ble_gatts_close(getGattsIf(), getConnId());
if (errRc != ESP_OK) {
ESP_LOGE(LOG_TAG, "esp_ble_gatts_close: rc=%d %s", errRc, GeneralUtils::errorToString(errRc));
return;
}
ESP_LOGD(LOG_TAG, "<< disconnectClient()");
}

uint16_t BLEServer::getGattsIf() {
return m_gatts_if;
}
Expand Down
8 changes: 8 additions & 0 deletions src/BLEServer.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,14 @@ class BLEServiceMap {
class BLEServer {
public:
uint32_t getConnectedCount();

/**
* @brief Disconnect Client
*
* Force a client to disconnect
*/
void disconnectClient();

BLEService* createService(const char* uuid);
BLEService* createService(BLEUUID uuid, uint32_t numHandles=15, uint8_t inst_id=0);
BLEAdvertising* getAdvertising();
Expand Down