diff options
author | kolban <kolban1@kolban.com> | 2017-09-10 13:36:10 -0500 |
---|---|---|
committer | kolban <kolban1@kolban.com> | 2017-09-10 13:36:10 -0500 |
commit | 5e5b5b78f0aeca611edb52ff4e885334b6fe46a9 (patch) | |
tree | 8d207806891e66ee6ea292d82eb7f120e2138418 /ESP32_BLE_Arduino/src/BLEDevice.h | |
download | thermostat-5e5b5b78f0aeca611edb52ff4e885334b6fe46a9.tar.gz thermostat-5e5b5b78f0aeca611edb52ff4e885334b6fe46a9.tar.bz2 thermostat-5e5b5b78f0aeca611edb52ff4e885334b6fe46a9.zip |
0.1.0 release
Diffstat (limited to 'ESP32_BLE_Arduino/src/BLEDevice.h')
-rw-r--r-- | ESP32_BLE_Arduino/src/BLEDevice.h | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/ESP32_BLE_Arduino/src/BLEDevice.h b/ESP32_BLE_Arduino/src/BLEDevice.h new file mode 100644 index 0000000..9d767c1 --- /dev/null +++ b/ESP32_BLE_Arduino/src/BLEDevice.h @@ -0,0 +1,54 @@ +/* + * BLEDevice.h + * + * Created on: Mar 16, 2017 + * Author: kolban + */ + +#ifndef MAIN_BLEDevice_H_ +#define MAIN_BLEDevice_H_ +#include "sdkconfig.h" +#if defined(CONFIG_BT_ENABLED) +#include <esp_gap_ble_api.h> // ESP32 BLE +#include <esp_gattc_api.h> // ESP32 BLE +#include <map> // Part of C++ STL +#include <string> + +#include "BLEServer.h" +#include "BLEClient.h" +#include "BLEUtils.h" +#include "BLEScan.h" +#include "BLEAddress.h" +/** + * @brief %BLE functions. + */ +class BLEDevice { +public: + static void dumpDevices(); + static BLEClient *createClient(); + + static void init(std::string deviceName); + //static void scan(int duration, esp_ble_scan_type_t scan_type = BLE_SCAN_TYPE_PASSIVE); + static BLEScan *getScan(); + static BLEServer *m_bleServer; + static BLEScan *m_pScan; + static BLEClient *m_pClient; + +private: + static esp_gatt_if_t getGattcIF(); + + static void gattClientEventHandler( + esp_gattc_cb_event_t event, + esp_gatt_if_t gattc_if, + esp_ble_gattc_cb_param_t *param); + static void gattServerEventHandler( + esp_gatts_cb_event_t event, + esp_gatt_if_t gatts_if, + esp_ble_gatts_cb_param_t *param); + static void gapEventHandler( + esp_gap_ble_cb_event_t event, + esp_ble_gap_cb_param_t *param); +}; // class BLE + +#endif // CONFIG_BT_ENABLED +#endif /* MAIN_BLEDevice_H_ */ |