Skip to content

Conversation

@andresag01
Copy link

This is an initial version of an API that automates the process of setting the
Client Characteristic Configuration Descriptor (CCCD) to enable/disable
notifications. The new API is DiscoveredCharacteristic::setCCCD().

The new API internally triggers a characteristic descriptor discovery procedure
to find the handle of the CCCD. If this succeeds, it attempts to execute a write
procedure. On termination, a user configured callback is executed to report the
final outcome of the process.

NOTE: This pull request is NOT READY FOR MERGE, it is an early version of the new API to start discussion around this issue. In my opinion, there are still a few problems that need to be tackled:

  1. Shutdown should gracefully terminate the setCCCD procedure.
  2. CCCDSetter::launch (and OneShotWriteCallback::launch, OneShotReadCallback::launch as well) do not return ble_error_t, so its impossible to check whether they actually succeeded.

@pan- Please comment.

Andres Amaya Garcia added 4 commits January 20, 2016 16:29
This is an initial version of an API that automates the process of setting the
Client Characteristic Configuration Descriptor (CCCD) to enable/disable
notifications. The new API is DiscoveredCharacteristic::setCCCD().

The new API internally triggers a characteristic descriptor discovery procedure
to find the handle of the CCCD. If this succeeds, it attempts to execute a write
procedure. On termination, a user configured callback is executed to report the
final outcome of the process.
@andresag01
Copy link
Author

The build will fail because there is a problem in the API when registering onShutdown callbacks. The signature of the function should be void onShutdown(T *objPtr, void (T::*memberPtr)(const GattClient *)) rather than void onShutdown(T *objPtr, void (T::*memberPtr)(void))

I have made a PR to solve this issue: #174

@andresag01
Copy link
Author

It seems that the ble-nrf51822 implementation of the API does shutdown the Service Discovery but NOT the Characteristic Descriptor Discoverer. I have raised an issue about this, see ARMmbed/ble-nrf51822#110. In this case, the CCCDSetter objects will never receive the expected callbacks and the memory resources allocated will never be cleared.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant