-
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::getDescriptorGattCharacteristic::getDescriptor
|
@AGlass0fMilk, thank you for your changes. |
GattCharacteristic::getDescriptorGattCharacteristic::getDescriptor
pan-
left a comment
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::GattServerinGattCharacteristic.h - Mark it friend in
GattCharacteristic(friend ble::GattCharacteristic) - Add a protected function in
ble::GattServerthat 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. |
pan-
left a comment
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
pan-
left a comment
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::getDescriptorGattCharacteristic::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
GattAttributeis dynamically allocated (usingnew) and ownership is transferred to the relevantGattCharacteristic, which takes care ofdeleteing theGattAttributein its destructor.I tried to makeGattServerafriendclass ofGattCharacteristicsoGattCharacteristic::_setImplicitCCCDcould beprivate, but I wasn't able to get it to compile due to all the weird namespacing stuff going on withble::GattServerandble::impl::GattServer-- it boggled my mind so I just made this apublic"internal" function.Impact of changes
GattCharacteristic::getDescriptorandGattCharacteristic::getDescriptorCountnow behave as expected when aGattCharacteristichas an implicitly-created CCCD (ie: theGattCharacteristichasindicateand/ornotifyas one of its properties).Migration actions required
None
Documentation
None
Pull request type
Test results
Reviewers
@pan- @paul-szczepanek-arm