forked from espressif/arduino-esp32
Refactored use of LOG_X(LOG_TAG, ...) to log_x(...) (#2672)
* Replaced ARDUINO_VARIANT with const char * Fixed missing return value * Added quotes around defined value in macro (Issue #2193) * Change logging from Error to Verbose when not found and default available * Move Enter and Exit logging to Verbose Level * Refactored LOG_X() into log_x()
This commit is contained in:
@ -9,16 +9,7 @@
|
||||
#include <sstream>
|
||||
#include "BLERemoteDescriptor.h"
|
||||
#include "GeneralUtils.h"
|
||||
#if defined(ARDUINO_ARCH_ESP32) && defined(CONFIG_ARDUHAL_ESP_LOG)
|
||||
#include "esp32-hal-log.h"
|
||||
#define LOG_TAG ""
|
||||
#else
|
||||
#include "esp_log.h"
|
||||
static const char* LOG_TAG = "BLERemoteDescriptor";
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
BLERemoteDescriptor::BLERemoteDescriptor(
|
||||
uint16_t handle,
|
||||
@ -59,11 +50,11 @@ BLEUUID BLERemoteDescriptor::getUUID() {
|
||||
|
||||
|
||||
std::string BLERemoteDescriptor::readValue() {
|
||||
ESP_LOGD(LOG_TAG, ">> readValue: %s", toString().c_str());
|
||||
log_v(">> readValue: %s", toString().c_str());
|
||||
|
||||
// Check to see that we are connected.
|
||||
if (!getRemoteCharacteristic()->getRemoteService()->getClient()->isConnected()) {
|
||||
ESP_LOGE(LOG_TAG, "Disconnected");
|
||||
log_e("Disconnected");
|
||||
throw BLEDisconnectedException();
|
||||
}
|
||||
|
||||
@ -77,7 +68,7 @@ std::string BLERemoteDescriptor::readValue() {
|
||||
ESP_GATT_AUTH_REQ_NONE); // Security
|
||||
|
||||
if (errRc != ESP_OK) {
|
||||
ESP_LOGE(LOG_TAG, "esp_ble_gattc_read_char: rc=%d %s", errRc, GeneralUtils::errorToString(errRc));
|
||||
log_e("esp_ble_gattc_read_char: rc=%d %s", errRc, GeneralUtils::errorToString(errRc));
|
||||
return "";
|
||||
}
|
||||
|
||||
@ -85,7 +76,7 @@ std::string BLERemoteDescriptor::readValue() {
|
||||
// in m_value will contain our data.
|
||||
m_semaphoreReadDescrEvt.wait("readValue");
|
||||
|
||||
ESP_LOGD(LOG_TAG, "<< readValue(): length: %d", m_value.length());
|
||||
log_v("<< readValue(): length: %d", m_value.length());
|
||||
return m_value;
|
||||
} // readValue
|
||||
|
||||
@ -135,10 +126,10 @@ std::string BLERemoteDescriptor::toString() {
|
||||
* @param [in] response True if we expect a response.
|
||||
*/
|
||||
void BLERemoteDescriptor::writeValue(uint8_t* data, size_t length, bool response) {
|
||||
ESP_LOGD(LOG_TAG, ">> writeValue: %s", toString().c_str());
|
||||
log_v(">> writeValue: %s", toString().c_str());
|
||||
// Check to see that we are connected.
|
||||
if (!getRemoteCharacteristic()->getRemoteService()->getClient()->isConnected()) {
|
||||
ESP_LOGE(LOG_TAG, "Disconnected");
|
||||
log_e("Disconnected");
|
||||
throw BLEDisconnectedException();
|
||||
}
|
||||
|
||||
@ -152,9 +143,9 @@ void BLERemoteDescriptor::writeValue(uint8_t* data, size_t length, bool response
|
||||
ESP_GATT_AUTH_REQ_NONE
|
||||
);
|
||||
if (errRc != ESP_OK) {
|
||||
ESP_LOGE(LOG_TAG, "esp_ble_gattc_write_char_descr: %d", errRc);
|
||||
log_e("esp_ble_gattc_write_char_descr: %d", errRc);
|
||||
}
|
||||
ESP_LOGD(LOG_TAG, "<< writeValue");
|
||||
log_v("<< writeValue");
|
||||
} // writeValue
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user