Commit Graph
366 Commits
Author SHA1 Message Date
h2zero ce1b8bc2ec Fix build with non-esp devices 2025-05-05 14:38:07 -06:00
h2zero dadbc0d423 [Bugfix] Correct NimBLEClient array initialization. 2025-05-03 15:00:43 -06:00
h2zero da31f90436 Fix build when host based privacy is enabled without connection roles 2025-05-03 14:59:24 -06:00
Dr. Michael Lauer e55ad9019c Introduce L2CAP infrastructure.
L2CAP is the underlying technology powering GATT.
BLE 5 exposes L2CAP COC (Connection Oriented Channels)
allowing a streaming API that leads to much higher throughputs
than you can achieve with updating GATT characteristics.

The patch follows the established infrastructure very closely.
The main components are:

- `NimBLEL2CAPChannel`, encapsulating an L2CAP COC.
- `NimBLEL2CAPServer`, encapsulating the L2CAP service.
- `Examples/L2CAP`, containing a client and a server application.

Apart from these, only minor adjustments to the existing code was
necessary.
2025-04-28 10:54:32 -06:00
h2zero 59e111ab55 Allow PHY updates without enabling extended advertising. 2025-04-25 09:07:23 -06:00
h2zero e00dd88add [Bugfix] notify/indicate incorrectly returning success with custom value
When sending an array of data with a length value the wrong overload/template was being
used and the length value was being interpreted as the connection handle.

This updates the template to disable it when an array is passed and will now also report the error.
2025-04-24 17:08:19 -06:00
h2zero e18d78678f [Bugfix] Explicit getValue template returning nil value with convertable types. 2025-04-24 17:07:42 -06:00
h2zero 54ec3f4c92 [Bugfix] Clear attribute value when zero length value is written. 2025-04-24 17:07:20 -06:00
thekurtovic 9ac9551a2b fix(Utils): Update gapEventToString switch case 2025-04-22 16:08:57 -06:00
h2zero 0172cb4b39 Only ignore scan discovery events when scan is stopped. 2025-04-14 08:52:32 -06:00
h2zero 856adebad5 Fix potential exception when scan is restarted.
If the scan is restarted in NimBLEScan::start, there is a chance that a result from
the previous scan arrives and the device is deleted when the callback is called.
This change ignores any results that come when the scan has stopped.
2025-04-14 08:39:28 -06:00
h2zero d134276d2d Bugfix - Characteristic onRead callback not called.
Fixes detection of the original read request vs a followup read for characteristic values greater than MTU - 3.
2025-04-13 15:13:53 -06:00
h2zero 01976cec54 [Bugfix] Incorrect onSubscribe value when indications are set. 2025-03-28 16:56:54 -06:00
iranl 148087c508 Fix ESP32-P4 compile when using Arduino as an ESP-IDF component 2025-03-02 21:46:34 +01:00
h2zero 9df8445241 [Bugfix] Check if remote descriptor vector has increased. 2025-02-25 17:08:01 -07:00
h2zero 7ef247c8db Partially revert Commit 052c0a04 to restore client connect with device parameter. 2025-02-25 14:23:25 -07:00
h2zero c582c8c67e Release 2.2.0 2025-02-24 17:58:21 -07:00
William Emfinger 74b5c59887 fix(NimBLEDevice): fix crash when pairing table is full
* Add missing definition for default device callbacks (which prevents calling the `setDeviceCallbacks` method)
* Ensure `m_pDeviceCallbacks` inital value is set to `&defaultDeviceCallbacks` to prevent crash when pairing table is full

