-
Notifications
You must be signed in to change notification settings - Fork 3k
BLE: Enable getting an implicitly-created CCCD through GattCharacteristic::getDescriptor
#13729
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
Conversation
c5a4b76
to
5c82533
Compare
GattCharacteristic::getDescriptor
GattCharacteristic::getDescriptor
@AGlass0fMilk, thank you for your changes. |
GattCharacteristic::getDescriptor
GattCharacteristic::getDescriptor
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good PR. Thanks @AGlass0fMilk .
I tried to make GattServer a friend class of GattCharacteristic so GattCharacteristic::_setImplicitCCCD could be private, but I wasn't able to get it to compile due to all the weird namespacing stuff going on with ble::GattServer and ble::impl::GattServer -- it boggled my mind so I just made this a public "internal" function.
In C++, friendship is not inherited. The solution is to:
- Forward declare
ble::GattServer
inGattCharacteristic.h
- Mark it friend in
GattCharacteristic
(friend ble::GattCharacteristic
) - Add a protected function in
ble::GattServer
that can be used by child to add the CCCD.setCharacteristicImplicitCCCD(GattCharacteristic&, GattAttribute*)
It turns out that My problems stemmed from me trying to forward declare only I moved the forward declaration outside of the Let me know if anything else needs to be addressed. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, I request a minor change in the allocation of the CCCD attribute. After that it is good to go.
connectivity/FEATURE_BLE/source/cordio/source/GattServerImpl.cpp
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
CI started |
Jenkins CI Test : ✔️ SUCCESSBuild Number: 1 | 🔒 Jenkins CI Job | 🌐 Logs & ArtifactsCLICK for Detailed Summary
|
GattCharacteristic::getDescriptor
GattCharacteristic::getDescriptor
Summary of changes
See #13581 for information on issue.
Resolves #13581 by allowing the GattServer to pass a pointer to an implicitly-created CCCD. This
GattAttribute
is dynamically allocated (usingnew
) and ownership is transferred to the relevantGattCharacteristic
, which takes care ofdelete
ing theGattAttribute
in its destructor.I tried to makeGattServer
afriend
class ofGattCharacteristic
soGattCharacteristic::_setImplicitCCCD
could beprivate
, but I wasn't able to get it to compile due to all the weird namespacing stuff going on withble::GattServer
andble::impl::GattServer
-- it boggled my mind so I just made this apublic
"internal" function.Impact of changes
GattCharacteristic::getDescriptor
andGattCharacteristic::getDescriptorCount
now behave as expected when aGattCharacteristic
has an implicitly-created CCCD (ie: theGattCharacteristic
hasindicate
and/ornotify
as one of its properties).Migration actions required
None
Documentation
None
Pull request type
Test results
Reviewers
@pan- @paul-szczepanek-arm