Commit graph

41 commits

Author SHA1 Message Date
h2zero
020c61700d [BREAKING]- Refactor client
* General code cleanup and rename variables to use a consistent style.
* Removes the disconnect timer and will use the BLE_GAP_EVENT_TERM_FAILURE event to handle failed disconnects.
* `NimBLEClient::getConnId` has been renamed to `getConnHandle` to be consistent with bluetooth terminology.
* `NimBLEClient::disconnect` now returns a `bool = true on success` instead of an int to be consistent with the rest of the library.
* `NimBLEClient::setPeerAddress` now returns a bool, true on success.
* `NimBLEClientCallbacks::onConfirmPIN` renamed to `NimBLEClientCallbacks::onConfirmPasskey` to be consistent with bluetooth terminology.
* `NimBLEClient::setDataLen` now returns bool, true if successful.
* `NimBLEClient::updateConnParams` now returns bool, true if successful.
* `NimBLEClient::getServices` now returns a const reference to std::vector<NimBLERemoteService*> instead of a pointer to the internal vector.
2024-11-03 18:12:20 -07: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
9c1f1adf7a
[BREAKING] Asynchronous pin injections for Numeric Comparison and PassKey Input (#165)
* Make NimBLEConnInfo functions const.

* Update callback functions and update client to use new functions.

* Update examples.

* Update migration guide.

---------

Co-authored-by: Casey Smith <csmith@morningstarcorp.com>
2024-06-06 19:36:14 -06:00
psitto
58f86cb7bd
Fix inconsistent use of time units (#143)
Seconds to milliseconds
2024-02-29 17:34:53 -07:00
h2zero
091c1c014c Update doxygen config 2023-05-25 10:29:53 -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
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
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
efa48c0d57 Release 1.4.0
* Fix typos

* Update docs
2022-07-31 11:34:56 -06:00
h2zero
38a1a2013b Update docs. 2022-05-29 20:08: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
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
e238a18a80 Update Doxygen version 2021-08-04 18:58:12 -06:00
h2zero
9961c5605c Update docs version. 2021-08-02 21:25:17 -06:00
h2zero
6ff1a49dd5 Update documentation. 2021-07-12 13:33:56 -06:00
h2zero
7bec9c240a Release 1.2.0 2021-02-08 11:46:11 -07:00
h2zero
ae2ff3a638 Fix Documentation. 2021-02-06 11:12:40 -07:00
James Fellows
43c9d96373 Update migration guide to include Characteristic constructor now being private 2021-02-03 20:18:44 -07:00
h2zero
4e24a06645 Release 1.1.0 2021-01-20 20:18:23 -07:00
h2zero
cf64169bc0 Update documentation.
* Docuemnt HID device class.

* Add usage tips.
2021-01-17 17:29:28 -07:00
h2zero
559a6e6970 Update documentation. 2021-01-15 21:51:49 -07:00
h2zero
d9e11ee630 Release 1.0.2 2020-09-13 21:37:13 -06:00
h2zero
1a52245012 Update documentation.
* typo fix
2020-09-13 20:02:15 -06:00
h2zero
10acb004dc NimBLEAddress: New constructor added to create blank addresses
* Docuement NimBLEAddress::getNative in migration docs.
2020-09-02 14:52:34 -06:00
h2zero
f672d04a90 Update Documentation. 2020-08-22 09:15:53 -06:00
h2zero
3b81d93d31 Update documentation. 2020-08-20 16:07:07 -06:00
h2zero
e9bb7eff65 Add doxygen comments in nimconfig.h 2020-08-18 15:02:57 -06:00
h2zero
2da99504d8 Update Documentation 2020-08-17 13:45:13 -06:00
h2zero
17d53432a6 Update documentation. 2020-08-14 13:25:50 -06:00
h2zero
8136ae4d68
Update travis to use doxygen 1.8.19 (#28)
Use newer version of doxygen for better support of markdown files.
2020-08-13 15:53:47 -06:00
h2zero
cf6b0e9a5a Update Readme. 2020-08-08 07:29:45 -06:00
h2zero
a460eca1ef Update documentation
Co-authored-by: wakwak-koba <wakwak-koba@users.noreply.github.com>
2020-08-03 22:13:57 -06: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
2b4c1cd4f1 Add alternative characteristic read/write callbacks
Added alternative characteristic read/write callbacks that carry the connection description information.
Fixes h2zero/NimBLE-Arduino#83

Author: lknop <lknop@users.noreply.github.com>
2020-07-14 15:14:29 -06:00
h2zero
2a5df0c905
Add feature: remove service (#17)
* Get service handles on server start

* remove service + indicate service changed

* Reset gatt services when no connections active and services changed.

* NimBLEServer::createService can now be used any time and will send service changed
indication if server was already active.

* Add ability to remove advertised serviceUUIDS

* Adds addService() method to server to be allow user to re-add a service previously removed

* Add destructior to NimBLEServer, NimBLEService and NimBLECharacteristic to release allocated resources.
2020-07-13 21:24:07 -06:00
h2zero
aae2a8f1e3
Fix comments for doxygen (#16)
* Fix comments for doxygen

* Add documentation and update readme.
2020-07-08 19:27:26 -06:00