Commit graph

278 commits

Author SHA1 Message Date
h2zero
a17f3199bd Fix client passkey callback value not sent to server. 2020-08-15 07:49:32 -06:00
h2zero
492bcf6f78 Add undefined getServiceUUIDCount() 2020-08-15 07:40:01 -06:00
h2zero
17d53432a6 Update documentation. 2020-08-14 13:25:50 -06:00
h2zero
1172df0a49 Fix travis deploy 2020-08-13 16:13:52 -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
97832d4d95 Initialize peerAddress in client constructor.
Co-authored-by: wakwak-koba <wakwak-koba@users.noreply.github.com>
2020-08-03 22:13:57 -06:00
h2zero
73cec7a92a Remove type parameter from NimBLEClient::connect()
* The type is available in the NimBLEAddress parameter, no longer needed separately.

Co-authored-by: wakwak-koba <wakwak-koba@users.noreply.github.com>
2020-08-03 22:13:57 -06:00
h2zero
b901eeb1e5 Connect address type default to public.
* Cleanup logs.

Co-authored-by: wakwak-koba <wakwak-koba@users.noreply.github.com>
2020-08-03 22:13:57 -06:00
h2zero
8fbab09f53 Rename refreshServices to deleteAttributes in connect().
Minor semantic change for clarity.

Co-authored-by: wakwak-koba <wakwak-koba@users.noreply.github.com>
2020-08-03 22:13:57 -06:00
h2zero
33d0a732a6 Set peer address of client when creating the instance.
* Adds new client connect method that will connect to the address already set.

