@@ -279,13 +279,13 @@ void BLECharacteristic::handleGATTServerEvent(esp_gatts_cb_event_t event, esp_ga
279279
280280 log_d (" - Response to write event: New value: handle: %.2x, uuid: %s" , getHandle (), getUUID ().toString ().c_str ());
281281
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
289289
290290 if (param->write .need_rsp ) {
291291 esp_gatt_rsp_t rsp;
@@ -394,13 +394,13 @@ void BLECharacteristic::handleGATTServerEvent(esp_gatts_cb_event_t event, esp_ga
394394 rsp.attr_value .handle = param->read .handle ;
395395 rsp.attr_value .auth_req = ESP_GATT_AUTH_REQ_NONE;
396396
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
404404
405405 esp_err_t errRc = ::esp_ble_gatts_send_response (gatts_if, param->read .conn_id , param->read .trans_id , ESP_GATT_OK, &rsp);
406406 if (errRc != ESP_OK) {
@@ -490,10 +490,10 @@ void BLECharacteristic::notify(bool is_notification) {
490490 // it's better to put it here also, as it is clearer (indicating a verbose log
491491 // thing) and it allows to remove the "m_value.getValue().c_str()" call, which
492492 // is, in itself, quite CPU intensive.
493- #if ARDUHAL_LOG_LEVEL >= ARDUHAL_LOG_LEVEL_VERBOSE
493+ #if ARDUHAL_LOG_LEVEL >= ARDUHAL_LOG_LEVEL_VERBOSE
494494 GeneralUtils::hexDump ((uint8_t *)m_value.getValue ().c_str (), m_value.getValue ().length ());
495495#endif
496-
496+
497497 if (getService ()->getServer ()->getConnectedCount () == 0 ) {
498498 log_v (" << notify: No connected clients." );
499499 m_pCallbacks->onStatus (this , BLECharacteristicCallbacks::Status::ERROR_NO_CLIENT, 0 );
@@ -645,13 +645,13 @@ void BLECharacteristic::setReadProperty(bool value) {
645645 * @param [in] length The length of the data in bytes.
646646 */
647647void 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
655655 if (length > ESP_GATT_MAX_ATTR_LEN) {
656656 log_e (" Size %d too large, must be no bigger than %d" , length, ESP_GATT_MAX_ATTR_LEN);
657657 return ;
0 commit comments