diff options
author | chegewara <imperiaonline4@gmail.com> | 2018-11-30 10:59:14 +0100 |
---|---|---|
committer | chegewara <imperiaonline4@gmail.com> | 2018-11-30 10:59:14 +0100 |
commit | 934702b6169b92c71cbc850876fd17fb9ee3236d (patch) | |
tree | 048df4f7106cd4a574b609a13e62a36567f5a322 /src/BLEClient.h | |
parent | Upload of 0.4.16 (diff) | |
download | thermostat-934702b6169b92c71cbc850876fd17fb9ee3236d.tar.gz thermostat-934702b6169b92c71cbc850876fd17fb9ee3236d.tar.bz2 thermostat-934702b6169b92c71cbc850876fd17fb9ee3236d.zip |
Changes, bugfixes and updgrades. Library is ready to work with arduino-esp32 v1.0.1.
Diffstat (limited to 'src/BLEClient.h')
-rw-r--r-- | src/BLEClient.h | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/src/BLEClient.h b/src/BLEClient.h index a60ed10..1b8144d 100644 --- a/src/BLEClient.h +++ b/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 |