After #295 any time the pairing table fills up, the device will crash on the next pairing attempt.
2025-02-13 06:58:54 -07:00
h2zero 60efffdf2b [BugFix] Provide default task data when retrieving all descriptors.
* Update the descriptor filter when trying again with different UUID sizes.
2025-02-08 15:08:32 -07:00
thekurtovic b6379848ae change(2904|AdvData): Add missing parameter name in declarations 2025-02-05 15:15:49 -07:00
thekurtovic b29919df96 feat(Device): Implement store status handler 2025-02-05 15:14:42 -07:00
thekurtovic 052c0a0455 feat(AdvDevice): Add convenience operator to NimBLEAddress 2025-02-05 14:07:10 -07:00
thekurtovic 5490cef129 feat(Log): Add macros for conditional log print and rc handling 2025-01-28 13:40:19 -05:00
thekurtovic ffa8414747 refactor(RemoteChar): Reduce nesting
* Renamed desc_filter_t to NimBLEDescriptorFilter
* Added NimBLERemoteDescriptor pointer to NimBLEDescriptorFilter
* retrieveDescriptors changed to take NimBLEDescriptorFilter pointer
* General cleanup
2025-01-26 11:28:48 -07:00
h2zero 8130f88be8 Rename config macros to enable duplicate scan options on s3/c3 2025-01-26 11:09:36 -07:00
Guo-Rong 8158a16fbf Fix characteristic discovery with no descriptors.
Avoid discovery of descriptors if there are no handles remaining.
2025-01-15 18:37:47 -07:00
h2zero e6249623d5 Fix race condition in NimBLEScan::clearResults.
If clear results is called from more than one task a race condition exists that may delete the same advertisedDevice twice.
This prevents this by swapping with an empty vector and testing for empty before freeing the resources.
2025-01-12 18:11:57 -07:00
Michael Ammann a9578637cb avoid unused-variable warning
Avoid warning when compiled with All warnings enabled.
.../src/NimBLEScan.cpp: In member function 'void NimBLEScanResults::dump() const':
.../src/NimBLEScan.cpp:481:22: warning: unused variable 'dev' [-Wunused-variable]
  481 |     for (const auto& dev : m_deviceVec) {
      |                      ^~~
2025-01-12 15:44:58 -07:00
sanastasiou 765193f223 Fix incorrect TX power setting for advertising.
* Adds a new enum class to specify the tx power type to set (unused by non-esp devices).
* When all type is specified it is now ensured that all the tx power types are set to the specified level.
* Correctly sets the power level advertised for extended advertising with legacy pdu selected.
2025-01-12 15:37:44 -07:00
h2zero 3b019a0c9c If privacy is not configured do not share ID keys. 2025-01-12 15:05:11 -07:00
thekurtovic 5ac7272f5d change(NimBLEAddress): Prefer sizeof with parenthesis 2025-01-10 09:51:41 -07:00
thekurtovic 8468bb50dc NimBLEAddress default to including delimiter in string format 2025-01-08 15:24:08 -07:00
thekurtovic 1088ad8fe1 NimBLEAddress::toString allow formatting to be configured 2025-01-07 11:37:01 -07:00
h2zero 0b543d9f62 Fix crash when retrieving descriptors.
If more than one descriptor is found the task would be released beofore the process completed causing a race condition.
2025-01-06 15:28:04 -07:00
thekurtovic 1d01af0f8c NimBLEAdvertisementData emit error on failure, remove magic numbers. 2025-01-05 09:23:32 -07:00
h2zero f7d3c5e0c2 Fix characteristic value unable to be updated in callback 2025-01-05 08:57:01 -07:00
h2zero bc2bc35a8a Fix advertising data not set if scan response enabled later. 2025-01-05 08:56:57 -07:00
thekurtovic 15cb6bc7c6 Add checks in case NIMBLE_CPP_DEBUG_ASSERT is not defined. 2025-01-04 15:20:01 -07:00
afpineda aae70dfd21 Allow the same report ID in multiple input/output/feature reports 2025-01-04 15:16:01 -07:00
h2zero ad12a48e9e Fix build error when using platformio library 2025-01-02 08:29:44 -07:00
thekurtovic 09297fb72a NimBLEScan increment m_callbackSent before callback.
Fixes heap corruption observed on CONFIG_HEAP_POISONING_COMPREHENSIVE.
2025-01-02 08:29:17 -07:00
h2zero 015217c764 Fix compile error for advertiser only config. 2024-12-21 15:47:13 -07:00
thekurtovic 9a1ae677b8 NimBLELog allow custom log level colors. 2024-12-20 13:32:34 -07:00
afpineda 6ee5174ba0 Fix NimBLEHIDDevice not being able to create more than one in/out/feature report + temporal coupling 2024-12-20 13:29:50 -07:00
William Emfinger e843c6811c Fix crash that could occur when server reconnects
* Update to not change services if they have not actually changed when starting the server
Closes #270
2024-12-20 13:25:00 -07:00
h2zero cfca3e7500 Add missing NimBLEUtils and NimBLEConnInfo includes to NimBLEDevice.h
In some cases compilation of examples would fail due to missing these headers so they should be included in NimBLEDevice.h
2024-12-15 14:15:16 -07:00
Ryan Powell 182e3bb8a3 Fix NimBLEHIDDevice output report returning incorrect characteristic. (#805)
The input and output report characteristics share the same UUID and the `getOutputReport` was returning the input report characteristic.
This change will return the correct characteristic by finding it with the index parameter.
2024-12-15 10:02:47 -07:00
mr258876 a627007a31 Fix compiling errors when central is disabled.
* Fix missing member error 'm_pClient' in NimBLEServer
2024-12-15 09:35:28 -07:00
h2zero 675d6bbf0d [BREAKING] Remove NimBLEAddress type default value.
When constructing a NimBLEAddress via string or other non `ble_addr_t` parameters it is important that the address type be specified.
This will help prevent issues where applications are not able to connect or identify scanned devices when comparing their addresses.
2024-12-14 13:56:50 -07:00
h2zero af1872623e Silence compiler warnings 2024-12-13 15:25:07 -07:00