Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Initial version of the setCCCD API for GattClient #172

Open
wants to merge 9 commits into
base: develop
Choose a base branch
from

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