From 601a094fb5a24a4c90901cd1ab0e299c671bbb6e Mon Sep 17 00:00:00 2001 From: Bascy Date: Thu, 11 Oct 2018 23:05:53 +0200 Subject: [PATCH 1/5] Replaced ARDUINO_VARIANT with const char --- libraries/ESPmDNS/src/ESPmDNS.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/ESPmDNS/src/ESPmDNS.cpp b/libraries/ESPmDNS/src/ESPmDNS.cpp index 42a4ad50349..89de0006486 100644 --- a/libraries/ESPmDNS/src/ESPmDNS.cpp +++ b/libraries/ESPmDNS/src/ESPmDNS.cpp @@ -82,7 +82,7 @@ void MDNSResponder::setInstanceName(String name) { void MDNSResponder::enableArduino(uint16_t port, bool auth){ mdns_txt_item_t arduTxtData[4] = { - {(char*)"board" ,(char*)ARDUINO_VARIANT}, + {(char*)"board" ,(char*)"esp32"}, {(char*)"tcp_check" ,(char*)"no"}, {(char*)"ssh_upload" ,(char*)"no"}, {(char*)"auth_upload" ,(char*)"no"} From 7fb2f31990879224a358c37269d3e1fb67fd5c8c Mon Sep 17 00:00:00 2001 From: Bascy Date: Sat, 10 Nov 2018 22:28:26 +0100 Subject: [PATCH 2/5] Fixed missing return value --- cores/esp32/esp32-hal-uart.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cores/esp32/esp32-hal-uart.c b/cores/esp32/esp32-hal-uart.c index 08956e18797..bc75e5157d2 100644 --- a/cores/esp32/esp32-hal-uart.c +++ b/cores/esp32/esp32-hal-uart.c @@ -242,7 +242,7 @@ void uartEnd(uart_t* uart) size_t uartResizeRxBuffer(uart_t * uart, size_t new_size) { if(uart == NULL) { - return; + return 0; } UART_MUTEX_LOCK(); From a29962ee7b1d3e7cf7ddb8ace90540f10806c23b Mon Sep 17 00:00:00 2001 From: Bascy Date: Sat, 15 Dec 2018 22:24:57 +0100 Subject: [PATCH 3/5] Added quotes around defined value in macro (Issue #2193) --- libraries/ESPmDNS/src/ESPmDNS.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/libraries/ESPmDNS/src/ESPmDNS.cpp b/libraries/ESPmDNS/src/ESPmDNS.cpp index 89de0006486..2211f67b9c7 100644 --- a/libraries/ESPmDNS/src/ESPmDNS.cpp +++ b/libraries/ESPmDNS/src/ESPmDNS.cpp @@ -43,6 +43,14 @@ License (MIT license): #include #include "esp_wifi.h" +// Add quotes around defined value +#ifdef __IN_ECLIPSE__ +#define STR_EXPAND(tok) #tok +#define STR(tok) STR_EXPAND(tok) +#else +#define STR(tok) tok +#endif + static void _on_sys_event(system_event_t *event){ mdns_handle_system_event(NULL, event); } @@ -82,7 +90,7 @@ void MDNSResponder::setInstanceName(String name) { void MDNSResponder::enableArduino(uint16_t port, bool auth){ mdns_txt_item_t arduTxtData[4] = { - {(char*)"board" ,(char*)"esp32"}, + {(char*)"board" ,(char*)STR(ARDUINO_VARIANT)}, {(char*)"tcp_check" ,(char*)"no"}, {(char*)"ssh_upload" ,(char*)"no"}, {(char*)"auth_upload" ,(char*)"no"} From 93236815bc1d4b07cc6b74bacae7cf22baad1ff9 Mon Sep 17 00:00:00 2001 From: Bascy Date: Sat, 13 Apr 2019 16:42:05 +0200 Subject: [PATCH 4/5] Change logging from Error to Verbose when not found and default available --- libraries/Preferences/src/Preferences.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/libraries/Preferences/src/Preferences.cpp b/libraries/Preferences/src/Preferences.cpp index 81b9b1989b1..812397d0ff5 100644 --- a/libraries/Preferences/src/Preferences.cpp +++ b/libraries/Preferences/src/Preferences.cpp @@ -291,7 +291,7 @@ int8_t Preferences::getChar(const char* key, const int8_t defaultValue){ } esp_err_t err = nvs_get_i8(_handle, key, &value); if(err){ - log_e("nvs_get_i8 fail: %s %s", key, nvs_error(err)); + log_v("nvs_get_i8 fail: %s %s", key, nvs_error(err)); } return value; } @@ -303,7 +303,7 @@ uint8_t Preferences::getUChar(const char* key, const uint8_t defaultValue){ } esp_err_t err = nvs_get_u8(_handle, key, &value); if(err){ - log_e("nvs_get_u8 fail: %s %s", key, nvs_error(err)); + log_v("nvs_get_u8 fail: %s %s", key, nvs_error(err)); } return value; } @@ -315,7 +315,7 @@ int16_t Preferences::getShort(const char* key, const int16_t defaultValue){ } esp_err_t err = nvs_get_i16(_handle, key, &value); if(err){ - log_e("nvs_get_i16 fail: %s %s", key, nvs_error(err)); + log_v("nvs_get_i16 fail: %s %s", key, nvs_error(err)); } return value; } @@ -327,7 +327,7 @@ uint16_t Preferences::getUShort(const char* key, const uint16_t defaultValue){ } esp_err_t err = nvs_get_u16(_handle, key, &value); if(err){ - log_e("nvs_get_u16 fail: %s %s", key, nvs_error(err)); + log_v("nvs_get_u16 fail: %s %s", key, nvs_error(err)); } return value; } @@ -339,7 +339,7 @@ int32_t Preferences::getInt(const char* key, const int32_t defaultValue){ } esp_err_t err = nvs_get_i32(_handle, key, &value); if(err){ - log_e("nvs_get_i32 fail: %s %s", key, nvs_error(err)); + log_v("nvs_get_i32 fail: %s %s", key, nvs_error(err)); } return value; } @@ -351,7 +351,7 @@ uint32_t Preferences::getUInt(const char* key, const uint32_t defaultValue){ } esp_err_t err = nvs_get_u32(_handle, key, &value); if(err){ - log_e("nvs_get_u32 fail: %s %s", key, nvs_error(err)); + log_v("nvs_get_u32 fail: %s %s", key, nvs_error(err)); } return value; } @@ -371,7 +371,7 @@ int64_t Preferences::getLong64(const char* key, const int64_t defaultValue){ } esp_err_t err = nvs_get_i64(_handle, key, &value); if(err){ - log_e("nvs_get_i64 fail: %s %s", key, nvs_error(err)); + log_v("nvs_get_i64 fail: %s %s", key, nvs_error(err)); } return value; } @@ -383,7 +383,7 @@ uint64_t Preferences::getULong64(const char* key, const uint64_t defaultValue){ } esp_err_t err = nvs_get_u64(_handle, key, &value); if(err){ - log_e("nvs_get_u64 fail: %s %s", key, nvs_error(err)); + log_v("nvs_get_u64 fail: %s %s", key, nvs_error(err)); } return value; } From 16fd65ace3c8921826c1c95d6e0fe2cbbdb3071a Mon Sep 17 00:00:00 2001 From: Bascy Date: Sat, 13 Apr 2019 22:49:39 +0200 Subject: [PATCH 5/5] Move Enter and Exit logging to Verbose Level --- libraries/BLE/src/BLEAdvertising.cpp | 26 ++++++------- libraries/BLE/src/BLECharacteristic.cpp | 38 +++++++++---------- libraries/BLE/src/BLEClient.cpp | 36 +++++++++--------- libraries/BLE/src/BLEDescriptor.cpp | 12 +++--- libraries/BLE/src/BLEDevice.cpp | 38 +++++++++---------- libraries/BLE/src/BLERemoteCharacteristic.cpp | 30 +++++++-------- libraries/BLE/src/BLERemoteDescriptor.cpp | 8 ++-- libraries/BLE/src/BLERemoteService.cpp | 24 ++++++------ libraries/BLE/src/BLEScan.cpp | 10 ++--- libraries/BLE/src/BLEServer.cpp | 18 ++++----- libraries/BLE/src/BLEService.cpp | 24 ++++++------ libraries/BLE/src/BLEUUID.cpp | 4 +- libraries/BLE/src/BLEValue.cpp | 8 ++-- 13 files changed, 138 insertions(+), 138 deletions(-) diff --git a/libraries/BLE/src/BLEAdvertising.cpp b/libraries/BLE/src/BLEAdvertising.cpp index 230d77cb7cd..70e0a65546e 100644 --- a/libraries/BLE/src/BLEAdvertising.cpp +++ b/libraries/BLE/src/BLEAdvertising.cpp @@ -120,25 +120,25 @@ void BLEAdvertising::setScanResponse(bool set) { * @param [in] connectWhitelistOnly If true, only allow connections from those on the white list. */ void BLEAdvertising::setScanFilter(bool scanRequestWhitelistOnly, bool connectWhitelistOnly) { - ESP_LOGD(LOG_TAG, ">> setScanFilter: scanRequestWhitelistOnly: %d, connectWhitelistOnly: %d", scanRequestWhitelistOnly, connectWhitelistOnly); + ESP_LOGV(LOG_TAG, ">> setScanFilter: scanRequestWhitelistOnly: %d, connectWhitelistOnly: %d", scanRequestWhitelistOnly, connectWhitelistOnly); if (!scanRequestWhitelistOnly && !connectWhitelistOnly) { m_advParams.adv_filter_policy = ADV_FILTER_ALLOW_SCAN_ANY_CON_ANY; - ESP_LOGD(LOG_TAG, "<< setScanFilter"); + ESP_LOGV(LOG_TAG, "<< setScanFilter"); return; } if (scanRequestWhitelistOnly && !connectWhitelistOnly) { m_advParams.adv_filter_policy = ADV_FILTER_ALLOW_SCAN_WLST_CON_ANY; - ESP_LOGD(LOG_TAG, "<< setScanFilter"); + ESP_LOGV(LOG_TAG, "<< setScanFilter"); return; } if (!scanRequestWhitelistOnly && connectWhitelistOnly) { m_advParams.adv_filter_policy = ADV_FILTER_ALLOW_SCAN_ANY_CON_WLST; - ESP_LOGD(LOG_TAG, "<< setScanFilter"); + ESP_LOGV(LOG_TAG, "<< setScanFilter"); return; } if (scanRequestWhitelistOnly && connectWhitelistOnly) { m_advParams.adv_filter_policy = ADV_FILTER_ALLOW_SCAN_WLST_CON_WLST; - ESP_LOGD(LOG_TAG, "<< setScanFilter"); + ESP_LOGV(LOG_TAG, "<< setScanFilter"); return; } } // setScanFilter @@ -149,7 +149,7 @@ void BLEAdvertising::setScanFilter(bool scanRequestWhitelistOnly, bool connectWh * @param [in] advertisementData The data to be advertised. */ void BLEAdvertising::setAdvertisementData(BLEAdvertisementData& advertisementData) { - ESP_LOGD(LOG_TAG, ">> setAdvertisementData"); + ESP_LOGV(LOG_TAG, ">> setAdvertisementData"); esp_err_t errRc = ::esp_ble_gap_config_adv_data_raw( (uint8_t*)advertisementData.getPayload().data(), advertisementData.getPayload().length()); @@ -157,7 +157,7 @@ void BLEAdvertising::setAdvertisementData(BLEAdvertisementData& advertisementDat ESP_LOGE(LOG_TAG, "esp_ble_gap_config_adv_data_raw: %d %s", errRc, GeneralUtils::errorToString(errRc)); } m_customAdvData = true; // Set the flag that indicates we are using custom advertising data. - ESP_LOGD(LOG_TAG, "<< setAdvertisementData"); + ESP_LOGV(LOG_TAG, "<< setAdvertisementData"); } // setAdvertisementData @@ -166,7 +166,7 @@ void BLEAdvertising::setAdvertisementData(BLEAdvertisementData& advertisementDat * @param [in] advertisementData The data to be advertised. */ void BLEAdvertising::setScanResponseData(BLEAdvertisementData& advertisementData) { - ESP_LOGD(LOG_TAG, ">> setScanResponseData"); + ESP_LOGV(LOG_TAG, ">> setScanResponseData"); esp_err_t errRc = ::esp_ble_gap_config_scan_rsp_data_raw( (uint8_t*)advertisementData.getPayload().data(), advertisementData.getPayload().length()); @@ -174,7 +174,7 @@ void BLEAdvertising::setScanResponseData(BLEAdvertisementData& advertisementData ESP_LOGE(LOG_TAG, "esp_ble_gap_config_scan_rsp_data_raw: %d %s", errRc, GeneralUtils::errorToString(errRc)); } m_customScanResponseData = true; // Set the flag that indicates we are using custom scan response data. - ESP_LOGD(LOG_TAG, "<< setScanResponseData"); + ESP_LOGV(LOG_TAG, "<< setScanResponseData"); } // setScanResponseData /** @@ -183,7 +183,7 @@ void BLEAdvertising::setScanResponseData(BLEAdvertisementData& advertisementData * @return N/A. */ void BLEAdvertising::start() { - ESP_LOGD(LOG_TAG, ">> start: customAdvData: %d, customScanResponseData: %d", m_customAdvData, m_customScanResponseData); + ESP_LOGV(LOG_TAG, ">> start: customAdvData: %d, customScanResponseData: %d", m_customAdvData, m_customScanResponseData); // We have a vector of service UUIDs that we wish to advertise. In order to use the // ESP-IDF framework, these must be supplied in a contiguous array of their 128bit (16 byte) @@ -243,7 +243,7 @@ void BLEAdvertising::start() { ESP_LOGE(LOG_TAG, "<< esp_ble_gap_start_advertising: rc=%d %s", errRc, GeneralUtils::errorToString(errRc)); return; } - ESP_LOGD(LOG_TAG, "<< start"); + ESP_LOGV(LOG_TAG, "<< start"); } // start @@ -253,13 +253,13 @@ void BLEAdvertising::start() { * @return N/A. */ void BLEAdvertising::stop() { - ESP_LOGD(LOG_TAG, ">> stop"); + ESP_LOGV(LOG_TAG, ">> stop"); esp_err_t errRc = ::esp_ble_gap_stop_advertising(); if (errRc != ESP_OK) { ESP_LOGE(LOG_TAG, "esp_ble_gap_stop_advertising: rc=%d %s", errRc, GeneralUtils::errorToString(errRc)); return; } - ESP_LOGD(LOG_TAG, "<< stop"); + ESP_LOGV(LOG_TAG, "<< stop"); } // stop /** diff --git a/libraries/BLE/src/BLECharacteristic.cpp b/libraries/BLE/src/BLECharacteristic.cpp index e3402874298..6ab757c480a 100644 --- a/libraries/BLE/src/BLECharacteristic.cpp +++ b/libraries/BLE/src/BLECharacteristic.cpp @@ -70,9 +70,9 @@ BLECharacteristic::~BLECharacteristic() { * @return N/A. */ void BLECharacteristic::addDescriptor(BLEDescriptor* pDescriptor) { - ESP_LOGD(LOG_TAG, ">> addDescriptor(): Adding %s to %s", pDescriptor->toString().c_str(), toString().c_str()); + ESP_LOGV(LOG_TAG, ">> addDescriptor(): Adding %s to %s", pDescriptor->toString().c_str(), toString().c_str()); m_descriptorMap.setByUUID(pDescriptor->getUUID(), pDescriptor); - ESP_LOGD(LOG_TAG, "<< addDescriptor()"); + ESP_LOGV(LOG_TAG, "<< addDescriptor()"); } // addDescriptor @@ -81,7 +81,7 @@ void BLECharacteristic::addDescriptor(BLEDescriptor* pDescriptor) { * @param [in] pService The service with which to associate this characteristic. */ void BLECharacteristic::executeCreate(BLEService* pService) { - ESP_LOGD(LOG_TAG, ">> executeCreate()"); + ESP_LOGV(LOG_TAG, ">> executeCreate()"); if (m_handle != NULL_HANDLE) { ESP_LOGE(LOG_TAG, "Characteristic already has a handle."); @@ -118,7 +118,7 @@ void BLECharacteristic::executeCreate(BLEService* pService) { pDescriptor = m_descriptorMap.getNext(); } // End while - ESP_LOGD(LOG_TAG, "<< executeCreate"); + ESP_LOGV(LOG_TAG, "<< executeCreate"); } // executeCreate @@ -200,7 +200,7 @@ void BLECharacteristic::handleGATTServerEvent( esp_gatts_cb_event_t event, esp_gatt_if_t gatts_if, esp_ble_gatts_cb_param_t* param) { - ESP_LOGD(LOG_TAG, ">> handleGATTServerEvent: %s", BLEUtils::gattServerEventTypeToString(event).c_str()); + ESP_LOGV(LOG_TAG, ">> handleGATTServerEvent: %s", BLEUtils::gattServerEventTypeToString(event).c_str()); switch(event) { // Events handled: @@ -456,7 +456,7 @@ void BLECharacteristic::handleGATTServerEvent( // event. m_descriptorMap.handleGATTServerEvent(event, gatts_if, param); - ESP_LOGD(LOG_TAG, "<< handleGATTServerEvent"); + ESP_LOGV(LOG_TAG, "<< handleGATTServerEvent"); } // handleGATTServerEvent @@ -468,9 +468,9 @@ void BLECharacteristic::handleGATTServerEvent( */ void BLECharacteristic::indicate() { - ESP_LOGD(LOG_TAG, ">> indicate: length: %d", m_value.getValue().length()); + ESP_LOGV(LOG_TAG, ">> indicate: length: %d", m_value.getValue().length()); notify(false); - ESP_LOGD(LOG_TAG, "<< indicate"); + ESP_LOGV(LOG_TAG, "<< indicate"); } // indicate @@ -481,7 +481,7 @@ void BLECharacteristic::indicate() { * @return N/A. */ void BLECharacteristic::notify(bool is_notification) { - ESP_LOGD(LOG_TAG, ">> notify: length: %d", m_value.getValue().length()); + ESP_LOGV(LOG_TAG, ">> notify: length: %d", m_value.getValue().length()); assert(getService() != nullptr); assert(getService()->getServer() != nullptr); @@ -489,7 +489,7 @@ void BLECharacteristic::notify(bool is_notification) { GeneralUtils::hexDump((uint8_t*)m_value.getValue().data(), m_value.getValue().length()); if (getService()->getServer()->getConnectedCount() == 0) { - ESP_LOGD(LOG_TAG, "<< notify: No connected clients."); + ESP_LOGV(LOG_TAG, "<< notify: No connected clients."); return; } @@ -499,13 +499,13 @@ void BLECharacteristic::notify(bool is_notification) { BLE2902 *p2902 = (BLE2902*)getDescriptorByUUID((uint16_t)0x2902); if(is_notification) { if (p2902 != nullptr && !p2902->getNotifications()) { - ESP_LOGD(LOG_TAG, "<< notifications disabled; ignoring"); + ESP_LOGV(LOG_TAG, "<< notifications disabled; ignoring"); return; } } else{ if (p2902 != nullptr && !p2902->getIndications()) { - ESP_LOGD(LOG_TAG, "<< indications disabled; ignoring"); + ESP_LOGV(LOG_TAG, "<< indications disabled; ignoring"); return; } } @@ -530,7 +530,7 @@ void BLECharacteristic::notify(bool is_notification) { if(!is_notification) m_semaphoreConfEvt.wait("indicate"); } - ESP_LOGD(LOG_TAG, "<< notify"); + ESP_LOGV(LOG_TAG, "<< notify"); } // Notify @@ -556,9 +556,9 @@ void BLECharacteristic::setBroadcastProperty(bool value) { * @param [in] pCallbacks An instance of a callbacks structure used to define any callbacks for the characteristic. */ void BLECharacteristic::setCallbacks(BLECharacteristicCallbacks* pCallbacks) { - ESP_LOGD(LOG_TAG, ">> setCallbacks: 0x%x", (uint32_t)pCallbacks); + ESP_LOGV(LOG_TAG, ">> setCallbacks: 0x%x", (uint32_t)pCallbacks); m_pCallbacks = pCallbacks; - ESP_LOGD(LOG_TAG, "<< setCallbacks"); + ESP_LOGV(LOG_TAG, "<< setCallbacks"); } // setCallbacks @@ -573,9 +573,9 @@ void BLECharacteristic::setCallbacks(BLECharacteristicCallbacks* pCallbacks) { * @param [in] handle The handle associated with this characteristic. */ void BLECharacteristic::setHandle(uint16_t handle) { - ESP_LOGD(LOG_TAG, ">> setHandle: handle=0x%.2x, characteristic uuid=%s", handle, getUUID().toString().c_str()); + ESP_LOGV(LOG_TAG, ">> setHandle: handle=0x%.2x, characteristic uuid=%s", handle, getUUID().toString().c_str()); m_handle = handle; - ESP_LOGD(LOG_TAG, "<< setHandle"); + ESP_LOGV(LOG_TAG, "<< setHandle"); } // setHandle @@ -628,14 +628,14 @@ void BLECharacteristic::setReadProperty(bool value) { */ void BLECharacteristic::setValue(uint8_t* data, size_t length) { char* pHex = BLEUtils::buildHexData(nullptr, data, length); - ESP_LOGD(LOG_TAG, ">> setValue: length=%d, data=%s, characteristic UUID=%s", length, pHex, getUUID().toString().c_str()); + ESP_LOGV(LOG_TAG, ">> setValue: length=%d, data=%s, characteristic UUID=%s", length, pHex, getUUID().toString().c_str()); free(pHex); if (length > ESP_GATT_MAX_ATTR_LEN) { ESP_LOGE(LOG_TAG, "Size %d too large, must be no bigger than %d", length, ESP_GATT_MAX_ATTR_LEN); return; } m_value.setValue(data, length); - ESP_LOGD(LOG_TAG, "<< setValue"); + ESP_LOGV(LOG_TAG, "<< setValue"); } // setValue diff --git a/libraries/BLE/src/BLEClient.cpp b/libraries/BLE/src/BLEClient.cpp index 0e552ece5f8..e5726f64e90 100644 --- a/libraries/BLE/src/BLEClient.cpp +++ b/libraries/BLE/src/BLEClient.cpp @@ -75,14 +75,14 @@ BLEClient::~BLEClient() { * */ void BLEClient::clearServices() { - ESP_LOGD(LOG_TAG, ">> clearServices"); + ESP_LOGV(LOG_TAG, ">> clearServices"); // Delete all the services. for (auto &myPair : m_servicesMap) { delete myPair.second; } m_servicesMap.clear(); m_haveServices = false; - ESP_LOGD(LOG_TAG, "<< clearServices"); + ESP_LOGV(LOG_TAG, "<< clearServices"); } // clearServices /** @@ -100,7 +100,7 @@ bool BLEClient::connect(BLEAdvertisedDevice* device) { * @return True on success. */ bool BLEClient::connect(BLEAddress address, esp_ble_addr_type_t type) { - ESP_LOGD(LOG_TAG, ">> connect(%s)", address.toString().c_str()); + ESP_LOGV(LOG_TAG, ">> connect(%s)", address.toString().c_str()); // We need the connection handle that we get from registering the application. We register the app // and then block on its completion. When the event has arrived, we will have the handle. @@ -133,7 +133,7 @@ bool BLEClient::connect(BLEAddress address, esp_ble_addr_type_t type) { } uint32_t rc = m_semaphoreOpenEvt.wait("connect"); // Wait for the connection to complete. - ESP_LOGD(LOG_TAG, "<< connect(), rc=%d", rc==ESP_GATT_OK); + ESP_LOGV(LOG_TAG, "<< connect(), rc=%d", rc==ESP_GATT_OK); return rc == ESP_GATT_OK; } // connect @@ -143,13 +143,13 @@ bool BLEClient::connect(BLEAddress address, esp_ble_addr_type_t type) { * @return N/A. */ void BLEClient::disconnect() { - ESP_LOGD(LOG_TAG, ">> disconnect()"); + ESP_LOGV(LOG_TAG, ">> disconnect()"); esp_err_t errRc = ::esp_ble_gattc_close(getGattcIf(), getConnId()); if (errRc != ESP_OK) { ESP_LOGE(LOG_TAG, "esp_ble_gattc_close: rc=%d %s", errRc, GeneralUtils::errorToString(errRc)); return; } - ESP_LOGD(LOG_TAG, "<< disconnect()"); + ESP_LOGV(LOG_TAG, "<< disconnect()"); } // disconnect @@ -343,9 +343,9 @@ BLEAddress BLEClient::getPeerAddress() { * @return The RSSI value. */ int BLEClient::getRssi() { - ESP_LOGD(LOG_TAG, ">> getRssi()"); + ESP_LOGV(LOG_TAG, ">> getRssi()"); if (!isConnected()) { - ESP_LOGD(LOG_TAG, "<< getRssi(): Not connected"); + ESP_LOGV(LOG_TAG, "<< getRssi(): Not connected"); return 0; } // We make the API call to read the RSSI value which is an asynchronous operation. We expect to receive @@ -358,7 +358,7 @@ int BLEClient::getRssi() { return 0; } int rssiValue = m_semaphoreRssiCmplEvt.wait("getRssi"); - ESP_LOGD(LOG_TAG, "<< getRssi(): %d", rssiValue); + ESP_LOGV(LOG_TAG, "<< getRssi(): %d", rssiValue); return rssiValue; } // getRssi @@ -380,7 +380,7 @@ BLERemoteService* BLEClient::getService(const char* uuid) { * @throws BLEUuidNotFound */ BLERemoteService* BLEClient::getService(BLEUUID uuid) { - ESP_LOGD(LOG_TAG, ">> getService: uuid: %s", uuid.toString().c_str()); + ESP_LOGV(LOG_TAG, ">> getService: uuid: %s", uuid.toString().c_str()); // Design // ------ // We wish to retrieve the service given its UUID. It is possible that we have not yet asked the @@ -393,11 +393,11 @@ BLERemoteService* BLEClient::getService(BLEUUID uuid) { std::string uuidStr = uuid.toString(); for (auto &myPair : m_servicesMap) { if (myPair.first == uuidStr) { - ESP_LOGD(LOG_TAG, "<< getService: found the service with uuid: %s", uuid.toString().c_str()); + ESP_LOGV(LOG_TAG, "<< getService: found the service with uuid: %s", uuid.toString().c_str()); return myPair.second; } } // End of each of the services. - ESP_LOGD(LOG_TAG, "<< getService: not found"); + ESP_LOGV(LOG_TAG, "<< getService: not found"); return nullptr; } // getService @@ -416,7 +416,7 @@ std::map* BLEClient::getServices() { * peer BLE partner to be returned as events. Each event will be an an instance of ESP_GATTC_SEARCH_RES_EVT * and will culminate with an ESP_GATTC_SEARCH_CMPL_EVT when all have been received. */ - ESP_LOGD(LOG_TAG, ">> getServices"); + ESP_LOGV(LOG_TAG, ">> getServices"); // TODO implement retrieving services from cache clearServices(); // Clear any services that may exist. @@ -433,7 +433,7 @@ std::map* BLEClient::getServices() { } // If sucessfull, remember that we now have services. m_haveServices = (m_semaphoreSearchCmplEvt.wait("getServices") == 0); - ESP_LOGD(LOG_TAG, "<< getServices"); + ESP_LOGV(LOG_TAG, "<< getServices"); return &m_servicesMap; } // getServices @@ -445,9 +445,9 @@ std::map* BLEClient::getServices() { * @throws BLEUuidNotFound */ std::string BLEClient::getValue(BLEUUID serviceUUID, BLEUUID characteristicUUID) { - ESP_LOGD(LOG_TAG, ">> getValue: serviceUUID: %s, characteristicUUID: %s", serviceUUID.toString().c_str(), characteristicUUID.toString().c_str()); + ESP_LOGV(LOG_TAG, ">> getValue: serviceUUID: %s, characteristicUUID: %s", serviceUUID.toString().c_str(), characteristicUUID.toString().c_str()); std::string ret = getService(serviceUUID)->getCharacteristic(characteristicUUID)->readValue(); - ESP_LOGD(LOG_TAG, "<> setValue: serviceUUID: %s, characteristicUUID: %s", serviceUUID.toString().c_str(), characteristicUUID.toString().c_str()); + ESP_LOGV(LOG_TAG, ">> setValue: serviceUUID: %s, characteristicUUID: %s", serviceUUID.toString().c_str(), characteristicUUID.toString().c_str()); getService(serviceUUID)->getCharacteristic(characteristicUUID)->writeValue(value); - ESP_LOGD(LOG_TAG, "<< setValue"); + ESP_LOGV(LOG_TAG, "<< setValue"); } // setValue uint16_t BLEClient::getMTU() { diff --git a/libraries/BLE/src/BLEDescriptor.cpp b/libraries/BLE/src/BLEDescriptor.cpp index ba5753dea2e..7c1f027c116 100644 --- a/libraries/BLE/src/BLEDescriptor.cpp +++ b/libraries/BLE/src/BLEDescriptor.cpp @@ -63,7 +63,7 @@ BLEDescriptor::~BLEDescriptor() { * @param [in] pCharacteristic The characteristic to which to register this descriptor. */ void BLEDescriptor::executeCreate(BLECharacteristic* pCharacteristic) { - ESP_LOGD(LOG_TAG, ">> executeCreate(): %s", toString().c_str()); + ESP_LOGV(LOG_TAG, ">> executeCreate(): %s", toString().c_str()); if (m_handle != NULL_HANDLE) { ESP_LOGE(LOG_TAG, "Descriptor already has a handle."); @@ -87,7 +87,7 @@ void BLEDescriptor::executeCreate(BLECharacteristic* pCharacteristic) { } m_semaphoreCreateEvt.wait("executeCreate"); - ESP_LOGD(LOG_TAG, "<< executeCreate"); + ESP_LOGV(LOG_TAG, "<< executeCreate"); } // executeCreate @@ -213,9 +213,9 @@ void BLEDescriptor::handleGATTServerEvent( * @param [in] pCallbacks An instance of a callback structure used to define any callbacks for the descriptor. */ void BLEDescriptor::setCallbacks(BLEDescriptorCallbacks* pCallback) { - ESP_LOGD(LOG_TAG, ">> setCallbacks: 0x%x", (uint32_t) pCallback); + ESP_LOGV(LOG_TAG, ">> setCallbacks: 0x%x", (uint32_t) pCallback); m_pCallback = pCallback; - ESP_LOGD(LOG_TAG, "<< setCallbacks"); + ESP_LOGV(LOG_TAG, "<< setCallbacks"); } // setCallbacks @@ -226,9 +226,9 @@ void BLEDescriptor::setCallbacks(BLEDescriptorCallbacks* pCallback) { * @return N/A. */ void BLEDescriptor::setHandle(uint16_t handle) { - ESP_LOGD(LOG_TAG, ">> setHandle(0x%.2x): Setting descriptor handle to be 0x%.2x", handle, handle); + ESP_LOGV(LOG_TAG, ">> setHandle(0x%.2x): Setting descriptor handle to be 0x%.2x", handle, handle); m_handle = handle; - ESP_LOGD(LOG_TAG, "<< setHandle()"); + ESP_LOGV(LOG_TAG, "<< setHandle()"); } // setHandle diff --git a/libraries/BLE/src/BLEDevice.cpp b/libraries/BLE/src/BLEDevice.cpp index cb2db41f8bf..7431b10f931 100644 --- a/libraries/BLE/src/BLEDevice.cpp +++ b/libraries/BLE/src/BLEDevice.cpp @@ -63,13 +63,13 @@ gatts_event_handler BLEDevice::m_customGattsHandler = nullptr; * @return A new instance of the client. */ /* STATIC */ BLEClient* BLEDevice::createClient() { - ESP_LOGD(LOG_TAG, ">> createClient"); + ESP_LOGV(LOG_TAG, ">> createClient"); #ifndef CONFIG_GATTC_ENABLE // Check that BLE GATTC is enabled in make menuconfig ESP_LOGE(LOG_TAG, "BLE GATTC is not enabled - CONFIG_GATTC_ENABLE not defined"); abort(); #endif // CONFIG_GATTC_ENABLE m_pClient = new BLEClient(); - ESP_LOGD(LOG_TAG, "<< createClient"); + ESP_LOGV(LOG_TAG, "<< createClient"); return m_pClient; } // createClient @@ -79,14 +79,14 @@ gatts_event_handler BLEDevice::m_customGattsHandler = nullptr; * @return A new instance of the server. */ /* STATIC */ BLEServer* BLEDevice::createServer() { - ESP_LOGD(LOG_TAG, ">> createServer"); + ESP_LOGV(LOG_TAG, ">> createServer"); #ifndef CONFIG_GATTS_ENABLE // Check that BLE GATTS is enabled in make menuconfig ESP_LOGE(LOG_TAG, "BLE GATTS is not enabled - CONFIG_GATTS_ENABLE not defined"); abort(); #endif // CONFIG_GATTS_ENABLE m_pServer = new BLEServer(); m_pServer->createApp(m_appId++); - ESP_LOGD(LOG_TAG, "<< createServer"); + ESP_LOGV(LOG_TAG, "<< createServer"); return m_pServer; } // createServer @@ -305,12 +305,12 @@ gatts_event_handler BLEDevice::m_customGattsHandler = nullptr; * try and release/delete it. */ /* STATIC */ BLEScan* BLEDevice::getScan() { - //ESP_LOGD(LOG_TAG, ">> getScan"); + //ESP_LOGV(LOG_TAG, ">> getScan"); if (m_pScan == nullptr) { m_pScan = new BLEScan(); //ESP_LOGD(LOG_TAG, " - creating a new scan object"); } - //ESP_LOGD(LOG_TAG, "<< getScan: Returning object at 0x%x", (uint32_t)m_pScan); + //ESP_LOGV(LOG_TAG, "<< getScan: Returning object at 0x%x", (uint32_t)m_pScan); return m_pScan; } // getScan @@ -322,12 +322,12 @@ gatts_event_handler BLEDevice::m_customGattsHandler = nullptr; * @param [in] characteristicUUID */ /* STATIC */ std::string BLEDevice::getValue(BLEAddress bdAddress, BLEUUID serviceUUID, BLEUUID characteristicUUID) { - ESP_LOGD(LOG_TAG, ">> getValue: bdAddress: %s, serviceUUID: %s, characteristicUUID: %s", bdAddress.toString().c_str(), serviceUUID.toString().c_str(), characteristicUUID.toString().c_str()); + ESP_LOGV(LOG_TAG, ">> getValue: bdAddress: %s, serviceUUID: %s, characteristicUUID: %s", bdAddress.toString().c_str(), serviceUUID.toString().c_str(), characteristicUUID.toString().c_str()); BLEClient* pClient = createClient(); pClient->connect(bdAddress); std::string ret = pClient->getValue(serviceUUID, characteristicUUID); pClient->disconnect(); - ESP_LOGD(LOG_TAG, "<< getValue"); + ESP_LOGV(LOG_TAG, "<< getValue"); return ret; } // getValue @@ -450,12 +450,12 @@ gatts_event_handler BLEDevice::m_customGattsHandler = nullptr; * @param [in] powerLevel. */ /* STATIC */ void BLEDevice::setPower(esp_power_level_t powerLevel) { - ESP_LOGD(LOG_TAG, ">> setPower: %d", powerLevel); + ESP_LOGV(LOG_TAG, ">> setPower: %d", powerLevel); esp_err_t errRc = ::esp_ble_tx_power_set(ESP_BLE_PWR_TYPE_DEFAULT, powerLevel); if (errRc != ESP_OK) { ESP_LOGE(LOG_TAG, "esp_ble_tx_power_set: rc=%d %s", errRc, GeneralUtils::errorToString(errRc)); }; - ESP_LOGD(LOG_TAG, "<< setPower"); + ESP_LOGV(LOG_TAG, "<< setPower"); } // setPower @@ -466,7 +466,7 @@ gatts_event_handler BLEDevice::m_customGattsHandler = nullptr; * @param [in] characteristicUUID */ /* STATIC */ void BLEDevice::setValue(BLEAddress bdAddress, BLEUUID serviceUUID, BLEUUID characteristicUUID, std::string value) { - ESP_LOGD(LOG_TAG, ">> setValue: bdAddress: %s, serviceUUID: %s, characteristicUUID: %s", bdAddress.toString().c_str(), serviceUUID.toString().c_str(), characteristicUUID.toString().c_str()); + ESP_LOGV(LOG_TAG, ">> setValue: bdAddress: %s, serviceUUID: %s, characteristicUUID: %s", bdAddress.toString().c_str(), serviceUUID.toString().c_str(), characteristicUUID.toString().c_str()); BLEClient* pClient = createClient(); pClient->connect(bdAddress); pClient->setValue(serviceUUID, characteristicUUID, value); @@ -490,12 +490,12 @@ gatts_event_handler BLEDevice::m_customGattsHandler = nullptr; * @param [in] address The address to add to the white list. */ void BLEDevice::whiteListAdd(BLEAddress address) { - ESP_LOGD(LOG_TAG, ">> whiteListAdd: %s", address.toString().c_str()); + ESP_LOGV(LOG_TAG, ">> whiteListAdd: %s", address.toString().c_str()); esp_err_t errRc = esp_ble_gap_update_whitelist(true, *address.getNative()); // True to add an entry. if (errRc != ESP_OK) { ESP_LOGE(LOG_TAG, "esp_ble_gap_update_whitelist: rc=%d %s", errRc, GeneralUtils::errorToString(errRc)); } - ESP_LOGD(LOG_TAG, "<< whiteListAdd"); + ESP_LOGV(LOG_TAG, "<< whiteListAdd"); } // whiteListAdd @@ -504,12 +504,12 @@ void BLEDevice::whiteListAdd(BLEAddress address) { * @param [in] address The address to remove from the white list. */ void BLEDevice::whiteListRemove(BLEAddress address) { - ESP_LOGD(LOG_TAG, ">> whiteListRemove: %s", address.toString().c_str()); + ESP_LOGV(LOG_TAG, ">> whiteListRemove: %s", address.toString().c_str()); esp_err_t errRc = esp_ble_gap_update_whitelist(false, *address.getNative()); // False to remove an entry. if (errRc != ESP_OK) { ESP_LOGE(LOG_TAG, "esp_ble_gap_update_whitelist: rc=%d %s", errRc, GeneralUtils::errorToString(errRc)); } - ESP_LOGD(LOG_TAG, "<< whiteListRemove"); + ESP_LOGV(LOG_TAG, "<< whiteListRemove"); } // whiteListRemove /* @@ -533,14 +533,14 @@ void BLEDevice::setSecurityCallbacks(BLESecurityCallbacks* callbacks) { * @param [in] mtu Value to set local mtu, should be larger than 23 and lower or equal to 517 */ esp_err_t BLEDevice::setMTU(uint16_t mtu) { - ESP_LOGD(LOG_TAG, ">> setLocalMTU: %d", mtu); + ESP_LOGV(LOG_TAG, ">> setLocalMTU: %d", mtu); esp_err_t err = esp_ble_gatt_set_local_mtu(mtu); if (err == ESP_OK) { m_localMTU = mtu; } else { ESP_LOGE(LOG_TAG, "can't set local mtu value: %d", mtu); } - ESP_LOGD(LOG_TAG, "<< setLocalMTU"); + ESP_LOGV(LOG_TAG, "<< setLocalMTU"); return err; } @@ -565,9 +565,9 @@ BLEAdvertising* BLEDevice::getAdvertising() { } void BLEDevice::startAdvertising() { - ESP_LOGD(LOG_TAG, ">> startAdvertising"); + ESP_LOGV(LOG_TAG, ">> startAdvertising"); getAdvertising()->start(); - ESP_LOGD(LOG_TAG, "<< startAdvertising"); + ESP_LOGV(LOG_TAG, "<< startAdvertising"); } // startAdvertising /* multi connect support */ diff --git a/libraries/BLE/src/BLERemoteCharacteristic.cpp b/libraries/BLE/src/BLERemoteCharacteristic.cpp index b6d36d886fc..6f93743d5f7 100644 --- a/libraries/BLE/src/BLERemoteCharacteristic.cpp +++ b/libraries/BLE/src/BLERemoteCharacteristic.cpp @@ -40,7 +40,7 @@ BLERemoteCharacteristic::BLERemoteCharacteristic( BLEUUID uuid, esp_gatt_char_prop_t charProp, BLERemoteService* pRemoteService) { - ESP_LOGD(LOG_TAG, ">> BLERemoteCharacteristic: handle: %d 0x%d, uuid: %s", handle, handle, uuid.toString().c_str()); + ESP_LOGV(LOG_TAG, ">> BLERemoteCharacteristic: handle: %d 0x%d, uuid: %s", handle, handle, uuid.toString().c_str()); m_handle = handle; m_uuid = uuid; m_charProp = charProp; @@ -48,7 +48,7 @@ BLERemoteCharacteristic::BLERemoteCharacteristic( m_notifyCallback = nullptr; retrieveDescriptors(); // Get the descriptors for this characteristic - ESP_LOGD(LOG_TAG, "<< BLERemoteCharacteristic"); + ESP_LOGV(LOG_TAG, "<< BLERemoteCharacteristic"); } // BLERemoteCharacteristic @@ -253,7 +253,7 @@ void BLERemoteCharacteristic::gattClientEventHandler(esp_gattc_cb_event_t event, * @brief Populate the descriptors (if any) for this characteristic. */ void BLERemoteCharacteristic::retrieveDescriptors() { - ESP_LOGD(LOG_TAG, ">> retrieveDescriptors() for characteristic: %s", getUUID().toString().c_str()); + ESP_LOGV(LOG_TAG, ">> retrieveDescriptors() for characteristic: %s", getUUID().toString().c_str()); removeDescriptors(); // Remove any existing descriptors. @@ -297,7 +297,7 @@ void BLERemoteCharacteristic::retrieveDescriptors() { offset++; } // while true //m_haveCharacteristics = true; // Remember that we have received the characteristics. - ESP_LOGD(LOG_TAG, "<< retrieveDescriptors(): Found %d descriptors.", offset); + ESP_LOGV(LOG_TAG, "<< retrieveDescriptors(): Found %d descriptors.", offset); } // getDescriptors @@ -314,8 +314,8 @@ std::map* BLERemoteCharacteristic::getDescrip * @return The handle for this characteristic. */ uint16_t BLERemoteCharacteristic::getHandle() { - //ESP_LOGD(LOG_TAG, ">> getHandle: Characteristic: %s", getUUID().toString().c_str()); - //ESP_LOGD(LOG_TAG, "<< getHandle: %d 0x%.2x", m_handle, m_handle); + //ESP_LOGV(LOG_TAG, ">> getHandle: Characteristic: %s", getUUID().toString().c_str()); + //ESP_LOGV(LOG_TAG, "<< getHandle: %d 0x%.2x", m_handle, m_handle); return m_handle; } // getHandle @@ -326,15 +326,15 @@ uint16_t BLERemoteCharacteristic::getHandle() { * @return The Remote descriptor (if present) or null if not present. */ BLERemoteDescriptor* BLERemoteCharacteristic::getDescriptor(BLEUUID uuid) { - ESP_LOGD(LOG_TAG, ">> getDescriptor: uuid: %s", uuid.toString().c_str()); + ESP_LOGV(LOG_TAG, ">> getDescriptor: uuid: %s", uuid.toString().c_str()); std::string v = uuid.toString(); for (auto &myPair : m_descriptorMap) { if (myPair.first == v) { - ESP_LOGD(LOG_TAG, "<< getDescriptor: found"); + ESP_LOGV(LOG_TAG, "<< getDescriptor: found"); return myPair.second; } } - ESP_LOGD(LOG_TAG, "<< getDescriptor: Not found"); + ESP_LOGV(LOG_TAG, "<< getDescriptor: Not found"); return nullptr; } // getDescriptor @@ -401,7 +401,7 @@ uint8_t BLERemoteCharacteristic::readUInt8() { * @return The value of the remote characteristic. */ std::string BLERemoteCharacteristic::readValue() { - ESP_LOGD(LOG_TAG, ">> readValue(): uuid: %s, handle: %d 0x%.2x", getUUID().toString().c_str(), getHandle(), getHandle()); + ESP_LOGV(LOG_TAG, ">> readValue(): uuid: %s, handle: %d 0x%.2x", getUUID().toString().c_str(), getHandle(), getHandle()); // Check to see that we are connected. if (!getRemoteService()->getClient()->isConnected()) { @@ -429,7 +429,7 @@ std::string BLERemoteCharacteristic::readValue() { // in m_value will contain our data. m_semaphoreReadCharEvt.wait("readValue"); - ESP_LOGD(LOG_TAG, "<< readValue(): length: %d", m_value.length()); + ESP_LOGV(LOG_TAG, "<< readValue(): length: %d", m_value.length()); return m_value; } // readValue @@ -441,7 +441,7 @@ std::string BLERemoteCharacteristic::readValue() { * @return N/A. */ void BLERemoteCharacteristic::registerForNotify(notify_callback notifyCallback, bool notifications) { - ESP_LOGD(LOG_TAG, ">> registerForNotify(): %s", toString().c_str()); + ESP_LOGV(LOG_TAG, ">> registerForNotify(): %s", toString().c_str()); m_notifyCallback = notifyCallback; // Save the notification callback. @@ -481,7 +481,7 @@ void BLERemoteCharacteristic::registerForNotify(notify_callback notifyCallback, m_semaphoreRegForNotifyEvt.wait("registerForNotify"); - ESP_LOGD(LOG_TAG, "<< registerForNotify()"); + ESP_LOGV(LOG_TAG, "<< registerForNotify()"); } // registerForNotify @@ -547,7 +547,7 @@ void BLERemoteCharacteristic::writeValue(uint8_t newValue, bool response) { */ void BLERemoteCharacteristic::writeValue(uint8_t* data, size_t length, bool response) { // writeValue(std::string((char*)data, length), response); - ESP_LOGD(LOG_TAG, ">> writeValue(), length: %d", length); + ESP_LOGV(LOG_TAG, ">> writeValue(), length: %d", length); // Check to see that we are connected. if (!getRemoteService()->getClient()->isConnected()) { @@ -574,7 +574,7 @@ void BLERemoteCharacteristic::writeValue(uint8_t* data, size_t length, bool resp m_semaphoreWriteCharEvt.wait("writeValue"); - ESP_LOGD(LOG_TAG, "<< writeValue"); + ESP_LOGV(LOG_TAG, "<< writeValue"); } // writeValue /** diff --git a/libraries/BLE/src/BLERemoteDescriptor.cpp b/libraries/BLE/src/BLERemoteDescriptor.cpp index 96a8a5779a2..111c9de7438 100644 --- a/libraries/BLE/src/BLERemoteDescriptor.cpp +++ b/libraries/BLE/src/BLERemoteDescriptor.cpp @@ -59,7 +59,7 @@ BLEUUID BLERemoteDescriptor::getUUID() { std::string BLERemoteDescriptor::readValue() { - ESP_LOGD(LOG_TAG, ">> readValue: %s", toString().c_str()); + ESP_LOGV(LOG_TAG, ">> readValue: %s", toString().c_str()); // Check to see that we are connected. if (!getRemoteCharacteristic()->getRemoteService()->getClient()->isConnected()) { @@ -85,7 +85,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()); + ESP_LOGV(LOG_TAG, "<< readValue(): length: %d", m_value.length()); return m_value; } // readValue @@ -135,7 +135,7 @@ 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()); + ESP_LOGV(LOG_TAG, ">> writeValue: %s", toString().c_str()); // Check to see that we are connected. if (!getRemoteCharacteristic()->getRemoteService()->getClient()->isConnected()) { ESP_LOGE(LOG_TAG, "Disconnected"); @@ -154,7 +154,7 @@ void BLERemoteDescriptor::writeValue(uint8_t* data, size_t length, bool response if (errRc != ESP_OK) { ESP_LOGE(LOG_TAG, "esp_ble_gattc_write_char_descr: %d", errRc); } - ESP_LOGD(LOG_TAG, "<< writeValue"); + ESP_LOGV(LOG_TAG, "<< writeValue"); } // writeValue diff --git a/libraries/BLE/src/BLERemoteService.cpp b/libraries/BLE/src/BLERemoteService.cpp index c2b7d344fd9..a5b88727305 100644 --- a/libraries/BLE/src/BLERemoteService.cpp +++ b/libraries/BLE/src/BLERemoteService.cpp @@ -29,7 +29,7 @@ BLERemoteService::BLERemoteService( uint16_t endHandle ) { - ESP_LOGD(LOG_TAG, ">> BLERemoteService()"); + ESP_LOGV(LOG_TAG, ">> BLERemoteService()"); m_srvcId = srvcId; m_pClient = pClient; m_uuid = BLEUUID(m_srvcId); @@ -37,7 +37,7 @@ BLERemoteService::BLERemoteService( m_startHandle = startHandle; m_endHandle = endHandle; - ESP_LOGD(LOG_TAG, "<< BLERemoteService()"); + ESP_LOGV(LOG_TAG, "<< BLERemoteService()"); } @@ -165,7 +165,7 @@ BLERemoteCharacteristic* BLERemoteService::getCharacteristic(BLEUUID uuid) { * @return N/A */ void BLERemoteService::retrieveCharacteristics() { - ESP_LOGD(LOG_TAG, ">> getCharacteristics() for service: %s", getUUID().toString().c_str()); + ESP_LOGV(LOG_TAG, ">> getCharacteristics() for service: %s", getUUID().toString().c_str()); removeCharacteristics(); // Forget any previous characteristics. @@ -212,7 +212,7 @@ void BLERemoteService::retrieveCharacteristics() { } // Loop forever (until we break inside the loop). m_haveCharacteristics = true; // Remember that we have received the characteristics. - ESP_LOGD(LOG_TAG, "<< getCharacteristics()"); + ESP_LOGV(LOG_TAG, "<< getCharacteristics()"); } // getCharacteristics @@ -221,14 +221,14 @@ void BLERemoteService::retrieveCharacteristics() { * @return A map of all the characteristics of this service. */ std::map* BLERemoteService::getCharacteristics() { - ESP_LOGD(LOG_TAG, ">> getCharacteristics() for service: %s", getUUID().toString().c_str()); + ESP_LOGV(LOG_TAG, ">> getCharacteristics() for service: %s", getUUID().toString().c_str()); // If is possible that we have not read the characteristics associated with the service so do that // now. The request to retrieve the characteristics by calling "retrieveCharacteristics" is a blocking // call and does not return until all the characteristics are available. if (!m_haveCharacteristics) { retrieveCharacteristics(); } - ESP_LOGD(LOG_TAG, "<< getCharacteristics() for service: %s", getUUID().toString().c_str()); + ESP_LOGV(LOG_TAG, "<< getCharacteristics() for service: %s", getUUID().toString().c_str()); return &m_characteristicMap; } // getCharacteristics @@ -265,8 +265,8 @@ uint16_t BLERemoteService::getStartHandle() { uint16_t BLERemoteService::getHandle() { - ESP_LOGD(LOG_TAG, ">> getHandle: service: %s", getUUID().toString().c_str()); - ESP_LOGD(LOG_TAG, "<< getHandle: %d 0x%.2x", getStartHandle(), getStartHandle()); + ESP_LOGV(LOG_TAG, ">> getHandle: service: %s", getUUID().toString().c_str()); + ESP_LOGV(LOG_TAG, "<< getHandle: %d 0x%.2x", getStartHandle(), getStartHandle()); return getStartHandle(); } // getHandle @@ -279,9 +279,9 @@ BLEUUID BLERemoteService::getUUID() { * @brief Read the value of a characteristic associated with this service. */ std::string BLERemoteService::getValue(BLEUUID characteristicUuid) { - ESP_LOGD(LOG_TAG, ">> readValue: uuid: %s", characteristicUuid.toString().c_str()); + ESP_LOGV(LOG_TAG, ">> readValue: uuid: %s", characteristicUuid.toString().c_str()); std::string ret = getCharacteristic(characteristicUuid)->readValue(); - ESP_LOGD(LOG_TAG, "<< readValue"); + ESP_LOGV(LOG_TAG, "<< readValue"); return ret; } // readValue @@ -314,9 +314,9 @@ void BLERemoteService::removeCharacteristics() { * @throws BLEUuidNotFound */ void BLERemoteService::setValue(BLEUUID characteristicUuid, std::string value) { - ESP_LOGD(LOG_TAG, ">> setValue: uuid: %s", characteristicUuid.toString().c_str()); + ESP_LOGV(LOG_TAG, ">> setValue: uuid: %s", characteristicUuid.toString().c_str()); getCharacteristic(characteristicUuid)->writeValue(value); - ESP_LOGD(LOG_TAG, "<< setValue"); + ESP_LOGV(LOG_TAG, "<< setValue"); } // setValue diff --git a/libraries/BLE/src/BLEScan.cpp b/libraries/BLE/src/BLEScan.cpp index d851a47a123..4bb50218690 100644 --- a/libraries/BLE/src/BLEScan.cpp +++ b/libraries/BLE/src/BLEScan.cpp @@ -201,7 +201,7 @@ void BLEScan::setWindow(uint16_t windowMSecs) { * @return True if scan started or false if there was an error. */ bool BLEScan::start(uint32_t duration, void (*scanCompleteCB)(BLEScanResults), bool is_continue) { - ESP_LOGD(LOG_TAG, ">> start(duration=%d)", duration); + ESP_LOGV(LOG_TAG, ">> start(duration=%d)", duration); m_semaphoreScanEnd.take(std::string("start")); m_scanCompleteCB = scanCompleteCB; // Save the callback to be invoked when the scan completes. @@ -233,7 +233,7 @@ bool BLEScan::start(uint32_t duration, void (*scanCompleteCB)(BLEScanResults), b m_stopped = false; - ESP_LOGD(LOG_TAG, "<< start()"); + ESP_LOGV(LOG_TAG, "<< start()"); return true; } // start @@ -256,7 +256,7 @@ BLEScanResults BLEScan::start(uint32_t duration, bool is_continue) { * @return N/A. */ void BLEScan::stop() { - ESP_LOGD(LOG_TAG, ">> stop()"); + ESP_LOGV(LOG_TAG, ">> stop()"); esp_err_t errRc = ::esp_ble_gap_stop_scanning(); @@ -268,7 +268,7 @@ void BLEScan::stop() { return; } - ESP_LOGD(LOG_TAG, "<< stop()"); + ESP_LOGV(LOG_TAG, "<< stop()"); } // stop // delete peer device from cache after disconnecting, it is required in case we are connecting to devices with not public address @@ -284,7 +284,7 @@ void BLEScan::erase(BLEAddress address) { * @brief Dump the scan results to the log. */ void BLEScanResults::dump() { - ESP_LOGD(LOG_TAG, ">> Dump scan results:"); + ESP_LOGV(LOG_TAG, ">> Dump scan results:"); for (int i=0; i> createService - %s", uuid.toString().c_str()); + ESP_LOGV(LOG_TAG, ">> createService - %s", uuid.toString().c_str()); m_semaphoreCreateEvt.take("createService"); // Check that a service with the supplied UUID does not already exist. @@ -89,7 +89,7 @@ BLEService* BLEServer::createService(BLEUUID uuid, uint32_t numHandles, uint8_t m_semaphoreCreateEvt.wait("createService"); - ESP_LOGD(LOG_TAG, "<< createService"); + ESP_LOGV(LOG_TAG, "<< createService"); return pService; } // createService @@ -149,7 +149,7 @@ uint16_t BLEServer::getGattsIf() { * */ void BLEServer::handleGATTServerEvent(esp_gatts_cb_event_t event, esp_gatt_if_t gatts_if, esp_ble_gatts_cb_param_t* param) { - ESP_LOGD(LOG_TAG, ">> handleGATTServerEvent: %s", + ESP_LOGV(LOG_TAG, ">> handleGATTServerEvent: %s", BLEUtils::gattServerEventTypeToString(event).c_str()); switch(event) { @@ -277,7 +277,7 @@ void BLEServer::handleGATTServerEvent(esp_gatts_cb_event_t event, esp_gatt_if_t // Invoke the handler for every Service we have. m_serviceMap.handleGATTServerEvent(event, gatts_if, param); - ESP_LOGD(LOG_TAG, "<< handleGATTServerEvent"); + ESP_LOGV(LOG_TAG, "<< handleGATTServerEvent"); } // handleGATTServerEvent @@ -287,11 +287,11 @@ void BLEServer::handleGATTServerEvent(esp_gatts_cb_event_t event, esp_gatt_if_t * @return N/A */ void BLEServer::registerApp(uint16_t m_appId) { - ESP_LOGD(LOG_TAG, ">> registerApp - %d", m_appId); + ESP_LOGV(LOG_TAG, ">> registerApp - %d", m_appId); m_semaphoreRegisterAppEvt.take("registerApp"); // Take the mutex, will be released by ESP_GATTS_REG_EVT event. ::esp_ble_gatts_app_register(m_appId); m_semaphoreRegisterAppEvt.wait("registerApp"); - ESP_LOGD(LOG_TAG, "<< registerApp"); + ESP_LOGV(LOG_TAG, "<< registerApp"); } // registerApp @@ -324,9 +324,9 @@ void BLEServer::removeService(BLEService* service) { * retrieving the advertising object and invoking start upon it. */ void BLEServer::startAdvertising() { - ESP_LOGD(LOG_TAG, ">> startAdvertising"); + ESP_LOGV(LOG_TAG, ">> startAdvertising"); BLEDevice::startAdvertising(); - ESP_LOGD(LOG_TAG, "<< startAdvertising"); + ESP_LOGV(LOG_TAG, "<< startAdvertising"); } // startAdvertising /** @@ -349,7 +349,7 @@ bool BLEServer::connect(BLEAddress address) { } uint32_t rc = m_semaphoreOpenEvt.wait("connect"); // Wait for the connection to complete. - ESP_LOGD(LOG_TAG, "<< connect(), rc=%d", rc==ESP_GATT_OK); + ESP_LOGV(LOG_TAG, "<< connect(), rc=%d", rc==ESP_GATT_OK); return rc == ESP_GATT_OK; } // connect diff --git a/libraries/BLE/src/BLEService.cpp b/libraries/BLE/src/BLEService.cpp index 3034cf18c70..71b71932f20 100644 --- a/libraries/BLE/src/BLEService.cpp +++ b/libraries/BLE/src/BLEService.cpp @@ -64,7 +64,7 @@ BLEService::BLEService(BLEUUID uuid, uint16_t numHandles) { */ void BLEService::executeCreate(BLEServer* pServer) { - ESP_LOGD(LOG_TAG, ">> executeCreate() - Creating service (esp_ble_gatts_create_service) service uuid: %s", getUUID().toString().c_str()); + ESP_LOGV(LOG_TAG, ">> executeCreate() - Creating service (esp_ble_gatts_create_service) service uuid: %s", getUUID().toString().c_str()); m_pServer = pServer; m_semaphoreCreateEvt.take("executeCreate"); // Take the mutex and release at event ESP_GATTS_CREATE_EVT @@ -80,7 +80,7 @@ void BLEService::executeCreate(BLEServer* pServer) { } m_semaphoreCreateEvt.wait("executeCreate"); - ESP_LOGD(LOG_TAG, "<< executeCreate"); + ESP_LOGV(LOG_TAG, "<< executeCreate"); } // executeCreate @@ -91,7 +91,7 @@ void BLEService::executeCreate(BLEServer* pServer) { */ void BLEService::executeDelete() { - ESP_LOGD(LOG_TAG, ">> executeDelete()"); + ESP_LOGV(LOG_TAG, ">> executeDelete()"); m_semaphoreDeleteEvt.take("executeDelete"); // Take the mutex and release at event ESP_GATTS_DELETE_EVT esp_err_t errRc = ::esp_ble_gatts_delete_service(getHandle()); @@ -102,7 +102,7 @@ void BLEService::executeDelete() { } m_semaphoreDeleteEvt.wait("executeDelete"); - ESP_LOGD(LOG_TAG, "<< executeDelete"); + ESP_LOGV(LOG_TAG, "<< executeDelete"); } // executeDelete @@ -138,7 +138,7 @@ void BLEService::start() { // We start the service through its local handle which was returned in the ESP_GATTS_CREATE_EVT event // obtained as a result of calling esp_ble_gatts_create_service(). // - ESP_LOGD(LOG_TAG, ">> start(): Starting service (esp_ble_gatts_start_service): %s", toString().c_str()); + ESP_LOGV(LOG_TAG, ">> start(): Starting service (esp_ble_gatts_start_service): %s", toString().c_str()); if (m_handle == NULL_HANDLE) { ESP_LOGE(LOG_TAG, "<< !!! We attempted to start a service but don't know its handle!"); return; @@ -163,7 +163,7 @@ void BLEService::start() { } m_semaphoreStartEvt.wait("start"); - ESP_LOGD(LOG_TAG, "<< start()"); + ESP_LOGV(LOG_TAG, "<< start()"); } // start @@ -174,7 +174,7 @@ void BLEService::stop() { // We ask the BLE runtime to start the service and then create each of the characteristics. // We start the service through its local handle which was returned in the ESP_GATTS_CREATE_EVT event // obtained as a result of calling esp_ble_gatts_create_service(). - ESP_LOGD(LOG_TAG, ">> stop(): Stopping service (esp_ble_gatts_stop_service): %s", toString().c_str()); + ESP_LOGV(LOG_TAG, ">> stop(): Stopping service (esp_ble_gatts_stop_service): %s", toString().c_str()); if (m_handle == NULL_HANDLE) { ESP_LOGE(LOG_TAG, "<< !!! We attempted to stop a service but don't know its handle!"); return; @@ -189,7 +189,7 @@ void BLEService::stop() { } m_semaphoreStopEvt.wait("stop"); - ESP_LOGD(LOG_TAG, "<< stop()"); + ESP_LOGV(LOG_TAG, "<< stop()"); } // start @@ -198,13 +198,13 @@ void BLEService::stop() { * @param [in] handle The handle associated with the service. */ void BLEService::setHandle(uint16_t handle) { - ESP_LOGD(LOG_TAG, ">> setHandle - Handle=0x%.2x, service UUID=%s)", handle, getUUID().toString().c_str()); + ESP_LOGV(LOG_TAG, ">> setHandle - Handle=0x%.2x, service UUID=%s)", handle, getUUID().toString().c_str()); if (m_handle != NULL_HANDLE) { ESP_LOGE(LOG_TAG, "!!! Handle is already set %.2x", m_handle); return; } m_handle = handle; - ESP_LOGD(LOG_TAG, "<< setHandle"); + ESP_LOGV(LOG_TAG, "<< setHandle"); } // setHandle @@ -226,7 +226,7 @@ void BLEService::addCharacteristic(BLECharacteristic* pCharacteristic) { // BLECharacteristicMap class instance found in m_characteristicMap. We add the characteristic // to the map and then ask the service to add the characteristic at the BLE level (ESP-IDF). - ESP_LOGD(LOG_TAG, ">> addCharacteristic()"); + ESP_LOGV(LOG_TAG, ">> addCharacteristic()"); ESP_LOGD(LOG_TAG, "Adding characteristic: uuid=%s to service: %s", pCharacteristic->getUUID().toString().c_str(), toString().c_str()); @@ -241,7 +241,7 @@ void BLEService::addCharacteristic(BLECharacteristic* pCharacteristic) { // but not by handle. The handle is allocated to us on the ESP_GATTS_ADD_CHAR_EVT. m_characteristicMap.setByUUID(pCharacteristic, pCharacteristic->getUUID()); - ESP_LOGD(LOG_TAG, "<< addCharacteristic()"); + ESP_LOGV(LOG_TAG, "<< addCharacteristic()"); } // addCharacteristic diff --git a/libraries/BLE/src/BLEUUID.cpp b/libraries/BLE/src/BLEUUID.cpp index 4ddf8fc27a0..e43acce5f90 100644 --- a/libraries/BLE/src/BLEUUID.cpp +++ b/libraries/BLE/src/BLEUUID.cpp @@ -281,7 +281,7 @@ BLEUUID BLEUUID::fromString(std::string _uuid) { esp_bt_uuid_t* BLEUUID::getNative() { //ESP_LOGD(TAG, ">> getNative()") if (m_valueSet == false) { - ESP_LOGD(LOG_TAG, "<< Return of un-initialized UUID!"); + ESP_LOGV(LOG_TAG, "<< Return of un-initialized UUID!"); return nullptr; } //ESP_LOGD(TAG, "<< getNative()"); @@ -296,7 +296,7 @@ esp_bt_uuid_t* BLEUUID::getNative() { * will convert 16 or 32 bit representations to the full 128bit. */ BLEUUID BLEUUID::to128() { - //ESP_LOGD(LOG_TAG, ">> toFull() - %s", toString().c_str()); + //ESP_LOGV(LOG_TAG, ">> toFull() - %s", toString().c_str()); // If we either don't have a value or are already a 128 bit UUID, nothing further to do. if (!m_valueSet || m_uuid.len == ESP_UUID_LEN_128) { diff --git a/libraries/BLE/src/BLEValue.cpp b/libraries/BLE/src/BLEValue.cpp index ec1e61f51fc..c1d7ad569c8 100644 --- a/libraries/BLE/src/BLEValue.cpp +++ b/libraries/BLE/src/BLEValue.cpp @@ -31,7 +31,7 @@ BLEValue::BLEValue() { * @param [in] part A message part being added. */ void BLEValue::addPart(std::string part) { - ESP_LOGD(LOG_TAG, ">> addPart: length=%d", part.length()); + ESP_LOGV(LOG_TAG, ">> addPart: length=%d", part.length()); m_accumulation += part; } // addPart @@ -43,7 +43,7 @@ void BLEValue::addPart(std::string part) { * @param [in] length The number of bytes being added. */ void BLEValue::addPart(uint8_t* pData, size_t length) { - ESP_LOGD(LOG_TAG, ">> addPart: length=%d", length); + ESP_LOGV(LOG_TAG, ">> addPart: length=%d", length); m_accumulation += std::string((char*) pData, length); } // addPart @@ -52,7 +52,7 @@ void BLEValue::addPart(uint8_t* pData, size_t length) { * @brief Cancel the current accumulation. */ void BLEValue::cancel() { - ESP_LOGD(LOG_TAG, ">> cancel"); + ESP_LOGV(LOG_TAG, ">> cancel"); m_accumulation = ""; m_readOffset = 0; } // cancel @@ -65,7 +65,7 @@ void BLEValue::cancel() { * we now have the complete message and commit the change as a unit. */ void BLEValue::commit() { - ESP_LOGD(LOG_TAG, ">> commit"); + ESP_LOGV(LOG_TAG, ">> commit"); // If there is nothing to commit, do nothing. if (m_accumulation.length() == 0) return; setValue(m_accumulation);