@@ -124,7 +124,7 @@ void BLECharacteristic::addDescriptor(BLEDescriptor *pDescriptor) {
124
124
* @param [in] descriptorUUID The UUID of the descriptor that we wish to retrieve.
125
125
* @return The BLE Descriptor. If no such descriptor is associated with the characteristic, nullptr is returned.
126
126
*/
127
- BLEDescriptor *BLECharacteristic::getDescriptorByUUID (const char *descriptorUUID) {
127
+ BLEDescriptor *BLECharacteristic::getDescriptorByUUID (const char *descriptorUUID) const {
128
128
return m_descriptorMap.getByUUID (BLEUUID (descriptorUUID));
129
129
} // getDescriptorByUUID
130
130
@@ -133,15 +133,15 @@ BLEDescriptor *BLECharacteristic::getDescriptorByUUID(const char *descriptorUUID
133
133
* @param [in] descriptorUUID The UUID of the descriptor that we wish to retrieve.
134
134
* @return The BLE Descriptor. If no such descriptor is associated with the characteristic, nullptr is returned.
135
135
*/
136
- BLEDescriptor *BLECharacteristic::getDescriptorByUUID (BLEUUID descriptorUUID) {
136
+ BLEDescriptor *BLECharacteristic::getDescriptorByUUID (BLEUUID descriptorUUID) const {
137
137
return m_descriptorMap.getByUUID (descriptorUUID);
138
138
} // getDescriptorByUUID
139
139
140
140
/* *
141
141
* @brief Get the handle of the characteristic.
142
142
* @return The handle of the characteristic.
143
143
*/
144
- uint16_t BLECharacteristic::getHandle () {
144
+ uint16_t BLECharacteristic::getHandle () const {
145
145
return m_handle;
146
146
} // getHandle
147
147
@@ -151,30 +151,30 @@ void BLECharacteristic::setAccessPermissions(uint16_t perm) {
151
151
#endif
152
152
}
153
153
154
- esp_gatt_char_prop_t BLECharacteristic::getProperties () {
154
+ esp_gatt_char_prop_t BLECharacteristic::getProperties () const {
155
155
return m_properties;
156
156
} // getProperties
157
157
158
158
/* *
159
159
* @brief Get the service associated with this characteristic.
160
160
*/
161
- BLEService *BLECharacteristic::getService () {
161
+ BLEService *BLECharacteristic::getService () const {
162
162
return m_pService;
163
163
} // getService
164
164
165
165
/* *
166
166
* @brief Get the UUID of the characteristic.
167
167
* @return The UUID of the characteristic.
168
168
*/
169
- BLEUUID BLECharacteristic::getUUID () {
169
+ BLEUUID BLECharacteristic::getUUID () const {
170
170
return m_bleUUID;
171
171
} // getUUID
172
172
173
173
/* *
174
174
* @brief Retrieve the current value of the characteristic.
175
175
* @return A pointer to storage containing the current characteristic value.
176
176
*/
177
- String BLECharacteristic::getValue () {
177
+ String BLECharacteristic::getValue () const {
178
178
return m_value.getValue ();
179
179
} // getValue
180
180
@@ -190,7 +190,7 @@ uint8_t *BLECharacteristic::getData() {
190
190
* @brief Retrieve the current length of the data of the characteristic.
191
191
* @return Amount of databytes of the characteristic.
192
192
*/
193
- size_t BLECharacteristic::getLength () {
193
+ size_t BLECharacteristic::getLength () const {
194
194
return m_value.getLength ();
195
195
} // getLength
196
196
@@ -425,7 +425,7 @@ void BLECharacteristic::setWriteProperty(bool value) {
425
425
* @brief Return a string representation of the characteristic.
426
426
* @return A string representation of the characteristic.
427
427
*/
428
- String BLECharacteristic::toString () {
428
+ String BLECharacteristic::toString () const {
429
429
String res = " UUID: " + m_bleUUID.toString () + " , handle : 0x" ;
430
430
char hex[5 ];
431
431
snprintf (hex, sizeof (hex), " %04x" , m_handle);
@@ -452,7 +452,7 @@ String BLECharacteristic::toString() {
452
452
return res;
453
453
} // toString
454
454
455
- BLECharacteristicCallbacks::~BLECharacteristicCallbacks () {}
455
+ BLECharacteristicCallbacks::~BLECharacteristicCallbacks () = default ;
456
456
457
457
// Common callbacks
458
458
void BLECharacteristicCallbacks::onRead (BLECharacteristic *pCharacteristic) {
0 commit comments