@@ -279,13 +279,13 @@ void BLECharacteristic::handleGATTServerEvent(esp_gatts_cb_event_t event, esp_ga
279
279
280
280
log_d (" - Response to write event: New value: handle: %.2x, uuid: %s" , getHandle (), getUUID ().toString ().c_str ());
281
281
282
- // The call to BLEUtils::buildHexData() doesn't output anything if the log level is not
283
- // "DEBUG". As it is quite CPU intensive, it is much better to not call it if not needed.
284
- #if ARDUHAL_LOG_LEVEL >= ARDUHAL_LOG_LEVEL_DEBUG
285
- char *pHexData = BLEUtils::buildHexData (nullptr , param->write .value , param->write .len );
286
- log_d (" - Data: length: %d, data: %s" , param->write .len , pHexData);
287
- free (pHexData);
288
- #endif
282
+ // The call to BLEUtils::buildHexData() doesn't output anything if the log level is not
283
+ // "DEBUG". As it is quite CPU intensive, it is much better to not call it if not needed.
284
+ #if ARDUHAL_LOG_LEVEL >= ARDUHAL_LOG_LEVEL_DEBUG
285
+ char *pHexData = BLEUtils::buildHexData (nullptr , param->write .value , param->write .len );
286
+ log_d (" - Data: length: %d, data: %s" , param->write .len , pHexData);
287
+ free (pHexData);
288
+ #endif
289
289
290
290
if (param->write .need_rsp ) {
291
291
esp_gatt_rsp_t rsp;
@@ -394,13 +394,13 @@ void BLECharacteristic::handleGATTServerEvent(esp_gatts_cb_event_t event, esp_ga
394
394
rsp.attr_value .handle = param->read .handle ;
395
395
rsp.attr_value .auth_req = ESP_GATT_AUTH_REQ_NONE;
396
396
397
- // The call to BLEUtils::buildHexData() doesn't output anything if the log level is not
398
- // "DEBUG". As it is quite CPU intensive, it is much better to not call it if not needed.
399
- #if ARDUHAL_LOG_LEVEL >= ARDUHAL_LOG_LEVEL_DEBUG
400
- char *pHexData = BLEUtils::buildHexData (nullptr , rsp.attr_value .value , rsp.attr_value .len );
401
- log_d (" - Data: length=%d, data=%s, offset=%d" , rsp.attr_value .len , pHexData, rsp.attr_value .offset );
402
- free (pHexData);
403
- #endif
397
+ // The call to BLEUtils::buildHexData() doesn't output anything if the log level is not
398
+ // "DEBUG". As it is quite CPU intensive, it is much better to not call it if not needed.
399
+ #if ARDUHAL_LOG_LEVEL >= ARDUHAL_LOG_LEVEL_DEBUG
400
+ char *pHexData = BLEUtils::buildHexData (nullptr , rsp.attr_value .value , rsp.attr_value .len );
401
+ log_d (" - Data: length=%d, data=%s, offset=%d" , rsp.attr_value .len , pHexData, rsp.attr_value .offset );
402
+ free (pHexData);
403
+ #endif
404
404
405
405
esp_err_t errRc = ::esp_ble_gatts_send_response (gatts_if, param->read .conn_id , param->read .trans_id , ESP_GATT_OK, &rsp);
406
406
if (errRc != ESP_OK) {
@@ -490,10 +490,10 @@ void BLECharacteristic::notify(bool is_notification) {
490
490
// it's better to put it here also, as it is clearer (indicating a verbose log
491
491
// thing) and it allows to remove the "m_value.getValue().c_str()" call, which
492
492
// is, in itself, quite CPU intensive.
493
- #if ARDUHAL_LOG_LEVEL >= ARDUHAL_LOG_LEVEL_VERBOSE
493
+ #if ARDUHAL_LOG_LEVEL >= ARDUHAL_LOG_LEVEL_VERBOSE
494
494
GeneralUtils::hexDump ((uint8_t *)m_value.getValue ().c_str (), m_value.getValue ().length ());
495
495
#endif
496
-
496
+
497
497
if (getService ()->getServer ()->getConnectedCount () == 0 ) {
498
498
log_v (" << notify: No connected clients." );
499
499
m_pCallbacks->onStatus (this , BLECharacteristicCallbacks::Status::ERROR_NO_CLIENT, 0 );
@@ -645,13 +645,13 @@ void BLECharacteristic::setReadProperty(bool value) {
645
645
* @param [in] length The length of the data in bytes.
646
646
*/
647
647
void BLECharacteristic::setValue (uint8_t *data, size_t length) {
648
- // The call to BLEUtils::buildHexData() doesn't output anything if the log level is not
649
- // "VERBOSE". As it is quite CPU intensive, it is much better to not call it if not needed.
650
- #if ARDUHAL_LOG_LEVEL >= ARDUHAL_LOG_LEVEL_VERBOSE
651
- char *pHex = BLEUtils::buildHexData (nullptr , data, length);
652
- log_v (" >> setValue: length=%d, data=%s, characteristic UUID=%s" , length, pHex, getUUID ().toString ().c_str ());
653
- free (pHex);
654
- #endif
648
+ // The call to BLEUtils::buildHexData() doesn't output anything if the log level is not
649
+ // "VERBOSE". As it is quite CPU intensive, it is much better to not call it if not needed.
650
+ #if ARDUHAL_LOG_LEVEL >= ARDUHAL_LOG_LEVEL_VERBOSE
651
+ char *pHex = BLEUtils::buildHexData (nullptr , data, length);
652
+ log_v (" >> setValue: length=%d, data=%s, characteristic UUID=%s" , length, pHex, getUUID ().toString ().c_str ());
653
+ free (pHex);
654
+ #endif
655
655
if (length > ESP_GATT_MAX_ATTR_LEN) {
656
656
log_e (" Size %d too large, must be no bigger than %d" , length, ESP_GATT_MAX_ATTR_LEN);
657
657
return ;
0 commit comments