diff --git a/lib/libesp32_div/NimBLE-Arduino/CHANGELOG.md b/lib/libesp32_div/NimBLE-Arduino/CHANGELOG.md index 5d1d2d409..43fbc62cf 100644 --- a/lib/libesp32_div/NimBLE-Arduino/CHANGELOG.md +++ b/lib/libesp32_div/NimBLE-Arduino/CHANGELOG.md @@ -2,6 +2,22 @@ All notable changes to this project will be documented in this file. +## [1.4.1] - 2022-10-23 + +### Fixed + - Compile warning removed for esp32c3 + - NimBLEDevice::getPower incorrect value when power level is -3db. + - Failed pairing when already in progress. + +### Changed + - Revert previous change that forced writing with response when subscribing in favor of allowing the application to decide. + +### Added + - Added NimBLEHIDDevice::batteryLevel. + - Added NimBLEDevice::setDeviceName allowing for changing the device name while the BLE stack is active. + - CI build tests. + - Missing items in CHANGELOG that were not recorded correctly + ## [1.4.0] - 2022-07-10 ### Fixed @@ -11,6 +27,9 @@ All notable changes to this project will be documented in this file. ### Changed - Updated NimBLE core to use the v1.4.0 branch of esp-nimble. - AD flags are no longer set in the advertisements of non-connectable beacons, freeing up 3 bytes of advertisement room. +- Config option CONFIG_BT_NIMBLE_DEBUG replaced with CONFIG_BT_NIMBLE_LOG_LEVEL (see src/nimconfig.h for usage) +- Config option CONFIG_NIMBLE_CPP_ENABLE_ADVERTISMENT_TYPE_TEXT renamed to CONFIG_NIMBLE_CPP_ENABLE_ADVERTISEMENT_TYPE_TEXT +- Config option CONFIG_BT_NIMBLE_TASK_STACK_SIZE renamed to CONFIG_BT_NIMBLE_HOST_TASK_STACK_SIZE ### Added - Preliminary support for non-esp devices, NRF51 and NRF52 devices supported with [n-able arduino core](https://github.com/h2zero/n-able-Arduino) diff --git a/lib/libesp32_div/NimBLE-Arduino/docs/Doxyfile b/lib/libesp32_div/NimBLE-Arduino/docs/Doxyfile index 54129a191..d9c430338 100644 --- a/lib/libesp32_div/NimBLE-Arduino/docs/Doxyfile +++ b/lib/libesp32_div/NimBLE-Arduino/docs/Doxyfile @@ -38,7 +38,7 @@ PROJECT_NAME = NimBLE-Arduino # could be handy for archiving the generated documentation or if some version # control system is used. -PROJECT_NUMBER = 1.4.0 +PROJECT_NUMBER = 1.4.1 # Using the PROJECT_BRIEF tag one can provide an optional one line description # for a project that appears at the top of each page and should give viewer a @@ -58,7 +58,7 @@ PROJECT_LOGO = # entered, it will be relative to the location where doxygen was started. If # left blank the current directory will be used. -OUTPUT_DIRECTORY = docs +OUTPUT_DIRECTORY = doxydocs # If the CREATE_SUBDIRS tag is set to YES then doxygen will create 4096 sub- # directories (in 2 levels) under the output directory of each output format and @@ -836,7 +836,7 @@ WARN_NO_PARAMDOC = NO # Possible values are: NO, YES and FAIL_ON_WARNINGS. # The default value is: NO. -WARN_AS_ERROR = FAIL_ON_WARNINGS +WARN_AS_ERROR = YES # The WARN_FORMAT tag determines the format of the warning messages that doxygen # can produce. The string should contain the $file, $line, and $text tags, which diff --git a/lib/libesp32_div/NimBLE-Arduino/library.properties b/lib/libesp32_div/NimBLE-Arduino/library.properties index 16ddf82b5..d1b32b9cf 100644 --- a/lib/libesp32_div/NimBLE-Arduino/library.properties +++ b/lib/libesp32_div/NimBLE-Arduino/library.properties @@ -1,5 +1,5 @@ name=NimBLE-Arduino -version=1.4.0 +version=1.4.1 author=h2zero maintainer=h2zero sentence=Bluetooth low energy (BLE) library for arduino-esp32 based on NimBLE. diff --git a/lib/libesp32_div/NimBLE-Arduino/src/NimBLEClient.cpp b/lib/libesp32_div/NimBLE-Arduino/src/NimBLEClient.cpp index d923e6a0a..a83e23b4a 100644 --- a/lib/libesp32_div/NimBLE-Arduino/src/NimBLEClient.cpp +++ b/lib/libesp32_div/NimBLE-Arduino/src/NimBLEClient.cpp @@ -336,6 +336,7 @@ bool NimBLEClient::connect(const NimBLEAddress &address, bool deleteAttributes) * @return True on success. */ bool NimBLEClient::secureConnection() { + NIMBLE_LOGD(LOG_TAG, ">> secureConnection()"); TaskHandle_t cur_task = xTaskGetCurrentTaskHandle(); ble_task_data_t taskData = {this, cur_task, 0, nullptr}; @@ -345,7 +346,7 @@ bool NimBLEClient::secureConnection() { m_pTaskData = &taskData; int rc = NimBLEDevice::startSecurity(m_conn_id); - if(rc != 0){ + if(rc != 0 && rc != BLE_HS_EALREADY){ m_lastErr = rc; m_pTaskData = nullptr; return false; @@ -360,9 +361,11 @@ bool NimBLEClient::secureConnection() { if(taskData.rc != 0){ m_lastErr = taskData.rc; + NIMBLE_LOGE(LOG_TAG, "secureConnection: failed rc=%d", taskData.rc); return false; } + NIMBLE_LOGD(LOG_TAG, "<< secureConnection: success"); return true; } // secureConnection diff --git a/lib/libesp32_div/NimBLE-Arduino/src/NimBLEDevice.cpp b/lib/libesp32_div/NimBLE-Arduino/src/NimBLEDevice.cpp index 6ae9a7745..43ba21909 100644 --- a/lib/libesp32_div/NimBLE-Arduino/src/NimBLEDevice.cpp +++ b/lib/libesp32_div/NimBLE-Arduino/src/NimBLEDevice.cpp @@ -971,6 +971,15 @@ void NimBLEDevice::deinit(bool clearAll) { } } // deinit +/** + * @brief Set the BLEDevice's name + * @param [in] deviceName The device name of the device. + */ +/* STATIC */ +void NimBLEDevice::setDeviceName(const std::string &deviceName) { + ble_svc_gap_device_name_set(deviceName.c_str()); +} // setDeviceName + /** * @brief Check if the initialization is complete. diff --git a/lib/libesp32_div/NimBLE-Arduino/src/NimBLEDevice.h b/lib/libesp32_div/NimBLE-Arduino/src/NimBLEDevice.h index b7e804b8f..8d4d849e4 100644 --- a/lib/libesp32_div/NimBLE-Arduino/src/NimBLEDevice.h +++ b/lib/libesp32_div/NimBLE-Arduino/src/NimBLEDevice.h @@ -97,6 +97,7 @@ class NimBLEDevice { public: static void init(const std::string &deviceName); static void deinit(bool clearAll = false); + static void setDeviceName(const std::string &deviceName); static bool getInitialized(); static NimBLEAddress getAddress(); static std::string toString(); @@ -150,7 +151,8 @@ public: int max_events = 0); static bool stopAdvertising(uint8_t inst_id); static bool stopAdvertising(); -# else +# endif +# if !CONFIG_BT_NIMBLE_EXT_ADV || defined(_DOXYGEN_) static NimBLEAdvertising* getAdvertising(); static bool startAdvertising(); static bool stopAdvertising(); diff --git a/lib/libesp32_div/NimBLE-Arduino/src/NimBLEHIDDevice.cpp b/lib/libesp32_div/NimBLE-Arduino/src/NimBLEHIDDevice.cpp index 29150ce63..a2310eb9e 100644 --- a/lib/libesp32_div/NimBLE-Arduino/src/NimBLEHIDDevice.cpp +++ b/lib/libesp32_div/NimBLE-Arduino/src/NimBLEHIDDevice.cpp @@ -203,12 +203,12 @@ void NimBLEHIDDevice::setBatteryLevel(uint8_t level) { /* * @brief Returns battery level characteristic * @ return battery level characteristic - *//* -BLECharacteristic* BLEHIDDevice::batteryLevel() { + */ +NimBLECharacteristic* NimBLEHIDDevice::batteryLevel() { return m_batteryLevelCharacteristic; } - +/* BLECharacteristic* BLEHIDDevice::reportMap() { return m_reportMapCharacteristic; diff --git a/lib/libesp32_div/NimBLE-Arduino/src/NimBLEHIDDevice.h b/lib/libesp32_div/NimBLE-Arduino/src/NimBLEHIDDevice.h index ef2ed7395..0e8b2828a 100644 --- a/lib/libesp32_div/NimBLE-Arduino/src/NimBLEHIDDevice.h +++ b/lib/libesp32_div/NimBLE-Arduino/src/NimBLEHIDDevice.h @@ -55,7 +55,7 @@ public: void pnp(uint8_t sig, uint16_t vid, uint16_t pid, uint16_t version); //NimBLECharacteristic* hidInfo(); void hidInfo(uint8_t country, uint8_t flags); - //NimBLECharacteristic* batteryLevel(); + NimBLECharacteristic* batteryLevel(); void setBatteryLevel(uint8_t level); diff --git a/lib/libesp32_div/NimBLE-Arduino/src/NimBLERemoteCharacteristic.cpp b/lib/libesp32_div/NimBLE-Arduino/src/NimBLERemoteCharacteristic.cpp index 68982f89e..6cca615db 100644 --- a/lib/libesp32_div/NimBLE-Arduino/src/NimBLERemoteCharacteristic.cpp +++ b/lib/libesp32_div/NimBLE-Arduino/src/NimBLERemoteCharacteristic.cpp @@ -616,7 +616,6 @@ bool NimBLERemoteCharacteristic::setNotify(uint16_t val, notify_callback notifyC NIMBLE_LOGD(LOG_TAG, "<< setNotify()"); - response = true; // Always write with response as per Bluetooth core specification. return desc->writeValue((uint8_t *)&val, 2, response); } // setNotify diff --git a/lib/libesp32_div/NimBLE-Arduino/src/NimBLERemoteCharacteristic.h b/lib/libesp32_div/NimBLE-Arduino/src/NimBLERemoteCharacteristic.h index 7042b19bf..353d83221 100644 --- a/lib/libesp32_div/NimBLE-Arduino/src/NimBLERemoteCharacteristic.h +++ b/lib/libesp32_div/NimBLE-Arduino/src/NimBLERemoteCharacteristic.h @@ -73,8 +73,8 @@ public: bool subscribe(bool notifications = true, notify_callback notifyCallback = nullptr, - bool response = true); - bool unsubscribe(bool response = true); + bool response = false); + bool unsubscribe(bool response = false); bool registerForNotify(notify_callback notifyCallback, bool notifications = true, bool response = true) diff --git a/lib/libesp32_div/NimBLE-Arduino/src/NimBLEServer.h b/lib/libesp32_div/NimBLE-Arduino/src/NimBLEServer.h index 19fecfdde..54bbb9ab1 100644 --- a/lib/libesp32_div/NimBLE-Arduino/src/NimBLEServer.h +++ b/lib/libesp32_div/NimBLE-Arduino/src/NimBLEServer.h @@ -58,7 +58,8 @@ public: int duration = 0, int max_events = 0); bool stopAdvertising(uint8_t inst_id); -#else +#endif +#if !CONFIG_BT_NIMBLE_EXT_ADV || defined(_DOXYGEN_) NimBLEAdvertising* getAdvertising(); bool startAdvertising(); #endif