Co-authored-by: wakwak-koba <wakwak-koba@users.noreply.github.com>
2020-08-03 22:13:57 -06:00
h2zero
f3e0d66853 Remove advertisment type from advertised device string. 2020-08-03 20:25:48 -06:00
h2zero
28e9e3d79d Remove type from address string. 2020-08-03 07:33:11 -06:00
h2zero
353e5a6cb1 Fix compile error. 2020-08-01 20:17:12 -06:00
h2zero
1a5beaa7c0
Store address type in NimBLEAddress. (#25) 2020-07-30 14:57:47 -06:00
h2zero
abdf6cda35
Add clearAll parameter to deinit() (#22)
* Add clearAll parameter to deinit()

Adds the ability to clear all resources consumed during BLE operation when deinitializing and shutting down BLE.
Useful when BLE is used intermittently or in a task that initializes, performs operations then deinitializes.

By setting the clearAll parameter to true all created BLE objects will be deleted, freeing the memory for other tasks.

Warning: This will invalidate any pointers that may be referencing the deleted objects.

* Add bool deleteCallbacks parameter to NimBLEServer::setCallbacks, if true (default) will delete the callback class when server is destructed.

* Delete scan results when scan is destructed.
2020-07-28 20:57:33 -06:00
h2zero
b2df8384b3
Add support for getting multiple services data from advertisments. (#20)
* Add support for getting multiple services data from advertisments.

* Adds new methods for getting advertised service data and UUIDS.
- getServiceData(index), gets the service data by index value.
- getServiceData(NimBLEUUID), gets the service data by UUID.
- getServiceDataCount(), gets the number of services with data advertised.

* Templates added for getServiceData(index) and getServiceData(NimBLEUUID)
  to be able to specify the data type returned by these methods
  Example:
      getServiceData<uint32_t>(NimBLEUUID("ABCD");

* Also added:
- getServiceUUID(index), gets the advertised service UUID by index value.
- getServiceUUIDCount(), gets the number of advertised services.
2020-07-28 20:09:54 -06:00
h2zero
f1a13d5949 Advertising: Add overloaded method for addData.
* Implements addData(char * data, size_t length) as an alternative to passing a std::string.
2020-07-27 21:38:22 -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
fe4586a3ca NimBLEScan: Add isScanning method.
Adds a method to check if the scan is currently running.

* Clear up some NimBLEScan method parameter semantics.
2020-07-23 20:18:41 -06:00
lknop
11b6f816ca Reverse discovered beacon UUID
Author:    lknop <lknop@users.noreply.github.com>
2020-07-19 18:25:10 -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
5857879612 Fix calling scan ended callback when scan was already stopped. 2020-07-12 20:35:10 -06:00
h2zero
c03053fb53 Add TravisCI to build docs. 2020-07-09 13:21:31 -06:00
h2zero
bad4051ca8 Cleanup 2020-07-09 10:59:08 -06:00
h2zero
6df7b1331a Refactor NimBLERemoteCharacteristic::subscribe
* Rearrange subscribe parameters to remove requirement of specifying write response to register a callback.
2020-07-08 21:10:11 -06:00
h2zero
2af26fad1f Include NimBLE2904 and NimBLE2902 in NimBLEDescriptor.h
* Removes the need to include these in the application.
2020-07-08 19:47:32 -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
h2zero
64caf3553e Create FUNDING.yml
As some have asked to buy me beers, here's how :).
2020-07-04 23:07:43 -06:00
h2zero
8d2821a429 Use templates for attribute values.
* Add timestamps for NimBLECharacteristic.
2020-07-01 17:32:41 -06:00
h2zero
745f9c00ed Implement scan wantDuplicates parameter in callback registration.
Also adds:
* NimBLEScan::setDuplicateFilter() to tell the controller to filter duplicates
before sending the result to the host.

* NimBLEScan::setLimitedOnly() to tell the controller only report scan results
from devices advertising in limited discovery mode, i.e. directed advertising.

* NimBLEScan::setFilterPolicy() to set the filter policy i.e whitelist only devices.
2020-07-01 17:26:44 -06:00
h2zero
e936070464 Cleanup compiler warnings. 2020-06-28 16:50:46 -06:00
h2zero
c03be1b100 Set filter_duplicates to 0 in NimBLEScan constructor 2020-06-26 15:44:40 -06:00
h2zero
05a5d0dea9 Make getDescriptors() work as getCharacteristics() 2020-06-24 19:33:04 -06:00
h2zero
273490359a Make NimBLEDevice::startSecurity() public. 2020-06-22 21:46:22 -06:00
h2zero
aecf8e268b Update documentation. 2020-06-22 20:27:45 -06:00
h2zero
f5541d18de
Replace semaphores with task notifications. (#9)
* Replace all semaphores with task notifications.

* use critical sections to prevent concurrent data access.

* Ensure scan stop has been called before connecting.

* Optimize and cleanup

* Add template casting to NimBLERemoteDescriptor::readValue()

* Removed storage of the descriptor value read as it did not serve any purpose.
2020-06-21 22:07:01 -06:00
h2zero
5bc9d59646 Just return a pointer for getServices(false) and getCharacteristics(false)
If parameter 'refresh' equals 'false' do not retrieve services or characteristics, just return a pointer to the vector.
2020-06-21 20:46:20 -06:00
h2zero
c25e48872f NimBLECharacteristic: add setValue(uint8_t single_byte) 2020-06-21 20:38:38 -06:00
h2zero
0712f606f1
Don't send notifications to un-paired peers when READ_ENC set (#14)
* start security when peer subscribes to secured characteristic

* Don't send notifications to non-secure clients
2020-06-21 20:26:16 -06:00
h2zero
afb2f8d4c7 Add uint64_t cast of an address 2020-06-19 12:32:57 -06:00
h2zero
f624deacb5 Add register for notify without callback
* Add subscribe() and unsubscribe() methods to replace registerForNotify() in NimBLERemoteCharacteristic.

* registerForNotify() remains as a (depreciated) method.
2020-06-19 12:30:32 -06:00
h2zero
7983c0e50e Fix IDF compiler warnings 2020-06-14 09:11:05 -06:00
h2zero
02357d04d8
Merge Refactor server code #8 2020-06-11 10:22:28 -06:00
h2zero
8b79e934a6 Fix Compiliation in IDF4.0 2020-06-11 08:13:39 -06:00
h2zero
74f48f5d5e Remove semaphores, use task notifications instead. 2020-06-11 08:06:16 -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
44f16e6ee2 Correct client connection status signalling.
* NimBLEClient::disconnect() was setting the connected flag to false before the disconnection occured.

* NimBLEDevice::deleteClient() was not waiting for disconnection if it was already in progress.

* Client gap event handler was releasing the connection event semaphore when it should not.
2020-05-30 09:01:42 -06:00