summaryrefslogtreecommitdiff
path: root/sensor/patchedBLE/src/BLEClient.h
diff options
context:
space:
mode:
Diffstat (limited to 'sensor/patchedBLE/src/BLEClient.h')
-rw-r--r--sensor/patchedBLE/src/BLEClient.h19
1 files changed, 12 insertions, 7 deletions
diff --git a/sensor/patchedBLE/src/BLEClient.h b/sensor/patchedBLE/src/BLEClient.h
index a60ed10..1b8144d 100644
--- a/sensor/patchedBLE/src/BLEClient.h
+++ b/sensor/patchedBLE/src/BLEClient.h
@@ -19,9 +19,11 @@
#include "BLERemoteService.h"
#include "BLEService.h"
#include "BLEAddress.h"
+#include "BLEAdvertisedDevice.h"
class BLERemoteService;
class BLEClientCallbacks;
+class BLEAdvertisedDevice;
/**
* @brief A model of a %BLE client.
@@ -31,7 +33,8 @@ public:
BLEClient();
~BLEClient();
- bool connect(BLEAddress address); // Connect to the remote BLE Server
+ bool connect(BLEAdvertisedDevice* device);
+ bool connect(BLEAddress address, esp_ble_addr_type_t type = BLE_ADDR_TYPE_PUBLIC); // 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
@@ -51,8 +54,11 @@ public:
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.
+ uint16_t getConnId();
+ esp_gatt_if_t getGattcIf();
+ uint16_t getMTU();
-
+uint16_t m_appId;
private:
friend class BLEDevice;
friend class BLERemoteService;
@@ -64,14 +70,12 @@ private:
esp_gatt_if_t gattc_if,
esp_ble_gattc_cb_param_t* param);
- uint16_t getConnId();
- esp_gatt_if_t getGattcIf();
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_haveServices; // Have we previously obtain the set of services from the remote server.
- bool m_isConnected; // Are we currently connected.
+ bool m_haveServices = false; // Have we previously obtain the set of services from the remote server.
+ bool m_isConnected = false; // Are we currently connected.
BLEClientCallbacks* m_pClientCallbacks;
FreeRTOS::Semaphore m_semaphoreRegEvt = FreeRTOS::Semaphore("RegEvt");
@@ -79,8 +83,9 @@ private:
FreeRTOS::Semaphore m_semaphoreSearchCmplEvt = FreeRTOS::Semaphore("SearchCmplEvt");
FreeRTOS::Semaphore m_semaphoreRssiCmplEvt = FreeRTOS::Semaphore("RssiCmplEvt");
std::map<std::string, BLERemoteService*> m_servicesMap;
+ std::map<BLERemoteService*, uint16_t> m_servicesMapByInstID;
void clearServices(); // Clear any existing services.
-
+ uint16_t m_mtu = 23;
}; // class BLEDevice