Skip to content

Commit eccb3e9

Browse files
committed
Make setImplicitCCCD private and add impl::GattServer as a friend class
1 parent ca9b705 commit eccb3e9

File tree

2 files changed

+16
-5
lines changed

2 files changed

+16
-5
lines changed

connectivity/FEATURE_BLE/include/ble/gatt/GattCharacteristic.h

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,16 @@
2424
#include "ble/gatt/GattAttribute.h"
2525
#include "ble/gatt/GattCallbackParamTypes.h"
2626

27+
// Forward declare ble::impl::GattServer
28+
namespace ble {
29+
30+
#if !defined(DOXYGEN_ONLY)
31+
namespace impl {
32+
class GattServer;
33+
}
34+
#endif // !defined(DOXYGEN_ONLY)
35+
}
36+
2737
/**
2838
* @addtogroup ble
2939
* @{
@@ -1774,18 +1784,19 @@ class GattCharacteristic {
17741784
return _descriptors[index];
17751785
}
17761786

1787+
private:
1788+
1789+
friend ble::impl::GattServer;
1790+
17771791
/**
17781792
* Sets this GattCharacteristic's implicitly-created CCCD, if
17791793
* applicable.
17801794
*
17811795
* @note once this is called, the pointed-to GattAttribute
17821796
* is owned by this GattCharacteristic and will be deleted
17831797
* during this object's destructor
1784-
*
1785-
* @note this is an internal function and should not be called
1786-
* by the application
17871798
*/
1788-
void _setImplicitCCCD(GattAttribute *implicit_cccd) {
1799+
void setImplicitCCCD(GattAttribute *implicit_cccd) {
17891800
_implicit_cccd = implicit_cccd;
17901801
}
17911802

connectivity/FEATURE_BLE/source/cordio/source/GattServerImpl.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -603,7 +603,7 @@ ble_error_t GattServer::insert_cccd(
603603
implicit_cccd->setHandle(cccds[cccd_cnt].handle);
604604
implicit_cccd->allowRead(true);
605605
implicit_cccd->allowWrite(true);
606-
characteristic->_setImplicitCCCD(implicit_cccd);
606+
characteristic->setImplicitCCCD(implicit_cccd);
607607

608608
cccd_cnt++;
609609
attribute_it++;

0 commit comments

Comments
 (0)