update BLE ESP32 lib to last version

note this version of library is compatible with this rev:
https://github.com/espressif/arduino-esp32/tree/89859f7f4c07ce3e5d487a4b689dbda78f5d5c3a
as stated in the wiki
This commit is contained in:
Florian committed 2018-09-02 10:25:55 +02:00
1 parent 0f118c2020
commit 751c479e59
23 files changed
+461 -72

No files matched your search

+14 -5
View File
@@ -18,7 +18,6 @@
#include "BLEUtils.h"
#include <string.h>
#include <string>
#include <gatt_api.h>
#include <unordered_set>
#ifdef ARDUINO_ARCH_ESP32
#include "esp32-hal-log.h"
@@ -70,21 +69,23 @@ BLEService* BLEServer::createService(const char* uuid) {
* of a new service. Every service must have a unique UUID.
* @param [in] uuid The UUID of the new service.
* @param [in] numHandles The maximum number of handles associated with this service.
* @param [in] inst_id With multiple services with the same UUID we need to provide inst_id value different for each service.
* @return A reference to the new service object.
*/
BLEService* BLEServer::createService(BLEUUID uuid, uint32_t numHandles) {
BLEService* BLEServer::createService(BLEUUID uuid, uint32_t numHandles, uint8_t inst_id) {
ESP_LOGD(LOG_TAG, ">> createService - %s", uuid.toString().c_str());
m_semaphoreCreateEvt.take("createService");
// Check that a service with the supplied UUID does not already exist.
if (m_serviceMap.getByUUID(uuid) != nullptr) {
ESP_LOGE(LOG_TAG, "<< Attempt to create a new service with uuid %s but a service with that UUID already exists.",
ESP_LOGW(LOG_TAG, "<< Attempt to create a new service with uuid %s but a service with that UUID already exists.",
uuid.toString().c_str());
m_semaphoreCreateEvt.give();
return nullptr;
//m_semaphoreCreateEvt.give();
//return nullptr;
}
BLEService* pService = new BLEService(uuid, numHandles);
pService->m_id = inst_id;
m_serviceMap.setByUUID(uuid, pService); // Save a reference to this service being on this server.
pService->executeCreate(this); // Perform the API calls to actually create the service.
@@ -322,6 +323,14 @@ void BLEServer::setCallbacks(BLEServerCallbacks* pCallbacks) {
m_pServerCallbacks = pCallbacks;
} // setCallbacks
/*
* Remove service
*/
void BLEServer::removeService(BLEService *service) {
service->stop();
service->executeDelete();
m_serviceMap.removeService(service);
}
/**
* @brief Start advertising.