45 KiB
Changelog
All notable changes to this project will be documented in this file.
[2.5.0] 2026-04-01
Fixed
NimBLEClientconnection state tracking.- Calling disconnect will no longer return false if the HCI response is "Unknown ID".
- Remote descriptors not found when characteristic vector handles out of order.
setValuewith char inputs now calculates the data length correctly.
Added
NimBLEServer::sendServiceChangedIndicationSends the service changed indication to peers so they refresh their database.NimBLEScanuser configuarable scan response timer added to prevent unreported devices on long duration scans.NimBLEClientConnection retry on connection establishment failure, retry count configurable by app, default 2.- ANCS Example
l2CapDisconnect API
[2.4.0] 2026-03-20
Fixed
- GATT attribute handles are now assigned from the registration callback so duplicate UUID attributes are identified correctly.
- Dynamic service changes now properly remove characteristics/descriptors and reset the GATT database when advertising starts.
- Missing notification/indication payload data when the value spans multiple mbufs, such as values larger than 255 bytes with small ACL buffers.
NimBLEDevice::createServerwill longer crash when called before the stack is initialized.- Re-pairing after deleting all bonds now works by unpairing each stored bond instead of only deleting NVS data.
- Whitelist bounds checks.
NimBLEDevice::getBondedAddressindex bounds validation.- Compiler warnings when bonds are disabled.
- kconfig warnings, redefined macros.
Added
NimBLEStream,NimBLEStreamClient, andNimBLEStreamServerclasses and examples.NimBLECppVersion.hwith compile-time version macros.NimBLEDevice::getVersionruntime version string helper.- Matching passkey callbacks for both roles:
NimBLEServerCallbacks::onPassKeyEntryandNimBLEClientCallbacks::onPassKeyDisplay. - Bond migration helpers to convert bond storage between v1 and current formats while preserving existing bonds.
NimBLEUUIDconstructor overload forble_uuid_t*.- Optional
indexparameter forNimBLECharacteristic::getDescriptorByUUIDto access multiple descriptors with the same UUID. NimBLEConnInfo::toStringmethod to get a string representation of the connection info.
Changed
NimBLEService::startis deprecated; services are now added when the server starts.NimBLEHIDDevice::startServices()is deprecated; services are now added when the server starts.
[2.3.4] 2025-12-27
Fixed
- Disconnect event not finding the client by address in some cases, use the connection handle instead.
- Notification/Indications will now be sent to server created clients.
- Attribute values will now consider type size when using a container.
- Descriptor searching will now correctly stop at the end handle of the characteristic.
Changed
- Build conditionals now use
MYNEWT_VAL_macros instead ofCONFIG_macros where applicable. - Sending of indications/notifications has been refactored for greater efficiency and tracks client subscription state locally instead uof relying on the stack.
Added
- Support for esp32c61.
NimBLECharacteristicCallbacks::onStatusoverload that takes aNimBLEConnInfo¶meter to indicate which client the status is for.NimBLEDevice::setCustomGapHandlernow takes avoid*parameter to allow for passing user data to the custom handler.
[2.3.3] 2025-09-05
Fixed
- NimBLEAdvertisedDevice::isConnectable returning incorrect result.
- Extended advertisements not reporting full data.
Added
- Support up to 1650 bytes of advertisement with extended advertising
[2.3.2] 2025-09-02
Fixed
- Build failures with esp-idf versions 4.x.
- Workaround for upstream issue causing onConnectFail to not be called.
- Build failures with idf v5.5+ and specific roles are not enabled.
Changed
- Allow peripheral and central roles to be used without broadcaster/observer roles.
- Where applicable,
MYNEWT_VAL_macros are used to control feature availability instead ofCONFIG_
[2.3.1] 2025-06-11
Fixed
- Build errors when disabling BLE roles.
NimBLEClient::readValuecall not returning when the instance was created with aNimBLEServerand reading a secured characteristic.NimBLEScandestructor potentially causing a crash.
Added
NimBLEBeacon::BeaconDatastd::vector<uint8_t>operator to allow it to be used as a parameter toNimBLEAdvertisementData::setManufacturerData.
[2.3.0] 2025-05-19
Fixed
- Incorrect
NimBLECharacteristic::onSubscribevalue when indications are set. NimBLECharacteristic::onReadcallback not called in some cases.- Clear attribute value when zero length value is written.
- Notify/Indicate incorrectly returning success with custom value.
- Corrected NimBLEClient array initialization.
- Prevent potential exception when scan is restarted.
- Attribute getValue failing with some data types
- Incorrectly passing a pointer to a function taking const reference.
Added
- Support for esp32c5
- L2CAP infrastructure.
- Scan duplicate cache reset time.
Changed
- Cleaned up examples.
- Allow PHY updates without enabling extended advertising.
[2.2.1] 2025-02-28
Fixed
- Added back
NimBLEClient::connectoverload withNimBLEAdvertisedDeviceparameter to resolve connection error due to NULL address. - Crash caused by returning invalid vector entry when retrieving remote descriptors.
[2.2.0] 2025-02-24
Fixed
- Crash when calling
NimBLEClient::DiscoverAttributes.
Added
- Conditional macros for logging.
NimBLEDeviceCallbacksclass with a callback for handling bond storage.
[2.1.1] 2025-01-26
Fixed
- remote descriptor discovery error when no descriptors exist.
- scan filter settings not enabled for esp32s3/c3.
- remote descriptor discovery returning more than the desired descriptor.
[2.1.0] 2025-01-12
Fixed
- Crash when retrieving descriptors if more than one exists.
- Incorrect TX power value being advertised.
- New user guide code for 2.x
- Potential race condition if `NimBLEScan::clearResults1 is called from multiple tasks.
Changed
- If privacy is not enabled identity keys will not be shared.
NimBLEDevice::setPowerandNimBLEDevice::getPowernow take an additional parameterNimBLETxPowerTypeto set/get the power level for different operations.
Added
- Config option
CONFIG_NIMBLE_CPP_ADDR_FMT_EXCLUDE_DELIMITER, if defined will remove the ":" delimiter from the BLE address string. - Config option
CONFIG_NIMBLE_CPP_ADDR_FMT_UPPERCASEif defined will make the BLE address strings uppercase.
[2.0.3] 2025-01-05
Fixed
- Unused variable warning when log level is below info.
- Build error missing definition of CONFIG_NIMBLE_CPP_FREERTOS_TASK_BLOCK_BIT in platformio.
- Race condition in
NimBLEScanthat can cause a crash due to heap corruption ifNimBLEScan::stopis called from theonResultcallback. - Advertisement data not set if scan response is enabled after the data is set.
NimBLECharacteristic/NimBLEDescriptornot able to update their values in theonReadcallback.- Too short of a timeout being requested in NimBLE_Server example leading to frequent disconnects.
Changed
NimBLEHIDDevicenow allows for the same report ID in multiple input/output/feature reports.
Added
- Config for custom log colors pre level.
- Error logs in the case that NIMBLE_CPP_DEBUG_ASSERT is not defined.
- Error logs when setting advertisement data fails.
- Missing documentation in the migration guide about enabling automatic advertising on disconnect, which was disabled by default in 2.x.
[2.0.2] 2024-12-21
Fixed
- Compile error when only advertising role is enabled.
- Possible crash if bonded client reconnects.
Changed
NimBLEHIDDevicecan now create more than one in/out/feature report map.
[2.0.1] 2024-12-16
Fixed
NimBLEHIDDevice::getOutputReportwill now return the correct characteristic.- Compile error when central is disabled, class
NimBLEServerhas no member namedm_pClient.
Changed
- Added missing includes for
NimBLEConnInfoandNimBLEUtilstoNimBLEDevice.h.
[2.0.0] 2024-12-14
Breaking changes
- All connection oriented callbacks now receive a reference to
NimBLEConnInfo, theble_gap_conn_deschas also been replace withNimBLEConnInfoin the functions that received it. - All functions that take a time input parameter now expect the value to be in milliseconds instead of seconds.
- Removed Eddystone URL as it has been shutdown by google since 2021.
- NimBLESecurity class removed.
NimBLEDeviceIgnore list functions removed.NimBLEDevice::startSecuritynow returns abool, true on success, instead of an int to be consistent with the rest of the library.NimBLEDevice::getInitializedrenamed toNimBLEDevice::isInitialized.NimBLEDevice::setPowerno longer takes theesp_power_level_tandesp_ble_power_type_t, instead only an integer value in dbm units is accepted.NimBLEDevice::setOwnAddrTypeno longer takes abool nrpaparameter.NimBLEDevice::getClientListSizereplaced withNimBLEDevice::getCreatedClientCount.NimBLEDevice::getClientListwas removed.NimBLEServer::disconnectnow returnsbool, true = success, instead ofintto be consistent with the rest of the library.NimBLEServerCallbacks::onMTUChangedrenamed toNimBLEServerCallbacks::onMTUChangeto be consistent with the client callback.NimBLEServer::getPeerIDInforenamed toNimBLEServer::getPeerInfoByHandleto better describe it's use.NimBLEServerCallbacks::onPassKeyRequesthas been replaced withNimBLEServer::onPassKeyDisplaywhich should display the pairing pin that the client is expected to send.NimBLEServerCallbacks::onAuthenticationCompletenow takes aNimBLEConnInfo¶meter.NimBLEClient::getServicesnow returns a const reference to std::vector<NimBLERemoteService*> instead of a pointer to the internal vector.NimBLEClient::getConnIdhas been renamed togetConnHandleto be consistent with bluetooth terminology.NimBLEClient::disconnectnow returns abool, true on success, instead of an int to be consistent with the rest of the library.NimBLEClientCallbacks::onDisconnectnow takes an additionalint reasonparameter to let the application know why the disconnect occurred.NimBLEClientCallbacks::onPassKeyRequesthas been changed toNimBLEClientCallbacks::onPassKeyEntrywhich takes aNimBLEConnInfo¶meter and does not return a value. Instead or returning a value this callback should prompt a user to enter a pin number which is sent later viaNimBLEDevice::injectPassKey.NimBLEClientCallbacks::onConfirmPINrenamed toNimBLEClientCallbacks::onConfirmPasskeyand no longer returns a value and now takes aNimBLEConnInfo¶meter. This should be used to prompt a user to confirm the pin on the display (YES/NO) after which the response should be sent withNimBLEDevice::injectConfirmPasskey.NimBLEAdvertising::setMinPreferredandNimBLEAdvertising::setMaxPreferredhave been removed, useNimBLEAdvertising::setPreferredParamsinstead.- Advertising the name and TX power of the device will no longer happen by default and should be set manually by the application.
NimBLEAdvertising::setAdvertisementTypehas been renamed toNimBLEAdvertising::setConnectableModeto better reflect it's function.NimBLEAdvertising::setScanResponsehas been renamed toNimBLEAdvertising::enableScanResponseto better reflect it's function.NimBLEAdvertising; Scan response is no longer enabled by default.NimBLEAdvertising::startNo longer takes a callback pointer parameter, instead the new methodNimBLEAdvertising::setAdvertisingCompleteCallbackshould be used.NimBLEAdvertisementData::addDatanow takes either astd::vector<uint8_t>oruint8_t* + lengthinstead ofstd::stringorchar + length.NimBLEAdvertisementData::getPayloadnow returnsstd::vector<uint8_t>instead ofstd::string.- The callback parameter for
NimBLEScan::starthas been removed and the blocking overload ofNimBLEScan::starthas been replaced by an overload ofNimBLEScan::getResultswith the same parameters. NimBLEAdvertisedDeviceCallbacksHas been replaced byNimBLEScanCallbackswhich contains the following methods:onResult,onScanEnd, and `onDiscovered-
NimBLEScanCallbacks::onResult, functions the same as the oldNimBLEAdvertisedDeviceCallbacks::onResultbut now takes aaconst NimBLEAdvertisedDevice*instead of non-const.
-
NimBLEScanCallbacks::onScanEnd, replaces the scanEnded callback passed toNimBLEScan::startand now takes aconst NimBLEScanResults&andint reasonparameter.
-
NimBLEScanCallbacks::onDiscovered, This is called immediately when a device is first scanned, before any scan response data is available and takes aconst NimBLEAdvertisedDevice*parameter.
NimBLEScan::stopwill no longer call theonScanEndcallback as the caller should know its been stopped when this is called.NimBLEScan::clearDuplicateCachehas been removed as it was problematic and only for the esp32. Stop and start the scanner for the same effect.NimBLEScanResults::getDevicemethods now returnconst NimBLEAdvertisedDevice*.NimBLEScanResultsiterators are nowconst_iterator.NimBLEAdvertisedDevice::hasRSSIremoved as redundant, RSSI is always available.NimBLEAdvertisedDevice::getPayloadnow returnsconst std::vector<uint8_t>instead of a pointer to internal memory.NimBLEAdvertisedDeviceTimestamp removed, if needed then the app should track the time from the callback.NimBLECharacteristic::notifyno longer takes abool is_notificationparameter, insteadindicate()should be called to send indications.NimBLECharacteristicCallbacks::onNotifyremoved as unnecessary, the library does not call notify without app input.NimBLECharacteristicCallbacks::onStatusNo longer takes astatusparameter, refer to the return code for success/failure.NimBLERemoteCharacteristic::getRemoteServicenow returns aconst NimBLERemoteService*instead of non-const.NimBLERemoteCharacteristic::readUInt32Has been removed.NimBLERemoteCharacteristic::readUInt16Has been removed.NimBLERemoteCharacteristic::readUInt8Has been removed.NimBLERemoteCharacteristic::readFloatHas been removed.NimBLERemoteCharacteristic::registerForNotifyHas been removed.NimBLERemoteService::getCharacteristicsnow returns aconst std::vector<NimBLERemoteCharacteristic*>&instead of non-conststd::vector<NimBLERemoteCharacteristic*>*.NimBLERemoteService::getValuenow returnsNimBLEAttValueinstead ofstd::string.NimBLEService::getCharacteristicsnow returns aconst std::vector<NimBLECharacteristic*>&instead of std::vector<NimBLECharacteristic *>.NimBLEUUID::getNativemethod replaced withNimBLEUUID::getBasewhich returns a read-only pointer to the underlyingble_uuid_tstruct.NimBLEUUID;msbFirstparameter has been removed from constructor, caller should reverse the data first or call the newreverseByteOrdermethod after.NimBLEAddressconstructor; default value for thetypeparameter removed, caller should know the address type and specify it.NimBLEAddress::getNativereplaced withNimBLEAddress::getBaseand now returns a pointer toconst ble_addr_tinstead of a pointer to the address value.NimBLEAddress::equalsmethod andNimBLEAddress::== operatorwill now also test if the address types are the same.NimBLEUtils::dumpGapEventfunction removed.NimBLEUtils::buildHexDatareplaced withNimBLEUtils::dataToHexString, which returns astd::stringcontaining the hex string.NimBLEEddystoneTLM::setTempnow takes anint16_tparameter instead of float to be friendly to devices without floating point support.NimBLEEddystoneTLM::getTempnow returnsint16_tto work with devices that don't have floating point support.NimBLEEddystoneTLM::setDatanow takes a reference to *NimBLEEddystoneTLM::BeaconDatainstead ofstd::string.NimBLEEddystoneTLM::getDatanow returns a reference to *NimBLEEddystoneTLM::BeaconDatainstead ofstd::string.NimBLEBeacon::setDatanow takesconst NimBLEBeacon::BeaconData&instead ofstd::string.NimBLEBeacon::getDatanow returnsconst NimBLEBeacon::BeaconData&instead ofstd::string.NimBLEHIDDevice::reportMaprenamed toNimBLEHIDDevice::getReportMap.NimBLEHIDDevice::hidControlrenamed toNimBLEHIDDevice::getHidControl.NimBLEHIDDevice::inputReportrenamed toNimBLEHIDDevice::getInputReport.NimBLEHIDDevice::outputReportrenamed toNimBLEHIDDevice::getOutputReport.NimBLEHIDDevice::featureReportrenamed toNimBLEHIDDevice::getFeatureReport.NimBLEHIDDevice::protocolModerenamed toNimBLEHIDDevice::getProtocolMode.NimBLEHIDDevice::bootOutputrenamed toNimBLEHIDDevice::getBootOutput.NimBLEHIDDevice::pnprenamed toNimBLEHIDDevice::setPnp.NimBLEHIDDevice::hidInforenamed toNimBLEHIDDevice::setHidInfo.NimBLEHIDDevice::deviceInforenamed toNimBLEHIDDevice::getDeviceInfoService.NimBLEHIDDevice::hidServicerenamed toNimBLEHIDDevice::getHidService.NimBLEHIDDevice::batteryServicerenamed toNimBLEHIDDevice::getBatteryService.
Fixed
NimBLEDevice::getPowerandNimBLEDevice::getPowerLevelbug worked around for the esp32s3 and esp32c3.NimBLEDevice::setPowerandNimBLEDevice::getPowernow support the full power range for all esp devices.NimBLEDevice::setOwnAddrTypewill now correctly apply the provided address type for all devices.NimBLEDevice::getPower(esp32) return value is now calculated to support devices with different min/max ranges.- Crash if
NimBLEDevice::deinitis called when the stack has not been initialized. NimBLEServerservice changed notifications will now wait until the changes have taken effect and the server re-started before indicating the change to peers, reducing difficultly for some clients to update their data.NimBLEService::getHandlewill now fetch the handle from the stack if not valid to avoid returning an invalid value.std::vectorinput to set/write values template.NimBLEHIDDevice::pnpwill now set the data correctly.- Check for Arduino component
- Fixed building with esp-idf version 5.x.
- Fixed pairing failing when the process was started by the peer first.
- Fixed building with esp-idf and Arduino component.
- Workaround for esp32s3 and esp32c3 not returning the correct txPower with some IDF versions.
Changed
NimBLEClient::secureConnectionnow takes an additional parameterbool async, if true, will send the secure command and return immediately with a true value for successfully sending the command, else false. This allows for asynchronously securing a connection.- Deleting the client instance from the
onDisconnectcallback is now supported. NimBLEClient::connectwill no longer cancel already in progress connections.NimBLEClient::setDataLennow returns bool, true if successful.NimBLEClient::updateConnParamsnow returns bool, true if successful.NimBLEClient::setPeerAddressnow returns a bool, true on success.NimBLEDevice::startSecuritynow takes and additional parameterint* rcPtrwhich will provide the return code from the stack if provided.NimBLEDevice::deleteClientno longer blocks tasks.NimBLEDevice::getAddresswill now return the address currently in use.NimBLEDevice::initnow returns a bool withtrueindicating success.NimBLEDevice::deinitnow returns a bool withtrueindicating success.NimBLEDevice::setDeviceNamenow returns a bool withtrueindicating success.NimBLEDevice::setCustomGapHandlernow returns a bool withtrueindicating success.NimBLEDevice::setOwnAddrTypenow returns a bool withtrueindicating success and works with non-esp32 devices.NimBLEDevice::setPowernow returns a bool value, true = success.NimBLEDevice::setMTUnow returns a bool value, true = success.NimBLEDevice::deleteAllBondsnow returns true on success, otherwise false.NimBLEEddystoneTLMinternal data struct typeBeaconDatais now public and usable by the application.NimBLEBeaconinternal data struct typeBeaconDatais now public and can be used by the application.- Removed tracking of client characteristic subscription status from
NimBLEServerandNimBLECharacteristicand instead uses the functions and tracking in the host stack. NimBLECharacteristic::indicatenow takes the same parameters asnotify.NimBLECharacteristic::notifyandNimBLECharacteristic::indicatenow return abool, true = success.- Added optional
connHandleparameter toNimBLECharacteristic::notifyto allow for sending notifications to specific clients. NimBLEServerNow uses a std::array to store client connection handles instead of std::vector to reduce memory allocation.NimBLEExtAdvertisement: All functions that set data now returnbool, true = success.NimBLEAdvertisingAdvertising data is now stored in instances ofNimBLEAdvertisingDataand old vectors removed.NimBLEAdvertising::setAdvertisementDataandNimBLEAdvertising::setScanResponseDatanow returnbool, true = success.- Added optional
NimBLEAddressparameter toNimBLEAdvertising::startto allow for directed advertising to a peer. - All
NimBLEAdvertisingfunctions that change data values now returnbool, true = success. - All
NimBLEAdvertisementDatafunctions that change data values now returnbool, true = success. NimBLEAdvertisingadvertising complete callback is now defined as std::function to allow for using std::bind for callback functions.NimBLEAdvertisementData::setNamenow takes an optionalboolparameter to indicate if the name is complete or incomplete, default = complete.NimBLEAdvertisementDatamoved to it's own .h and .cpp files.NimBLEScan::starttakes a newbool restartparameter, defaulttrue, that will restart an already in progress scan and clear the duplicate filter so all devices will be discovered again.- Scan response data that is received without advertisement first will now create the device and send a callback.
NimBLEScan::startwill no longer clear cache or results if scanning is already in progress.NimBLEScan::startwill now allow the start command to be sent with updated parameters if already scanning.NimBLEScan::clearResultswill now reset the vector capacity to 0.- Host reset will now no longer restart scanning and instead will call
NimBLEScanCallbacks::onScanEnd. - Added optional
indexparameter toNimBLEAdvertisedDevice::getPayloadByType NimBLEAdvertisedDevice::getManufacturerDatanow takes an optional index parameter for use in the case of multiple manufacturer data fields.NimBLEUtils: Add missing GAP event strings.NimBLEUtils: Add missing return code strings.NimBLEUtils: Event/error code strings optimized.NimBLEAttValuecleanup and optimization.- cleaned up code, removed assert/abort calls, replaced with a configurable option to enable debug asserts.
Added
- (esp32 specific)
NimBLEDevice::setPowerLevelandNimBLEDevice::getPowerLevelwhich take and return the relatedesp_power_level*types. NimBLEDevice::setDefaultPhywhich will set the default preferred PHY for all connections.NimBLEDevice::getConnectedClients, which returns a vector of pointers to the currently connected client instances.NimBLEDevice::setOwnAddrfunction added, which takes auint8_t*orNimBLEAddress&and will set the mac address of the device, returnsbooltrue= success.NimBLEDevice::injectPassKeyUsed to send the pairing passkey instead of a return value from the client callback.NimBLEDevice::injectConfirmPasskeyUsed to send the numeric comparison pairing passkey confirmation instead of a return value from the client callback.NimBLEDevice::setDeviceNameto change the device name after initialization.NimBLECharacteristic::create2904which will specifically create a Characteristic Presentation Format (0x2904) descriptor.NimBLEAdvertising::refreshAdvertisingDatarefreshes the advertisement data while still actively advertising.NimBLEClient::updatePhyto request a PHY change with a peer.NimBLEClient::getPhyto read the current connection PHY setting.Configstruct toNimBLEClientto efficiently set single bit config settings.NimBLEClient::setSelfDeletethat takes the bool parametersdeleteOnDisconnectanddeleteOnConnectFail, which will configure the client to delete itself when disconnected or the connection attempt fails.NimBLEClient::setConfigandNimBLEClient::getConfigwhich takes or returns aNimBLEClient::Configobject respectively.NimBLEClient::cancelConnect()to cancel an in-progress connection, returnsbool, true = success.- Non-blocking
NimBLEClient::connectoption added via 2 newboolparameters added to the function: -
asyncConnect; if true, will send the connect command and return immediately.
-
exchangeMTU; if true will send the exchange MTU command upon connection.
NimBLEClientCallbacks::onConnectFailcallback that is called when the connection attempt fail while connecting asynchronously.NimBLEClientCallbacks::onMTUChangecallback which will be called when the MTU exchange completes and takes aNimBLEClient*anduint16_t MTUparameter.NimBLEClientCallbacks::onPhyUpdateand -NimBLEServerCallbacks::onPhyUpdateWhich are called when the PHY update is complete.- Extended scan example.
NimBLEServer::updatePhyto request a PHY change with a peer.NimBLEServer::getPhyto read the PHY of a peer connection.NimBLEServer::getClientwhich will create a client instance from the provided peer connHandle or connInfo to facilitate reading/write from the connected client.NimBLEServerCallbacks::onConnParamsUpdatecallback.NimBLEScan::eraseoverload that takes aconst NimBLEAdvertisedDevice*parameter.NimBLEScan::setScanPhyto enable/disable the PHY's to scan on (extended advertising only).NimBLEScan::setScanPeriodwhich will allow for setting a scan restart timer in the controller (extended advertising only).NimBLEAdvertisedDevice::isScannable()that returns true if the device is scannable.NimBLEAdvertisedDevice::beginandNimBLEAdvertisedDevice::endread-only iterators for convenience and use in range loops.NimBLEAdvertisedDevice::getAdvFlagsreturns the advertisement flags of the advertiser.NimBLEAdvertisedDevice::getPayloadByTypeGeneric use function that returns the data from the advertisement with the specified type.NimBLEAdvertisedDevice::haveTypeGeneric use function that returns true if the advertisement data contains a field with the specified type.- Support for esp32c6, esp32c2, esp32h2, and esp32p4.
NimBLEExtAdvertisement::removeData, which will remove the data of the specified type from the advertisement.NimBLEExtAdvertisement::addServiceUUID, which will append to the service uuids advertised.NimBLEExtAdvertisement::removeServiceUUID, which will remove the service from the uuids advertised.NimBLEExtAdvertisement::removeServices, which will remove all service uuids advertised.- New overloads for
NimBLEExtAdvertisement::setServiceDatawith the parametersconst NimBLEUUID& uuid, const uint8_t* data, size_t lengthandconst NimBLEUUID& uuid, const std::vector<uint8_t>& data. NimBLEExtAdvertisement::getDataLocation, which returns the location in the advertisement data of the type requested in parameteruint8_t type.NimBLEExtAdvertisement::toStringwhich returns a hex string representation of the advertisement data.NimBLEAdvertising::getAdvertisementData, which returns a reference to the currently set advertisement data.NimBLEAdvertising::getScanData, which returns a reference to the currently set scan response data.- New overloads for
NimBLEAdvertising::removeServiceUUIDandNimBLEAdvertisementData::removeServiceUUIDto accept aconst char* NimBLEAdvertising::clearData, which will clear the advertisement and scan response data.NimBLEAdvertising::setManufacturerDataOverload that takes aconst uint8_t*and , size_t` parameter.NimBLEAdvertising::setServiceDataOverload that takesconst NimBLEUUID& uuid,const uint8_t* data,size_t lengthas parameters.NimBLEAdvertising::setServiceDataOverload that takesconst NimBLEUUID& uuid,const std::vector<uint8_t>&as parameters.NimBLEAdvertising::setDiscoverableModeto allow applications to control the discoverability of the advertiser.NimBLEAdvertising::setAdvertisingCompleteCallbacksets the callback to call when advertising ends.NimBLEAdvertising::setPreferredParamsthat takes the min and max preferred connection parameters as an alternative forsetMinPreferredandsetMaxPreferred.NimBLEAdvertising::setAdvertisingIntervalSets the advertisement interval for min and max to the same value instead of callingsetMinIntervalandsetMaxIntervalseparately if there is not value difference.NimBLEAdvertisementData::removeData, which takes a parameteruint8_t type, the data type to remove.NimBLEAdvertisementData::toString, which will print the data in hex.NimBLEUtils::taskWaitwhich causes the calling task to wait for an event.NimBLEUtils::taskReleasereleases the task from and event.NimBLEUtils::generateAddrfunction added with will generate a random address and takes aboolparameter, true = create non-resolvable private address, otherwise a random static address is created, returnsNimBLEAddress.NimBLEUUID::getValuewhich returns a read-onlyuint8_tpointer to the UUID value.NimBLEUUID::reverseByteOrder, this will reverse the bytes of the UUID, which can be useful for advertising/logging.NimBLEUUIDconstructor overload that takes a reference toble_uuid_any_t.NimBLEAddress::isNrpamethod to test if an address is random non-resolvable.NimBLEAddress::isStaticmethod to test if an address is random static.NimBLEAddress::isPublicmethod to test if an address is a public address.NimBLEAddress::isNullmethods to test if an address is NULL.NimBLEAddress::getValuemethod which returns a read-only pointer to the address value.NimBLEAddress::reverseByteOrdermethod which will reverse the byte order of the address value.NimBLEHIDDevice::batteryLevelreturns the HID device battery level characteristic.NimBLEBeacon::setDataoverload that takesuint8_t* dataanduint8_t length.NimBLEHIDDevice::getPnpfunction added to access the pnp characteristic.NimBLEHIDDevice::getHidInfofunction added to access the hid info characteristic.
[1.4.1] - 2022-10-30
Fixed
- 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 Builds
[1.4.0] - 2022-07-31
Fixed
- Fixed missing data from long notification values.
- Fixed NimbleCharacteristicCallbacks::onRead not being called when a non-long read command is received.
- Prevent a potential crash when retrieving characteristics from a service if the result was successful but no characteristics found.
- logs/typos.
Changed
- AD flags are no longer set in the advertisements of non-connectable beacons, freeing up 3 bytes of advertisement room.
- Save resources when retrieving descriptors if the characteristic handle is the same as the end handle (no descriptors).
- Subscribing to characteristic notifications/indications will now always use write with response, as per BLE specifications.
NimBLEClient::discoverAttributesnow returns a bool value to indicate success/failure.- Scan result callbacks are no longer called when the scan response data is updated in order to reduce duplicates.
Added
- Preliminary support for non-esp devices, NRF51 and NRF52 devices supported with n-able arduino core
- Alias added for
NimBLEServerCallbacks::onMTUChangetoonMtuChangedin order to support porting code from original library. NimBLEAttValueClass added to reduce and control RAM footprint of characteristic/descriptor values and support conversions from Arduino Strings and many other data types.- Bluetooth 5 extended advertising support for capable devices. CODED Phy, 2M Phy, extended advertising data, and multi-advertising are supported, periodic advertising will be implemented in the future.
[1.3.3] - 2022-02-15
Changed
- If attribute retrieval fails with a "not found" try again with the 16 bit version if a 128 bit base uuid is used.
Fixed
- Memory leak when deleting client instance.
- IDf version check for data length extension.
- Memory leak when server services changed.
- Compiler warnings for non-esp32 devices.
[1.3.2] - 2022-01-15
Fixed
- Initialize advertising complete callback in NimBLEAdvertising constructor.
- Clear client disconnect timer in constructor before initializing.
- Fix missing data when reading large values.
- Fix missing data in notifications when using a large MTU size and more than 270 bytes of data are sent.
- Workaround fix added for cases when the task notification value is not cleared, causing various functions that should block not to block.
Added
NimBLEClient::getLastError: Gets the error code of the last function call that produces a return code from the stack.NimBLECharacteristic::notify: Overload method to send notifications/indications with custom values.- Added conditional checks for ESP32 specific functions/values to support use of the library on non-esp32 devices.
- Added an alias to use the callback name from the original library
onMtuChanged. NimBLEClient::setDataLenandNimBLEServer::setDataLen: Data length extension support (IDF version >= 4.3.2 only)- Config option to set logging level for esp-nimble-cpp
Changed
- Critical section calls now use the NimBLE API instead of FreeRTOS directly. This removes the need for a
portMUX_TYPEvariable in the class definitions. - Removed unnecessary variables in
NimBLEServiceand changed the constructor no no longer acceptnumHandlesandinst_idparameters.
[1.3.1] - 2021-08-04
Fixed
- Corrected a compiler/linker error when an application or a library uses bluetooth classic due to the redefinition of
btInUse.
[1.3.0] - 2021-08-02
Added
-
NimBLECharacteristic::removeDescriptor: Dynamically remove a descriptor from a characteristic. Takes effect after all connections are closed and sends a service changed indication. -
NimBLEService::removeCharacteristic: Dynamically remove a characteristic from a service. Takes effect after all connections are closed and sends a service changed indication -
NimBLEServerCallbacks::onMTUChange: This is callback is called when the MTU is updated after connection with a client. -
ESP32C3 support
-
Whitelist API:
NimBLEDevice::whiteListAdd: Add a device to the whitelist.NimBLEDevice::whiteListRemove: Remove a device from the whitelist.NimBLEDevice::onWhiteList: Check if the device is on the whitelist.NimBLEDevice::getWhiteListCount: Gets the size of the whitelistNimBLEDevice::getWhiteListAddress: Get the address of a device on the whitelist by index value.
-
Bond management API:
NimBLEDevice::getNumBonds: Gets the number of bonds stored.NimBLEDevice::isBonded: Checks if the device is bonded.NimBLEDevice::deleteAllBonds: Deletes all bonds.NimBLEDevice::getBondedAddress: Gets the address of a bonded device by the index value.
-
NimBLECharacteristic::getCallbacksto retrieve the current callback handler. -
Connection Information class:
NimBLEConnInfo. -
NimBLEScan::clearDuplicateCache: This can be used to reset the cache of advertised devices so they will be immediately discovered again.
Changed
- FreeRTOS files have been removed as they are not used by the library.
- Services, characteristics and descriptors can now be created statically and added after.
- Excess logging and some asserts removed.
- Use ESP_LOGx macros to enable using local log level filtering.
Fixed
NimBLECharacteristicCallbacks::onSubscribeIs now called after the connection is added to the vector.- Corrected bonding failure when reinitializing the BLE stack.
- Writing to a characteristic with a std::string value now correctly writes values with null characters.
- Retrieving remote descriptors now uses the characteristic end handle correctly.
- Missing data in long writes to remote descriptors.
- Hanging on task notification when sending an indication from the characteristic callback.
- BLE controller memory could be released when using Arduino as a component.
- Compile errors with NimBLE release 1.3.0.
[1.2.0] - 2021-02-08
Added
-
NimBLECharacteristic::getDescriptorByHandle: Return the BLE Descriptor for the given handle. -
NimBLEDescriptor::getStringValue: Get the value of this descriptor as a string. -
NimBLEServer::getServiceByHandle: Get a service by its handle. -
NimBLEService::getCharacteristicByHandle: Get a pointer to the characteristic object with the specified handle. -
NimBLEService::getCharacteristics: Get the vector containing pointers to each characteristic associated with this service. Overloads to get a vector containing pointers to all the characteristics in a service with the UUID. (supports multiple same UUID's in a service)NimBLEService::getCharacteristics(const char *uuid)NimBLEService::getCharacteristics(const NimBLEUUID &uuid)
-
NimBLEAdvertisementDataNew methods:NimBLEAdvertisementData::addTxPower: Adds transmission power to the advertisement.NimBLEAdvertisementData::setPreferredParams: Adds connection parameters to the advertisement.NimBLEAdvertisementData::setURI: Adds URI data to the advertisement.
-
NimBLEAdvertisingNew methods:NimBLEAdvertising::setName: Set the name advertised.NimBLEAdvertising::setManufacturerData: Adds manufacturer data to the advertisement.NimBLEAdvertising::setURI: Adds URI data to the advertisement.NimBLEAdvertising::setServiceData: Adds service data to the advertisement.NimBLEAdvertising::addTxPower: Adds transmission power to the advertisement.NimBLEAdvertising::reset: Stops the current advertising and resets the advertising data to the default values.
-
NimBLEDevice::setScanFilterMode: Set the controller duplicate filter mode for filtering scanned devices. -
NimBLEDevice::setScanDuplicateCacheSize: Sets the number of advertisements filtered before the cache is reset. -
NimBLEScan::setMaxResults: This allows for setting a maximum number of advertised devices stored in the results vector. -
NimBLEAdvertisedDeviceNew data retrieval methods added:-
haveAdvInterval/getAdvInterval: checks if the interval is advertised / gets the advertisement interval value. -
haveConnParams/getMinInterval/getMaxInterval: checks if the parameters are advertised / get min value / get max value. -
haveURI/getURI: checks if a URI is advertised / gets the URI data. -
haveTargetAddress/getTargetAddressCount/getTargetAddress(index): checks if a target address is present / gets a count of the addresses targeted / gets the address of the target at index.
-
Changed
-
nimconfig.h(Arduino) is now easier to use. -
NimBLEServer::getServiceByUUIDNow takes an extra parameter of instanceID to support multiple services with the same UUID. -
NimBLEService::getCharacteristicNow takes an extra parameter of instanceID to support multiple characteristics with the same UUID. -
NimBLEAdvertisingTransmission power is no longer advertised by default and can be added to the advertisement by callingNimBLEAdvertising::addTxPower -
NimBLEAdvertisingCustom scan response data can now be used without custom advertisement. -
NimBLEScanNow uses the controller duplicate filter. -
NimBLEAdvertisedDeviceHas been refactored to store the complete advertisement payload and no longer parses the data from each advertisement. Instead the data will be parsed on-demand when the user application asks for specific data.
Fixed
NimBLEHIDDeviceCharacteristics now use encryption, this resolves an issue with communicating with devices requiring encryption for HID devices.
[1.1.0] - 2021-01-20
Added
-
NimBLEDevice::setOwnAddrTypeadded to enable the use of random and random-resolvable addresses, by asukiaaa -
New examples for securing and authenticating client/server connections, by mblasee.
-
NimBLEAdvertising::SetMinPreferredandNimBLEAdvertising::SetMinPreferredre-added. -
Conditional checks added for command line config options in
nimconfig.hto support custom configuration in platformio. -
NimBLEClient::setValueNow takes an extra bool parameterresponseto enable the use of write with response (default = false). -
NimBLEClient::getCharacteristic(uint16_t handle)Enabling the use of the characteristic handle to be used to find the NimBLERemoteCharacteristic object. -
NimBLEHIDDeviceclass added by wakwak-koba. -
NimBLEServerCallbacks::onDisconnectoverloaded callback added to provide a ble_gap_conn_desc parameter for the application to obtain information about the disconnected client. -
Conditional checks in
nimconfig.hfor command line defined macros to support platformio config settings.
Changed
-
NimBLEAdvertising::startnow returns a bool value to indicate success/failure. -
Some asserts were removed in
NimBLEAdvertising::startand replaced with better return code handling and logging. -
If a host reset event occurs, scanning and advertising will now only be restarted if their previous duration was indefinite.
-
NimBLERemoteCharacteristic::subscribeandNimBLERemoteCharacteristic::registerForNotifywill now set the callback regardless of the existence of the CCCD and return true unless the descriptor write operation failed. -
Advertising tx power level is now sent in the advertisement packet instead of scan response.
-
NimBLEScanWhen the scan ends the scan stopped flag is now set before calling the scan complete callback (if used) this allows the starting of a new scan from the callback function.
Fixed
-
Sometimes
NimBLEClient::connectwould hang on the task block if no event arrived to unblock. A time limit has been added to timeout appropriately. -
When getting descriptors for a characteristic the end handle of the service was used as a proxy for the characteristic end handle. This would be rejected by some devices and has been changed to use the next characteristic handle as the end when possible.
-
An exception could occur when deleting a client instance if a notification arrived while the attribute vectors were being deleted. A flag has been added to prevent this.
-
An exception could occur after a host reset event when the host re-synced if the tasks that were stopped during the event did not finish processing. A yield has been added after re-syncing to allow tasks to finish before proceeding.
-
Occasionally the controller would fail to send a disconnected event causing the client to indicate it is connected and would be unable to reconnect. A timer has been added to reset the host/controller if it expires.
-
Occasionally the call to start scanning would get stuck in a loop on BLE_HS_EBUSY, this loop has been removed.
-
16bit and 32bit UUID's in some cases were not discovered or compared correctly if the device advertised them as 16/32bit but resolved them to 128bits. Both are now checked.
-
FreeRTOScompile errors resolved in latest Arduino core and IDF v3.3. -
Multiple instances of
time()called inside critical sections caused sporadic crashes, these have been moved out of critical regions. -
Advertisement type now correctly set when using non-connectable (advertiser only) mode.
-
Advertising payload length correction, now accounts for appearance.
-
(Arduino) Ensure controller mode is set to BLE Only.
[1.0.2] - 2020-09-13
Changed
-
NimBLEAdvertising::startNow takes 2 optional parameters, the first is the duration to advertise for (in seconds), the second is a callback that is invoked when advertising ends and takes a pointer to aNimBLEAdvertisingobject (similar to theNimBLEScan::startAPI). -
(Arduino) Maximum BLE connections can now be altered by only changing the value of
CONFIG_BT_NIMBLE_MAX_CONNECTIONSinnimconfig.h. Any changes to the controller max connection settings insdkconfig.hwill now have no effect when using this library. -
(Arduino) Revert the previous change to fix the advertising start delay. Instead a replacement fix that routes all BLE controller commands from a task running on core 0 (same as the controller) has been implemented. This improves response times and reliability for all BLE functions.
[1.0.1] - 2020-09-02
Added
- Empty
NimBLEAddressconstructor:NimBLEAddress()produces an address of 00:00:00:00:00:00 type 0. - Documentation of the difference of NimBLEAddress::getNative vs the original bluedroid library.
Changed
- notify_callback typedef is now defined as std::function to enable the use of std::bind to call a class member function.
Fixed
- Fix advertising start delay when first called.
[1.0.0] - 2020-08-22
First stable release.
All the original library functionality is complete and many extras added with full documentation.