Commit graph

242 commits

Author SHA1 Message Date
h2zero
d83cd94d5b Revert 03b22e5 sub/unsub changes, app should specify response. 2023-05-24 15:37:17 -06:00
h2zero
7d2d73d8fc Fix pairing when already in progress.
If pairing is requested before performing an action on a protected attribute pairing could fail due to already being in progress.
This fix will wait for the result of the pairing process before proceeding with the action.
2023-05-24 15:37:03 -06:00
Armandas Jarušauskas
05ac9deaea
Remove deprecated API in case of ESP-IDF V5. (#102)
* Remove deprecated API in case of ESP-IDF V5.

0a93ee1337/docs/en/migration-guides/release-5.x/bluetooth-low-energy.rst (id17)

* Fix initialization in case of ESP-IDF V5
2022-11-03 20:47:04 -06:00
Johanna Amann
cad022650a Fix getPower return value
Power level -3 returned the wrong value.
2022-09-11 20:34:33 -06:00
gluhovsky
e868f37135
Add conn_handle to NimBLECharacteristic::notify to send notification/indication to a specific client (#97)
Adds the ability to send notifications/indications to specific clients individually.
2022-09-11 20:18:55 -06:00
Casey Smith
6fb26e3809
Change type of index to int (instead of uint8_t) to fix issue with adding more than 255 Characteristics (or Descriptors) (#101) 2022-09-11 19:54:15 -06:00
h2zero
6a2f558ea5 [BREAKING] Replace advertised device callbacks with scan callbacks. (#389)
This replaces NimBLEAdvertisedDeviceCallbacks with NimBLEScanCallbacks and adds a onScanEnd callback.

The callback parameter for NimBLEScan::start has been removed and the blocking overload for NimBLEScan::start
has been replaced by an overload of NimBLEScan::getResults with the same parameters.
2022-08-27 14:04:50 -06:00
h2zero
562a32eda6 Add docs build. 2022-08-27 13:02:29 -06:00
h2zero
0f4da63fc8 Add CI build check. 2022-08-27 13:02:29 -06:00
h2zero
ba79a1bf72 [Breaking] Update callbacks to use NimBLEConnInfo.
Change the callback functions that receive a ble_gap_conn_desc pointer to instead receive a NimBLEConnInfo reference.

* Add a reason parameter to the server disconnect callback.

* Remove connect and disconnect callback that do not receive info parameters.

* Remove onRead and onWrite Characteristic callbacks that do not receive info parameters.

* Add info parameter to Descriptor onWrite and onRead callbacks.

* Add details to migration guide.
2022-08-27 13:02:29 -06:00
h2zero
ca8a7c56ac
[Breaking] Remove extra notification status from onStatus callback. (#80)
Removes the unnecessary NimBLECharacteristicCallbacks::Status enum and callback parameter from NimBLECharacteristic::onStatus.

This was maintained for compatibility with the Arduino BLE library and is not necessary as the return code from the stack is also provided.

* Update examples/docs.
2022-08-26 20:40:21 -06:00
h2zero
03b22e53a0
[Breaking] Remove deprecated functions/response parameter from un/sub (#76)
Removes the response parameter from remote characterisitc subscrible/unsubscribe functions
as a response is always required for this operation as per BLE specs.

Removes the deprecated functions from remote characteristic/desriptor.

* Update examples/docs.
2022-08-26 20:15:25 -06:00
h2zero
2b758e05c7 Fix client example. 2022-08-26 19:54:43 -06:00
h2zero
bfe68f4a91
[Breaking] Add disconnect reason to client callback. (#398) (#81)
Adds the reason code as a parameter to the client onDisconnect callback.

* Update examples/docs.
2022-08-26 19:51:19 -06:00
h2zero
bb3dd5f114
[Breaking] Change all time input parameters to milliseconds. (#78)
Changes all functions that accept a time parameter to use milliseconds instead of seconds.

* Adds duration input to NimBLEDevice::startAdvertising and NimBLEServer::startAdvertising.
2022-08-26 19:32:01 -06:00
h2zero
0b6337538c
Remove NimBLESecurity class. (#75) 2022-08-21 21:33:39 -06:00
Giovanni Cascione
32e7059732 add NimBLEHIDDevice::batteryLevel() 2022-08-21 21:19:54 -06:00
Cody
cd3185fe43 Added the setDeviceName functionality while BLE is running 2022-08-21 21:19:30 -06:00
h2zero
efa48c0d57 Release 1.4.0
* Fix typos

* Update docs
2022-07-31 11:34:56 -06:00
h2zero
70ed6e293f Don't set advertisement flags if not connectable. 2022-07-10 07:15:46 -06:00
h2zero
93de7ab8ed Bugfix/onRead callback not called for non-long read commands. 2022-06-26 17:03:21 -06:00
h2zero
9285a9b31f Don't call scan result callback if it was already called. 2022-06-04 14:24:30 -06:00
h2zero
38a1a2013b Update docs. 2022-05-29 20:08:23 -06:00
h2zero
a36655c105 Add success/fail return value to disoverAttributes. 2022-04-16 20:32:01 -06:00
h2zero
c285052f6d Use write with response when writing 0x2902 descriptors.
As per Bluetooth core specification we must write to 0x2902 descriptors with response request.
This change ensures the correct procedure is used.

Todo: Remove the "response" parameter from related functions.
2022-04-16 12:47:23 -06:00
h2zero
9e5db157f8
Add extended advertising support. (#72)
Adds support for advertising and connections with coded/2M PHY's.

Adds new classes `NimBLEExtAdvertising` and `NimBLEExtAdvertisement`.
When extended advertising is enabled the original advertising classes become unavailable and the new classes must be used.

Changed some return values for advertising methods for consistency with the new classes methods.
2022-04-10 10:21:45 -06:00
h2zero
58787b516b Prevent crash when characteristic vector is empty. 2022-04-02 14:22:23 -06:00
h2zero
a1428e63a6 Fixup client logs. 2022-02-20 10:04:13 -07:00
h2zero
0f4326d3fd Check characteristic handles before fetching descriptors. 2022-02-20 10:02:09 -07:00
h2zero
f414a5ac73 Release v1.3.3 2022-02-15 20:33:02 -07:00
h2zero
99a23d3c19 Remove recursive calling when fetching remote attributes. 2022-02-15 20:32:18 -07:00
h2zero
6cda761f13 Fix memory leak when deleting client instance. 2022-02-15 20:31:26 -07:00
jvrobert
288ee92d39
Added extended advertising scan support (#69) 2022-02-06 16:52:42 -07:00
h2zero
2e498cef2b Fix IDF version check. 2022-02-06 12:58:26 -07:00
h2zero
2386a8a68a Retrieve attributes with 16bit uuid if 128bit fails.
When retrieving attribute handles using the 128bit base version of a 16 bit UUID some devices will
report "not found". This will attempt to convert the UUID to the 16bit version and try again.

* Adds `to16()` method to NimBLEUUID.
2022-01-18 14:48:07 -07:00
h2zero
6b858a0efd Fix memory leak when services changed. 2022-01-18 14:44:47 -07:00
h2zero
e3ee082dd7
Add NimBLEAttValue class. (#67)
This is a specialized container class to hold BLE attribute values.

- Removes the use of std::string previously used to store the values.
- Allows for setting/getting/notifying values from std::string, std::vector<uint8_t>, Arduino String, const char*, and uint8_t buffers.
- Has operators retrieve the value as std::string, Arduino String, std::vector<uint8_t>, uint8_t* or char pointers.
- Includes iterators and subscript/random access operator.
- Introduces a max length parameter to the creation of server characteristics/descriptors to limit the size of the memory footprint.
- Nearly Seamless integration with existing code.
- Adds a config option to enable/disable timestamp storage when the value is updated.
- Adds a config option to specify the initial size of the value container if not specified in the constructor.
2022-01-16 20:11:18 -07:00
h2zero
be9cdc1ab6 Update docs 2022-01-15 15:21:41 -07:00
h2zero
cf482f9112 Cleanup ARM-gcc compiler warnings. 2022-01-15 12:43:17 -07:00
h2zero
bbed8d1d4b Release v1.3.2 2022-01-15 09:07:08 -07:00
h2zero
099e7cc326 Remove travis docs build. 2022-01-15 08:57:40 -07:00
h2zero
830c4cc39e Re-enable data length extension newer IDF versions. 2022-01-15 08:51:49 -07:00
Jackson Ming Hu
ea6e2101e3 Fix compilation on ESP32-S3 2022-01-14 21:46:30 -07:00
h2zero
d47cf59ba9 Cleanup compile errors in arm-gcc. 2022-01-14 20:45:24 -07:00
h2zero
ea02eb9452 Add config option for log verbosity. 2022-01-14 19:47:44 -07:00
h2zero
798726c05d Update change log. 2022-01-14 10:32:47 -07:00
h2zero
9824bdfe73 Update log level macro name 2022-01-14 10:02:47 -07:00
h2zero
fac16f2428 Fix long data notifications.
The notification data when received was using an incorrect length value and would cut off long values, this has now been corrected.
2022-01-13 08:57:50 -07:00
h2zero
0957d7f6ad The latest versions of IDF include a new esp_timer library that seems to be incrementing the task notification values in unexpected places depending on other tasks in operation.
This causes task blocking to fail in client operations leading to exceptions and crashing.

This is a workaround for this situation and will need to be reworked properly in the future.
2022-01-09 19:04:41 -07:00
David Lehrian
5facd89a00
Update NimBLEServer.h (#65) 2022-01-01 18:00:45 -07:00