@@ -124,7 +124,7 @@ void BLECharacteristic::addDescriptor(BLEDescriptor *pDescriptor) {
124124 * @param [in] descriptorUUID The UUID of the descriptor that we wish to retrieve.
125125 * @return The BLE Descriptor. If no such descriptor is associated with the characteristic, nullptr is returned.
126126 */
127- BLEDescriptor *BLECharacteristic::getDescriptorByUUID (const char *descriptorUUID) {
127+ BLEDescriptor *BLECharacteristic::getDescriptorByUUID (const char *descriptorUUID) const {
128128 return m_descriptorMap.getByUUID (BLEUUID (descriptorUUID));
129129} // getDescriptorByUUID
130130
@@ -133,15 +133,15 @@ BLEDescriptor *BLECharacteristic::getDescriptorByUUID(const char *descriptorUUID
133133 * @param [in] descriptorUUID The UUID of the descriptor that we wish to retrieve.
134134 * @return The BLE Descriptor. If no such descriptor is associated with the characteristic, nullptr is returned.
135135 */
136- BLEDescriptor *BLECharacteristic::getDescriptorByUUID (BLEUUID descriptorUUID) {
136+ BLEDescriptor *BLECharacteristic::getDescriptorByUUID (BLEUUID descriptorUUID) const {
137137 return m_descriptorMap.getByUUID (descriptorUUID);
138138} // getDescriptorByUUID
139139
140140/* *
141141 * @brief Get the handle of the characteristic.
142142 * @return The handle of the characteristic.
143143 */
144- uint16_t BLECharacteristic::getHandle () {
144+ uint16_t BLECharacteristic::getHandle () const {
145145 return m_handle;
146146} // getHandle
147147
@@ -151,30 +151,30 @@ void BLECharacteristic::setAccessPermissions(uint16_t perm) {
151151#endif
152152}
153153
154- esp_gatt_char_prop_t BLECharacteristic::getProperties () {
154+ esp_gatt_char_prop_t BLECharacteristic::getProperties () const {
155155 return m_properties;
156156} // getProperties
157157
158158/* *
159159 * @brief Get the service associated with this characteristic.
160160 */
161- BLEService *BLECharacteristic::getService () {
161+ BLEService *BLECharacteristic::getService () const {
162162 return m_pService;
163163} // getService
164164
165165/* *
166166 * @brief Get the UUID of the characteristic.
167167 * @return The UUID of the characteristic.
168168 */
169- BLEUUID BLECharacteristic::getUUID () {
169+ BLEUUID BLECharacteristic::getUUID () const {
170170 return m_bleUUID;
171171} // getUUID
172172
173173/* *
174174 * @brief Retrieve the current value of the characteristic.
175175 * @return A pointer to storage containing the current characteristic value.
176176 */
177- String BLECharacteristic::getValue () {
177+ String BLECharacteristic::getValue () const {
178178 return m_value.getValue ();
179179} // getValue
180180
@@ -190,7 +190,7 @@ uint8_t *BLECharacteristic::getData() {
190190 * @brief Retrieve the current length of the data of the characteristic.
191191 * @return Amount of databytes of the characteristic.
192192 */
193- size_t BLECharacteristic::getLength () {
193+ size_t BLECharacteristic::getLength () const {
194194 return m_value.getLength ();
195195} // getLength
196196
@@ -425,7 +425,7 @@ void BLECharacteristic::setWriteProperty(bool value) {
425425 * @brief Return a string representation of the characteristic.
426426 * @return A string representation of the characteristic.
427427 */
428- String BLECharacteristic::toString () {
428+ String BLECharacteristic::toString () const {
429429 String res = " UUID: " + m_bleUUID.toString () + " , handle : 0x" ;
430430 char hex[5 ];
431431 snprintf (hex, sizeof (hex), " %04x" , m_handle);
@@ -452,7 +452,7 @@ String BLECharacteristic::toString() {
452452 return res;
453453} // toString
454454
455- BLECharacteristicCallbacks::~BLECharacteristicCallbacks () {}
455+ BLECharacteristicCallbacks::~BLECharacteristicCallbacks () = default ;
456456
457457// Common callbacks
458458void BLECharacteristicCallbacks::onRead (BLECharacteristic *pCharacteristic) {
0 commit comments