diff options
author | dakkar <dakkar@thenautilus.net> | 2018-08-03 12:25:37 +0100 |
---|---|---|
committer | dakkar <dakkar@thenautilus.net> | 2018-08-03 12:25:37 +0100 |
commit | 9ad65d69c1af586b2d07573aba4bb644f6cb1221 (patch) | |
tree | 190e38113a0c7cff8ff5f96fcfc9a8fa6ad897e9 /sensor/patchedBLE | |
parent | note the source of patchedBLE (diff) | |
download | thermostat-9ad65d69c1af586b2d07573aba4bb644f6cb1221.tar.gz thermostat-9ad65d69c1af586b2d07573aba4bb644f6cb1221.tar.bz2 thermostat-9ad65d69c1af586b2d07573aba4bb644f6cb1221.zip |
uni-init BLE before sleeping
Diffstat (limited to 'sensor/patchedBLE')
-rw-r--r-- | sensor/patchedBLE/src/BLEDevice.cpp | 8 | ||||
-rw-r--r-- | sensor/patchedBLE/src/BLEDevice.h | 1 |
2 files changed, 9 insertions, 0 deletions
diff --git a/sensor/patchedBLE/src/BLEDevice.cpp b/sensor/patchedBLE/src/BLEDevice.cpp index a7db454..3f31ace 100644 --- a/sensor/patchedBLE/src/BLEDevice.cpp +++ b/sensor/patchedBLE/src/BLEDevice.cpp @@ -426,6 +426,14 @@ uint16_t BLEDevice::m_localMTU = 23; vTaskDelay(200/portTICK_PERIOD_MS); // Delay for 200 msecs as a workaround to an apparent Arduino environment issue. } // init +void BLEDevice::uninit() { + if (initialized) { + initialized = false; + esp_bluedroid_disable(); + esp_bt_controller_disable(); + esp_bt_controller_deinit(); + } +} /** * @brief Set the transmission power. diff --git a/sensor/patchedBLE/src/BLEDevice.h b/sensor/patchedBLE/src/BLEDevice.h index 7a1b833..16c323c 100644 --- a/sensor/patchedBLE/src/BLEDevice.h +++ b/sensor/patchedBLE/src/BLEDevice.h @@ -33,6 +33,7 @@ public: static BLEScan* getScan(); // Get the scan object static std::string getValue(BLEAddress bdAddress, BLEUUID serviceUUID, BLEUUID characteristicUUID); // Get the value of a characteristic of a service on a server. static void init(std::string deviceName); // Initialize the local BLE environment. + static void uninit(); static void setPower(esp_power_level_t powerLevel); // Set our power level. static void setValue(BLEAddress bdAddress, BLEUUID serviceUUID, BLEUUID characteristicUUID, std::string value); // Set the value of a characteristic on a service on a server. static std::string toString(); // Return a string representation of our device. |