Commit graph

17 commits

Author SHA1 Message Date
Jeff
987a69f544
Fix check for arduino component (#204) 2024-10-06 18:16:48 -06:00
h2zero
91210b8610 [BREAKING] Refactor attributes
Refactor attributes to reduce code duplication and improve maintainability.

* Add attribute base classes to provide common code.
* Add const where possible to functions and parameters.
* `NimBLECharacteristic::notify` no longer takes a `bool is_notification` parameter, instead `indicate()` should be called to send indications.
* `NimBLECharacteristic::indicate` now takes the same parameters as `notify`.
* `NimBLECharacteristicCallbacks` and `NimBLEDescriptorCallbacks` methods now take `const NimBLEConnInfo&` instead of non-const.
* `NimBLECharacteristic::onNotify` callback removed as unnecessary, the library does not call notify without app input.
* `NimBLERemoteCharacteristic::getRemoteService` now returns a `const NimBLERemoteService*` instead of non-const.
* Add NimBLEUUID constructor that takes a reference to `ble_uuid_any_t`.
* `NimBLERemoteService::getCharacteristics` now returns a `const std::vector<NimBLERemoteCharacteristic*>&` instead of non-const `std::vector<NimBLERemoteCharacteristic*>*`
* `NimBLERemoteService::getValue` now returns `NimBLEAttValue` instead of `std::string`
* `NimBLEService::getCharacteristics` now returns a `const std::vector<NimBLECharacteristic*>&` instead of a copy of std::vector<NimBLECharacteristic *>.
* Remove const requirement for NimBLEConnInfo parameter in callbacks.
  Const is unnecessary as the data can't be changed by application code.
* Change NimBLERemoteCharacteristic::getRemoteService to return const pointer.
2024-09-24 14:59:54 -06:00
h2zero
d1d1b49a26 Refactor NimBLEAttValue.
* Add length parameter to `setValue()` templates, with defaults for backward compatibility.
* Changed `setValue(const char*)` to add an optional length parameter so that a NULL character can be included, defaults to strlen.
* Moved non-inline functions to `NimBLEAttValue.cpp` file.
* Corrected includes to permit compilation as a stand-alone utility.
* Removed repeated code in `setValue()` by using `append()` after clearing the value.
* General code cleanup.
2024-07-21 16:36:00 -06:00
Jason2866
3c5a2fd4a9 add h2 2024-06-18 06:30:35 -06:00
Jason2866
4e65ce5d32
Support for C2 (#131) 2023-09-01 11:56:52 -06:00
Jason2866
b07cab5858 gptimer is used from driver 2023-09-01 08:22:37 -06:00
h2zero
2ea0f26de0 Add support for esp32c6 2023-08-13 10:40:00 -06:00
h2zero
fee3829a89
Fix build with platformio IDF+Arduino (#122) 2023-05-28 10:44:17 -06:00
h2zero
0b6337538c
Remove NimBLESecurity class. (#75) 2022-08-21 21:33:39 -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
2decc0682a Remove FreeRTOS from CmakeLists. 2021-07-14 10:30:41 -06:00
Aron Rubin
cf3227503b
Use more stable arduino detection methods (#38)
* Use a more stable arduino detection macro.

* Detection method for both IDF config phases. Newer IDF API and targets.
2021-03-04 21:00:21 -07:00
h2zero
7bec9c240a Release 1.2.0 2021-02-08 11:46:11 -07:00
h2zero
a4e085f71a Fix compilation when using CMake.
* Update readme to include note about compiling with Arduino component.
2021-01-15 20:16:07 -07:00
h2zero
4723b1cc53
Server: Add onSubscribe() callback for characteristics. (#21)
Server: Add onSubscribe() callback for characteristics.

Adds a new method to NimBLECharacteristicCallbacks that gets called when a client
changes it's subscription status.

* Remove NimBLE2902 class.

As the NimBLE2902 class usefulness was only related to callback functions that were replaced
by the NimBLECharacteristicCallbacks:onSubscribe() method this removes the NimBLE2902 class and
moves all subscription handling to NimBLECharacteristic.

* Update documents and examples to reflect this change.

* Add getSubscribedCount() to get the number of subscribed clients.
2020-07-27 21:11:38 -06:00
h2zero
e987ad58b2 Refactor server code to use vectors instead of maps.
* Use critical sections to access characteristic/descriptor value data.

* Remove unnecessary code

* Create characteristic semaphore only if needed for indications.

* Fix advertising when not broadcasting a service.
2020-06-07 18:42:28 -06:00
h2zero
74ba03e3a8 Add CMakeLists.txt.
Fix compilation in strict enviroments.
Fix compliation in IDF v4.0.
2020-03-31 20:16:27 -06:00