update BLE library for ESP32 env compatibility

with the last version of ESP32 arduino env it is not possible to compile on ESP32, we get "missing gatt_api.h" ERROR. So as to avoid that we need to use the last version of the nkolban library for BLE 0.4.16
This commit is contained in:
Florian committed 2018-06-30 15:24:47 +02:00
1 parent 1dd68ab078
commit 42be3fe0f2
48 files changed
+2970 -426

No files matched your search

+25 -12
View File
@@ -15,6 +15,7 @@
#include <string.h>
#include <map>
#include <string>
#include "BLEExceptions.h"
#include "BLERemoteService.h"
#include "BLEService.h"
#include "BLEAddress.h"
@@ -29,19 +30,28 @@ class BLEClient {
public:
BLEClient();
~BLEClient();
bool connect(BLEAddress address);
void disconnect();
BLEAddress getPeerAddress();
int getRssi();
std::map<std::string, BLERemoteService*>* getServices();
BLERemoteService* getService(const char* uuid);
BLERemoteService* getService(BLEUUID uuid);
bool connect(BLEAddress address); // Connect to the remote BLE Server
void disconnect(); // Disconnect from the remote BLE Server
BLEAddress getPeerAddress(); // Get the address of the remote BLE Server
int getRssi(); // Get the RSSI of the remote BLE Server
std::map<std::string, BLERemoteService*>* getServices(); // Get a map of the services offered by the remote BLE Server
BLERemoteService* getService(const char* uuid); // Get a reference to a specified service offered by the remote BLE server.
BLERemoteService* getService(BLEUUID uuid); // Get a reference to a specified service offered by the remote BLE server.
std::string getValue(BLEUUID serviceUUID, BLEUUID characteristicUUID); // Get the value of a given characteristic at a given service.
void handleGAPEvent(
esp_gap_ble_cb_event_t event,
esp_ble_gap_cb_param_t* param);
bool isConnected();
bool isConnected(); // Return true if we are connected.
void setClientCallbacks(BLEClientCallbacks *pClientCallbacks);
std::string toString();
void setValue(BLEUUID serviceUUID, BLEUUID characteristicUUID, std::string value); // Set the value of a given characteristic at a given service.
std::string toString(); // Return a string representation of this client.
private:
friend class BLEDevice;
@@ -56,11 +66,12 @@ private:
uint16_t getConnId();
esp_gatt_if_t getGattcIf();
BLEAddress m_peerAddress = BLEAddress((uint8_t*)"\0\0\0\0\0\0");
BLEAddress m_peerAddress = BLEAddress((uint8_t*)"\0\0\0\0\0\0"); // The BD address of the remote server.
uint16_t m_conn_id;
// int m_deviceType;
esp_gatt_if_t m_gattc_if;
bool m_isConnected;
bool m_haveServices; // Have we previously obtain the set of services from the remote server.
bool m_isConnected; // Are we currently connected.
BLEClientCallbacks* m_pClientCallbacks;
FreeRTOS::Semaphore m_semaphoreRegEvt = FreeRTOS::Semaphore("RegEvt");
@@ -68,7 +79,8 @@ private:
FreeRTOS::Semaphore m_semaphoreSearchCmplEvt = FreeRTOS::Semaphore("SearchCmplEvt");
FreeRTOS::Semaphore m_semaphoreRssiCmplEvt = FreeRTOS::Semaphore("RssiCmplEvt");
std::map<std::string, BLERemoteService*> m_servicesMap;
bool m_haveServices; // Have we previously obtain the set of services.
void clearServices(); // Clear any existing services.
}; // class BLEDevice
@@ -79,6 +91,7 @@ class BLEClientCallbacks {
public:
virtual ~BLEClientCallbacks() {};
virtual void onConnect(BLEClient *pClient) = 0;
virtual void onDisconnect(BLEClient *pClient) = 0;
};
#endif // CONFIG_BT_ENABLED