From ccea428b9e23603d1a7d3e655e664788bc9d4982 Mon Sep 17 00:00:00 2001 From: h2zero Date: Mon, 6 Sep 2021 21:14:43 -0600 Subject: [PATCH] Refactor include directives to use different paths for arduino/idf. * Sets macros to allow compiling when Central role is enabled and Observer disabled, or Peripheral enabled and Broadcaster disabled. * Adds a macro definition for CONFIG_NIMBLE_CPP_IDF to enable different include paths/functionality for IDF / Arduino. --- src/NimBLE2904.cpp | 8 +-- src/NimBLE2904.h | 8 +-- src/NimBLEAddress.cpp | 2 +- src/NimBLEAddress.h | 7 ++- src/NimBLEAdvertisedDevice.h | 12 ++-- src/NimBLEAdvertising.cpp | 12 ++-- src/NimBLEAdvertising.h | 13 +++-- src/NimBLEBeacon.cpp | 2 +- src/NimBLECharacteristic.cpp | 8 +-- src/NimBLECharacteristic.h | 13 +++-- src/NimBLEClient.cpp | 13 ++--- src/NimBLEClient.h | 8 +-- src/NimBLEDescriptor.cpp | 7 +-- src/NimBLEDescriptor.h | 7 +-- src/NimBLEDevice.cpp | 16 +++++- src/NimBLEDevice.h | 3 +- src/NimBLEEddystoneTLM.cpp | 4 +- src/NimBLEEddystoneTLM.h | 1 + src/NimBLEEddystoneURL.cpp | 2 +- src/NimBLEHIDDevice.cpp | 7 +-- src/NimBLEHIDDevice.h | 9 +-- src/NimBLELog.h | 92 ++++++++++++++++-------------- src/NimBLERemoteCharacteristic.cpp | 9 +-- src/NimBLERemoteCharacteristic.h | 7 +-- src/NimBLERemoteDescriptor.cpp | 7 +-- src/NimBLERemoteDescriptor.h | 7 +-- src/NimBLERemoteService.cpp | 8 +-- src/NimBLERemoteService.h | 7 +-- src/NimBLEScan.cpp | 7 +-- src/NimBLEScan.h | 11 ++-- src/NimBLESecurity.cpp | 2 +- src/NimBLESecurity.h | 8 ++- src/NimBLEServer.cpp | 15 +++-- src/NimBLEServer.h | 8 +-- src/NimBLEService.cpp | 8 +-- src/NimBLEService.h | 8 +-- src/NimBLEUUID.cpp | 3 +- src/NimBLEUUID.h | 8 ++- src/NimBLEUtils.cpp | 2 +- src/NimBLEUtils.h | 7 ++- src/nimconfig.h | 22 ++++++- 41 files changed, 203 insertions(+), 205 deletions(-) diff --git a/src/NimBLE2904.cpp b/src/NimBLE2904.cpp index 80318b5..282eff5 100644 --- a/src/NimBLE2904.cpp +++ b/src/NimBLE2904.cpp @@ -16,11 +16,8 @@ * See also: * https://www.bluetooth.com/specifications/gatt/viewer?attributeXmlFile=org.bluetooth.descriptor.gatt.characteristic_presentation_format.xml */ -#include "sdkconfig.h" -#if defined(CONFIG_BT_ENABLED) - #include "nimconfig.h" -#if defined(CONFIG_BT_NIMBLE_ROLE_PERIPHERAL) +#if defined(CONFIG_BT_ENABLED) && defined(CONFIG_BT_NIMBLE_ROLE_PERIPHERAL) #include "NimBLE2904.h" @@ -86,5 +83,4 @@ void NimBLE2904::setUnit(uint16_t unit) { setValue((uint8_t*) &m_data, sizeof(m_data)); } // setUnit -#endif // #if defined(CONFIG_BT_NIMBLE_ROLE_PERIPHERAL) -#endif +#endif /* CONFIG_BT_ENABLED && CONFIG_BT_NIMBLE_ROLE_PERIPHERAL */ diff --git a/src/NimBLE2904.h b/src/NimBLE2904.h index d8800dd..29dde51 100644 --- a/src/NimBLE2904.h +++ b/src/NimBLE2904.h @@ -14,11 +14,8 @@ #ifndef MAIN_NIMBLE2904_H_ #define MAIN_NIMBLE2904_H_ -#include "sdkconfig.h" -#if defined(CONFIG_BT_ENABLED) - #include "nimconfig.h" -#if defined(CONFIG_BT_NIMBLE_ROLE_PERIPHERAL) +#if defined(CONFIG_BT_ENABLED) && defined(CONFIG_BT_NIMBLE_ROLE_PERIPHERAL) #include "NimBLEDescriptor.h" @@ -82,6 +79,5 @@ private: BLE2904_Data m_data; }; // BLE2904 -#endif // #if defined(CONFIG_BT_NIMBLE_ROLE_PERIPHERAL) -#endif /* CONFIG_BT_ENABLED */ +#endif /* CONFIG_BT_ENABLED && CONFIG_BT_NIMBLE_ROLE_PERIPHERAL */ #endif /* MAIN_NIMBLE2904_H_ */ diff --git a/src/NimBLEAddress.cpp b/src/NimBLEAddress.cpp index e1d3e54..b8df5ac 100644 --- a/src/NimBLEAddress.cpp +++ b/src/NimBLEAddress.cpp @@ -11,7 +11,7 @@ * Created on: Jul 2, 2017 * Author: kolban */ -#include "sdkconfig.h" +#include "nimconfig.h" #if defined(CONFIG_BT_ENABLED) #include diff --git a/src/NimBLEAddress.h b/src/NimBLEAddress.h index 50f9231..a6e10a0 100644 --- a/src/NimBLEAddress.h +++ b/src/NimBLEAddress.h @@ -14,10 +14,15 @@ #ifndef COMPONENTS_NIMBLEADDRESS_H_ #define COMPONENTS_NIMBLEADDRESS_H_ -#include "sdkconfig.h" +#include "nimconfig.h" #if defined(CONFIG_BT_ENABLED) +#if defined(CONFIG_NIMBLE_CPP_IDF) #include "nimble/ble.h" +#else +#include "nimble/nimble/include/nimble/ble.h" +#endif + /**** FIX COMPILATION ****/ #undef min #undef max diff --git a/src/NimBLEAdvertisedDevice.h b/src/NimBLEAdvertisedDevice.h index 7d378ed..b00aae9 100644 --- a/src/NimBLEAdvertisedDevice.h +++ b/src/NimBLEAdvertisedDevice.h @@ -14,17 +14,18 @@ #ifndef COMPONENTS_NIMBLEADVERTISEDDEVICE_H_ #define COMPONENTS_NIMBLEADVERTISEDDEVICE_H_ -#include "sdkconfig.h" -#if defined(CONFIG_BT_ENABLED) - #include "nimconfig.h" -#if defined(CONFIG_BT_NIMBLE_ROLE_OBSERVER) +#if defined(CONFIG_BT_ENABLED) && defined(CONFIG_BT_NIMBLE_ROLE_OBSERVER) #include "NimBLEAddress.h" #include "NimBLEScan.h" #include "NimBLEUUID.h" +#if defined(CONFIG_NIMBLE_CPP_IDF) #include "host/ble_hs_adv.h" +#else +#include "nimble/nimble/host/include/host/ble_hs_adv.h" +#endif #include #include @@ -171,6 +172,5 @@ public: virtual void onResult(NimBLEAdvertisedDevice* advertisedDevice) = 0; }; -#endif // #if defined( CONFIG_BT_NIMBLE_ROLE_CENTRAL) -#endif /* CONFIG_BT_ENABLED */ +#endif /* CONFIG_BT_ENABLED && CONFIG_BT_NIMBLE_ROLE_OBSERVER */ #endif /* COMPONENTS_NIMBLEADVERTISEDDEVICE_H_ */ diff --git a/src/NimBLEAdvertising.cpp b/src/NimBLEAdvertising.cpp index 3112eff..6457dd8 100644 --- a/src/NimBLEAdvertising.cpp +++ b/src/NimBLEAdvertising.cpp @@ -13,13 +13,14 @@ * Author: kolban * */ -#include "sdkconfig.h" -#if defined(CONFIG_BT_ENABLED) - #include "nimconfig.h" -#if defined(CONFIG_BT_NIMBLE_ROLE_BROADCASTER) +#if defined(CONFIG_BT_ENABLED) && defined(CONFIG_BT_NIMBLE_ROLE_BROADCASTER) +#if defined(CONFIG_NIMBLE_CPP_IDF) #include "services/gap/ble_svc_gap.h" +#else +#include "nimble/nimble/host/services/gap/include/services/gap/ble_svc_gap.h" +#endif #include "NimBLEAdvertising.h" #include "NimBLEDevice.h" #include "NimBLEServer.h" @@ -1028,5 +1029,4 @@ std::string NimBLEAdvertisementData::getPayload() { return m_payload; } // getPayload -#endif // #if defined(CONFIG_BT_NIMBLE_ROLE_PERIPHERAL) -#endif /* CONFIG_BT_ENABLED */ +#endif /* CONFIG_BT_ENABLED && CONFIG_BT_NIMBLE_ROLE_BROADCASTER */ diff --git a/src/NimBLEAdvertising.h b/src/NimBLEAdvertising.h index 17a8665..63a21d8 100644 --- a/src/NimBLEAdvertising.h +++ b/src/NimBLEAdvertising.h @@ -14,13 +14,15 @@ #ifndef MAIN_BLEADVERTISING_H_ #define MAIN_BLEADVERTISING_H_ -#include "sdkconfig.h" -#if defined(CONFIG_BT_ENABLED) - #include "nimconfig.h" -#if defined(CONFIG_BT_NIMBLE_ROLE_BROADCASTER) +#if defined(CONFIG_BT_ENABLED) && defined(CONFIG_BT_NIMBLE_ROLE_BROADCASTER) +#if defined(CONFIG_NIMBLE_CPP_IDF) #include "host/ble_gap.h" +#else +#include "nimble/nimble/host/include/host/ble_gap.h" +#endif + /**** FIX COMPILATION ****/ #undef min #undef max @@ -132,6 +134,5 @@ private: std::vector m_uri; }; -#endif // #if defined(CONFIG_BT_NIMBLE_ROLE_PERIPHERAL) -#endif /* CONFIG_BT_ENABLED */ +#endif /* CONFIG_BT_ENABLED && CONFIG_BT_NIMBLE_ROLE_BROADCASTER */ #endif /* MAIN_BLEADVERTISING_H_ */ diff --git a/src/NimBLEBeacon.cpp b/src/NimBLEBeacon.cpp index 8c4574b..996893a 100644 --- a/src/NimBLEBeacon.cpp +++ b/src/NimBLEBeacon.cpp @@ -11,7 +11,7 @@ * Created on: Jan 4, 2018 * Author: kolban */ -#include "sdkconfig.h" +#include "nimconfig.h" #if defined(CONFIG_BT_ENABLED) #include diff --git a/src/NimBLECharacteristic.cpp b/src/NimBLECharacteristic.cpp index f3965a4..5645a5e 100644 --- a/src/NimBLECharacteristic.cpp +++ b/src/NimBLECharacteristic.cpp @@ -9,11 +9,9 @@ * Created on: Jun 22, 2017 * Author: kolban */ -#include "sdkconfig.h" -#if defined(CONFIG_BT_ENABLED) #include "nimconfig.h" -#if defined(CONFIG_BT_NIMBLE_ROLE_PERIPHERAL) +#if defined(CONFIG_BT_ENABLED) && defined(CONFIG_BT_NIMBLE_ROLE_PERIPHERAL) #include "NimBLECharacteristic.h" #include "NimBLE2904.h" @@ -641,6 +639,4 @@ void NimBLECharacteristicCallbacks::onSubscribe(NimBLECharacteristic* pCharacter NIMBLE_LOGD("NimBLECharacteristicCallbacks", "onSubscribe: default"); } - -#endif // #if defined(CONFIG_BT_NIMBLE_ROLE_PERIPHERAL) -#endif /* CONFIG_BT_ENABLED */ +#endif /* CONFIG_BT_ENABLED && CONFIG_BT_NIMBLE_ROLE_PERIPHERAL */ diff --git a/src/NimBLECharacteristic.h b/src/NimBLECharacteristic.h index 6008d12..33528e3 100644 --- a/src/NimBLECharacteristic.h +++ b/src/NimBLECharacteristic.h @@ -13,13 +13,15 @@ #ifndef MAIN_NIMBLECHARACTERISTIC_H_ #define MAIN_NIMBLECHARACTERISTIC_H_ -#include "sdkconfig.h" -#if defined(CONFIG_BT_ENABLED) - #include "nimconfig.h" -#if defined(CONFIG_BT_NIMBLE_ROLE_PERIPHERAL) +#if defined(CONFIG_BT_ENABLED) && defined(CONFIG_BT_NIMBLE_ROLE_PERIPHERAL) +#if defined(CONFIG_NIMBLE_CPP_IDF) #include "host/ble_hs.h" +#else +#include "nimble/nimble/host/include/host/ble_hs.h" +#endif + /**** FIX COMPILATION ****/ #undef min #undef max @@ -195,6 +197,5 @@ public: virtual void onSubscribe(NimBLECharacteristic* pCharacteristic, ble_gap_conn_desc* desc, uint16_t subValue); }; -#endif // #if defined(CONFIG_BT_NIMBLE_ROLE_PERIPHERAL) -#endif /* CONFIG_BT_ENABLED */ +#endif /* CONFIG_BT_ENABLED && CONFIG_BT_NIMBLE_ROLE_PERIPHERAL */ #endif /*MAIN_NIMBLECHARACTERISTIC_H_*/ diff --git a/src/NimBLEClient.cpp b/src/NimBLEClient.cpp index a171b8c..5ea756c 100644 --- a/src/NimBLEClient.cpp +++ b/src/NimBLEClient.cpp @@ -11,11 +11,8 @@ * Author: kolban */ -#include "sdkconfig.h" -#if defined(CONFIG_BT_ENABLED) - #include "nimconfig.h" -#if defined( CONFIG_BT_NIMBLE_ROLE_CENTRAL) +#if defined(CONFIG_BT_ENABLED) && defined(CONFIG_BT_NIMBLE_ROLE_CENTRAL) #include "NimBLEClient.h" #include "NimBLEDevice.h" @@ -24,8 +21,11 @@ #include #include +#if defined(CONFIG_NIMBLE_CPP_IDF) #include "nimble/nimble_port.h" - +#else +#include "nimble/porting/nimble/include/nimble/nimble_port.h" +#endif static const char* LOG_TAG = "NimBLEClient"; static NimBLEClientCallbacks defaultCallbacks; @@ -1170,5 +1170,4 @@ bool NimBLEClientCallbacks::onConfirmPIN(uint32_t pin){ return true; } -#endif // #if defined( CONFIG_BT_NIMBLE_ROLE_CENTRAL) -#endif // CONFIG_BT_ENABLED +#endif /* CONFIG_BT_ENABLED && CONFIG_BT_NIMBLE_ROLE_CENTRAL */ diff --git a/src/NimBLEClient.h b/src/NimBLEClient.h index d90086c..7c73ab3 100644 --- a/src/NimBLEClient.h +++ b/src/NimBLEClient.h @@ -14,11 +14,8 @@ #ifndef MAIN_NIMBLECLIENT_H_ #define MAIN_NIMBLECLIENT_H_ -#include "sdkconfig.h" -#if defined(CONFIG_BT_ENABLED) - #include "nimconfig.h" -#if defined(CONFIG_BT_NIMBLE_ROLE_CENTRAL) +#if defined(CONFIG_BT_ENABLED) && defined(CONFIG_BT_NIMBLE_ROLE_CENTRAL) #include "NimBLEAddress.h" #include "NimBLEUUID.h" @@ -158,6 +155,5 @@ public: virtual bool onConfirmPIN(uint32_t pin); }; -#endif // #if defined(CONFIG_BT_NIMBLE_ROLE_CENTRAL) -#endif // CONFIG_BT_ENABLED +#endif /* CONFIG_BT_ENABLED && CONFIG_BT_NIMBLE_ROLE_CENTRAL */ #endif /* MAIN_NIMBLECLIENT_H_ */ diff --git a/src/NimBLEDescriptor.cpp b/src/NimBLEDescriptor.cpp index f946766..c57c80d 100644 --- a/src/NimBLEDescriptor.cpp +++ b/src/NimBLEDescriptor.cpp @@ -11,11 +11,9 @@ * Created on: Jun 22, 2017 * Author: kolban */ -#include "sdkconfig.h" -#if defined(CONFIG_BT_ENABLED) #include "nimconfig.h" -#if defined(CONFIG_BT_NIMBLE_ROLE_PERIPHERAL) +#if defined(CONFIG_BT_ENABLED) && defined(CONFIG_BT_NIMBLE_ROLE_PERIPHERAL) #include "NimBLEService.h" #include "NimBLEDescriptor.h" @@ -289,5 +287,4 @@ void NimBLEDescriptorCallbacks::onWrite(NimBLEDescriptor* pDescriptor) { NIMBLE_LOGD("NimBLEDescriptorCallbacks", "onWrite: default"); } // onWrite -#endif // #if defined(CONFIG_BT_NIMBLE_ROLE_PERIPHERAL) -#endif /* CONFIG_BT_ENABLED */ +#endif /* CONFIG_BT_ENABLED && CONFIG_BT_NIMBLE_ROLE_PERIPHERAL */ diff --git a/src/NimBLEDescriptor.h b/src/NimBLEDescriptor.h index 5dc0ce8..ca4f25b 100644 --- a/src/NimBLEDescriptor.h +++ b/src/NimBLEDescriptor.h @@ -14,11 +14,9 @@ #ifndef MAIN_NIMBLEDESCRIPTOR_H_ #define MAIN_NIMBLEDESCRIPTOR_H_ -#include "sdkconfig.h" -#if defined(CONFIG_BT_ENABLED) #include "nimconfig.h" -#if defined(CONFIG_BT_NIMBLE_ROLE_PERIPHERAL) +#if defined(CONFIG_BT_ENABLED) && defined(CONFIG_BT_NIMBLE_ROLE_PERIPHERAL) #include "NimBLECharacteristic.h" #include "NimBLEUUID.h" @@ -113,6 +111,5 @@ public: #include "NimBLE2904.h" -#endif // #if defined(CONFIG_BT_NIMBLE_ROLE_PERIPHERAL) -#endif /* CONFIG_BT_ENABLED */ +#endif /* CONFIG_BT_ENABLED && CONFIG_BT_NIMBLE_ROLE_PERIPHERAL */ #endif /* MAIN_NIMBLEDESCRIPTOR_H_ */ diff --git a/src/NimBLEDevice.cpp b/src/NimBLEDevice.cpp index bc25365..3e3378d 100644 --- a/src/NimBLEDevice.cpp +++ b/src/NimBLEDevice.cpp @@ -11,16 +11,18 @@ * Created on: Mar 16, 2017 * Author: kolban */ -#include "sdkconfig.h" -#if defined(CONFIG_BT_ENABLED) #include "nimconfig.h" +#if defined(CONFIG_BT_ENABLED) + #include "NimBLEDevice.h" #include "NimBLEUtils.h" #include "esp_err.h" #include "esp_bt.h" #include "nvs_flash.h" + +#if defined(CONFIG_NIMBLE_CPP_IDF) #include "esp_nimble_hci.h" #include "nimble/nimble_port.h" #include "nimble/nimble_port_freertos.h" @@ -29,6 +31,16 @@ #include "host/util/util.h" #include "services/gap/ble_svc_gap.h" #include "services/gatt/ble_svc_gatt.h" +#else +#include "nimble/esp_port/esp-hci/include/esp_nimble_hci.h" +#include "nimble/porting/nimble/include/nimble/nimble_port.h" +#include "nimble/porting/npl/freertos/include/nimble/nimble_port_freertos.h" +#include "nimble/nimble/host/include/host/ble_hs.h" +#include "nimble/nimble/host/include/host/ble_hs_pvcy.h" +#include "nimble/nimble/host/util/include/host/util/util.h" +#include "nimble/nimble/host/services/gap/include/services/gap/ble_svc_gap.h" +#include "nimble/nimble/host/services/gatt/include/services/gatt/ble_svc_gatt.h" +#endif #ifdef CONFIG_ENABLE_ARDUINO_DEPENDS #include "esp32-hal-bt.h" diff --git a/src/NimBLEDevice.h b/src/NimBLEDevice.h index 08a042f..cc3db9a 100644 --- a/src/NimBLEDevice.h +++ b/src/NimBLEDevice.h @@ -14,10 +14,9 @@ #ifndef MAIN_NIMBLEDEVICE_H_ #define MAIN_NIMBLEDEVICE_H_ -#include "sdkconfig.h" -#if defined(CONFIG_BT_ENABLED) #include "nimconfig.h" +#if defined(CONFIG_BT_ENABLED) #if defined(CONFIG_BT_NIMBLE_ROLE_OBSERVER) #include "NimBLEScan.h" diff --git a/src/NimBLEEddystoneTLM.cpp b/src/NimBLEEddystoneTLM.cpp index a072942..0c89930 100644 --- a/src/NimBLEEddystoneTLM.cpp +++ b/src/NimBLEEddystoneTLM.cpp @@ -11,12 +11,14 @@ * Created on: Mar 12, 2018 * Author: pcbreflux */ -#include "sdkconfig.h" + +#include "nimconfig.h" #if defined(CONFIG_BT_ENABLED) #include "NimBLEEddystoneTLM.h" #include "NimBLELog.h" +#include #include #define ENDIAN_CHANGE_U16(x) ((((x)&0xFF00)>>8) + (((x)&0xFF)<<8)) diff --git a/src/NimBLEEddystoneTLM.h b/src/NimBLEEddystoneTLM.h index eb1cb07..265c81b 100644 --- a/src/NimBLEEddystoneTLM.h +++ b/src/NimBLEEddystoneTLM.h @@ -14,6 +14,7 @@ #ifndef _NimBLEEddystoneTLM_H_ #define _NimBLEEddystoneTLM_H_ + #include "NimBLEUUID.h" #include diff --git a/src/NimBLEEddystoneURL.cpp b/src/NimBLEEddystoneURL.cpp index 7c3194c..424df95 100644 --- a/src/NimBLEEddystoneURL.cpp +++ b/src/NimBLEEddystoneURL.cpp @@ -11,7 +11,7 @@ * Created on: Mar 12, 2018 * Author: pcbreflux */ -#include "sdkconfig.h" +#include "nimconfig.h" #if defined(CONFIG_BT_ENABLED) #include "NimBLEEddystoneURL.h" diff --git a/src/NimBLEHIDDevice.cpp b/src/NimBLEHIDDevice.cpp index 37d0f52..394e763 100644 --- a/src/NimBLEHIDDevice.cpp +++ b/src/NimBLEHIDDevice.cpp @@ -11,11 +11,9 @@ * Created on: Jan 03, 2018 * Author: chegewara */ -#include "sdkconfig.h" -#if defined(CONFIG_BT_ENABLED) #include "nimconfig.h" -#if defined(CONFIG_BT_NIMBLE_ROLE_PERIPHERAL) +#if defined(CONFIG_BT_ENABLED) && defined(CONFIG_BT_NIMBLE_ROLE_PERIPHERAL) #include "NimBLEHIDDevice.h" #include "NimBLE2904.h" @@ -247,5 +245,4 @@ NimBLEService* NimBLEHIDDevice::batteryService() { return m_batteryService; } -#endif // #if defined(CONFIG_BT_NIMBLE_ROLE_PERIPHERAL) -#endif // #if defined(CONFIG_BT_ENABLED) +#endif /* CONFIG_BT_ENABLED && CONFIG_BT_NIMBLE_ROLE_PERIPHERAL */ diff --git a/src/NimBLEHIDDevice.h b/src/NimBLEHIDDevice.h index 6ed7c2b..ef2ed73 100644 --- a/src/NimBLEHIDDevice.h +++ b/src/NimBLEHIDDevice.h @@ -15,11 +15,8 @@ #ifndef _BLEHIDDEVICE_H_ #define _BLEHIDDEVICE_H_ -#include "sdkconfig.h" -#if defined(CONFIG_BT_ENABLED) - #include "nimconfig.h" -#if defined(CONFIG_BT_NIMBLE_ROLE_BROADCASTER) +#if defined(CONFIG_BT_ENABLED) && defined(CONFIG_BT_NIMBLE_ROLE_BROADCASTER) #include "NimBLECharacteristic.h" #include "NimBLEService.h" @@ -84,6 +81,6 @@ private: NimBLECharacteristic* m_protocolModeCharacteristic; //0x2a4e NimBLECharacteristic* m_batteryLevelCharacteristic; //0x2a19 }; -#endif // CONFIG_BT_NIMBLE_ROLE_BROADCASTER -#endif // CONFIG_BT_ENABLED + +#endif /* CONFIG_BT_ENABLED && CONFIG_BT_NIMBLE_ROLE_BROADCASTER */ #endif /* _BLEHIDDEVICE_H_ */ diff --git a/src/NimBLELog.h b/src/NimBLELog.h index 8c13146..0cedca9 100644 --- a/src/NimBLELog.h +++ b/src/NimBLELog.h @@ -8,49 +8,11 @@ #ifndef MAIN_NIMBLELOG_H_ #define MAIN_NIMBLELOG_H_ -#include "sdkconfig.h" +#include "nimconfig.h" #if defined(CONFIG_BT_ENABLED) -#ifdef ARDUINO_ARCH_ESP32 -#include "syscfg/syscfg.h" -#include "modlog/modlog.h" - -// If Arduino is being used, strip out the colors and ignore log printing below ui setting. -// Note: because CONFIG_LOG_DEFAULT_LEVEL is set at ERROR in Arduino we must use MODLOG_DFLT(ERROR -// otherwise no messages will be printed above that level. - -#ifndef CORE_DEBUG_LEVEL -#define CORE_DEBUG_LEVEL CONFIG_ARDUHAL_LOG_DEFAULT_LEVEL -#endif - -#if CORE_DEBUG_LEVEL >= 4 -#define NIMBLE_LOGD( tag, format, ... ) MODLOG_DFLT(ERROR, "D %s: "#format"\n",tag,##__VA_ARGS__) -#else -#define NIMBLE_LOGD( tag, format, ... ) (void)tag -#endif - -#if CORE_DEBUG_LEVEL >= 3 -#define NIMBLE_LOGI( tag, format, ... ) MODLOG_DFLT(ERROR, "I %s: "#format"\n",tag,##__VA_ARGS__) -#else -#define NIMBLE_LOGI( tag, format, ... ) (void)tag -#endif - -#if CORE_DEBUG_LEVEL >= 2 -#define NIMBLE_LOGW( tag, format, ... ) MODLOG_DFLT(ERROR, "W %s: "#format"\n",tag,##__VA_ARGS__) -#else -#define NIMBLE_LOGW( tag, format, ... ) (void)tag -#endif - -#if CORE_DEBUG_LEVEL >= 1 -#define NIMBLE_LOGE( tag, format, ... ) MODLOG_DFLT(ERROR, "E %s: "#format"\n",tag,##__VA_ARGS__) -#else -#define NIMBLE_LOGE( tag, format, ... ) (void)tag -#endif - -#define NIMBLE_LOGC( tag, format, ... ) MODLOG_DFLT(CRITICAL, "CRIT %s: "#format"\n",tag,##__VA_ARGS__) - -#else +#if defined(CONFIG_NIMBLE_CPP_IDF) // using esp-idf #include "esp_log.h" @@ -60,7 +22,51 @@ #define NIMBLE_LOGD(tag, format, ...) ESP_LOGD(tag, format, ##__VA_ARGS__) #define NIMBLE_LOGC(tag, format, ...) ESP_LOGE(tag, format, ##__VA_ARGS__) -#endif /*ARDUINO_ARCH_ESP32*/ +#else // using Arduino -#endif /*CONFIG_BT_ENABLED*/ -#endif /*MAIN_NIMBLELOG_H_*/ \ No newline at end of file +#include "nimble/porting/nimble/include/syscfg/syscfg.h" +#include "nimble/console/console.h" + +// If Arduino is being used, strip out the colors and ignore log printing below ui setting. +// Note: because CONFIG_LOG_DEFAULT_LEVEL is set at ERROR in Arduino we must use MODLOG_DFLT(ERROR +// otherwise no messages will be printed above that level. + +#ifndef NIMBLE_CPP_DEBUG_LEVEL + #if defined(ARDUINO_ARCH_ESP32) && defined(CORE_DEBUG_LEVEL) + #define NIMBLE_CPP_DEBUG_LEVEL CORE_DEBUG_LEVEL + #else + #define NIMBLE_CPP_DEBUG_LEVEL 0 + #endif +#endif + +#if NIMBLE_CPP_DEBUG_LEVEL >= 4 +#define NIMBLE_LOGD( tag, format, ... ) console_printf("D %s: "#format"\n",tag,##__VA_ARGS__) +#else +#define NIMBLE_LOGD( tag, format, ... ) (void)tag +#endif + +#if NIMBLE_CPP_DEBUG_LEVEL >= 3 +#define NIMBLE_LOGI( tag, format, ... ) console_printf("I %s: "#format"\n",tag,##__VA_ARGS__) +#else +#define NIMBLE_LOGI( tag, format, ... ) (void)tag +#endif + +#if NIMBLE_CPP_DEBUG_LEVEL >= 2 +#define NIMBLE_LOGW( tag, format, ... ) console_printf("W %s: "#format"\n",tag,##__VA_ARGS__) +#else +#define NIMBLE_LOGW( tag, format, ... ) (void)tag +#endif + +#if NIMBLE_CPP_DEBUG_LEVEL >= 1 +#define NIMBLE_LOGE( tag, format, ... ) console_printf("E %s: "#format"\n",tag,##__VA_ARGS__) +#define NIMBLE_LOGC( tag, format, ... ) console_printf("CRIT %s: "#format"\n",tag,##__VA_ARGS__) +#else +#define NIMBLE_LOGE( tag, format, ... ) (void)tag +#define NIMBLE_LOGC( tag, format, ... ) (void)tag +#endif + + + +#endif /* CONFIG_NIMBLE_CPP_IDF */ +#endif /* CONFIG_BT_ENABLED */ +#endif /* MAIN_NIMBLELOG_H_ */ diff --git a/src/NimBLERemoteCharacteristic.cpp b/src/NimBLERemoteCharacteristic.cpp index 85c8549..16a1088 100644 --- a/src/NimBLERemoteCharacteristic.cpp +++ b/src/NimBLERemoteCharacteristic.cpp @@ -12,11 +12,8 @@ * Author: kolban */ -#include "sdkconfig.h" -#if defined(CONFIG_BT_ENABLED) - #include "nimconfig.h" -#if defined( CONFIG_BT_NIMBLE_ROLE_CENTRAL) +#if defined(CONFIG_BT_ENABLED) && defined(CONFIG_BT_NIMBLE_ROLE_CENTRAL) #include "NimBLERemoteCharacteristic.h" #include "NimBLEUtils.h" @@ -819,6 +816,4 @@ int NimBLERemoteCharacteristic::onWriteCB(uint16_t conn_handle, return 0; } - -#endif // #if defined( CONFIG_BT_NIMBLE_ROLE_CENTRAL) -#endif /* CONFIG_BT_ENABLED */ +#endif /* CONFIG_BT_ENABLED && CONFIG_BT_NIMBLE_ROLE_CENTRAL */ diff --git a/src/NimBLERemoteCharacteristic.h b/src/NimBLERemoteCharacteristic.h index 39e6d40..1b3dedd 100644 --- a/src/NimBLERemoteCharacteristic.h +++ b/src/NimBLERemoteCharacteristic.h @@ -14,11 +14,9 @@ #ifndef COMPONENTS_NIMBLEREMOTECHARACTERISTIC_H_ #define COMPONENTS_NIMBLEREMOTECHARACTERISTIC_H_ -#include "sdkconfig.h" -#if defined(CONFIG_BT_ENABLED) #include "nimconfig.h" -#if defined( CONFIG_BT_NIMBLE_ROLE_CENTRAL) +#if defined(CONFIG_BT_ENABLED) && defined(CONFIG_BT_NIMBLE_ROLE_CENTRAL) #include "NimBLERemoteService.h" #include "NimBLERemoteDescriptor.h" @@ -167,6 +165,5 @@ private: std::vector m_descriptorVector; }; // NimBLERemoteCharacteristic -#endif // #if defined( CONFIG_BT_NIMBLE_ROLE_CENTRAL) -#endif /* CONFIG_BT_ENABLED */ +#endif /* CONFIG_BT_ENABLED && CONFIG_BT_NIMBLE_ROLE_CENTRAL */ #endif /* COMPONENTS_NIMBLEREMOTECHARACTERISTIC_H_ */ diff --git a/src/NimBLERemoteDescriptor.cpp b/src/NimBLERemoteDescriptor.cpp index fc0f06b..02fbdc7 100644 --- a/src/NimBLERemoteDescriptor.cpp +++ b/src/NimBLERemoteDescriptor.cpp @@ -11,11 +11,9 @@ * Created on: Jul 8, 2017 * Author: kolban */ -#include "sdkconfig.h" -#if defined(CONFIG_BT_ENABLED) #include "nimconfig.h" -#if defined( CONFIG_BT_NIMBLE_ROLE_CENTRAL) +#if defined(CONFIG_BT_ENABLED) && defined(CONFIG_BT_NIMBLE_ROLE_CENTRAL) #include "NimBLERemoteDescriptor.h" #include "NimBLEUtils.h" @@ -350,5 +348,4 @@ bool NimBLERemoteDescriptor::writeValue(const std::string &newValue, bool respon return writeValue((uint8_t*) newValue.data(), newValue.length(), response); } // writeValue -#endif // #if defined( CONFIG_BT_NIMBLE_ROLE_CENTRAL) -#endif /* CONFIG_BT_ENABLED */ +#endif /* CONFIG_BT_ENABLED && CONFIG_BT_NIMBLE_ROLE_CENTRAL */ diff --git a/src/NimBLERemoteDescriptor.h b/src/NimBLERemoteDescriptor.h index b52738e..13e8351 100644 --- a/src/NimBLERemoteDescriptor.h +++ b/src/NimBLERemoteDescriptor.h @@ -14,11 +14,9 @@ #ifndef COMPONENTS_NIMBLEREMOTEDESCRIPTOR_H_ #define COMPONENTS_NIMBLEREMOTEDESCRIPTOR_H_ -#include "sdkconfig.h" -#if defined(CONFIG_BT_ENABLED) #include "nimconfig.h" -#if defined( CONFIG_BT_NIMBLE_ROLE_CENTRAL) +#if defined(CONFIG_BT_ENABLED) && defined(CONFIG_BT_NIMBLE_ROLE_CENTRAL) #include "NimBLERemoteCharacteristic.h" @@ -81,6 +79,5 @@ private: NimBLERemoteCharacteristic* m_pRemoteCharacteristic; }; -#endif // #if defined( CONFIG_BT_NIMBLE_ROLE_CENTRAL) -#endif /* CONFIG_BT_ENABLED */ +#endif /* CONFIG_BT_ENABLED && CONFIG_BT_NIMBLE_ROLE_CENTRAL */ #endif /* COMPONENTS_NIMBLEREMOTEDESCRIPTOR_H_ */ diff --git a/src/NimBLERemoteService.cpp b/src/NimBLERemoteService.cpp index efb6662..b8ae4fc 100644 --- a/src/NimBLERemoteService.cpp +++ b/src/NimBLERemoteService.cpp @@ -11,11 +11,9 @@ * Created on: Jul 8, 2017 * Author: kolban */ -#include "sdkconfig.h" -#if defined(CONFIG_BT_ENABLED) #include "nimconfig.h" -#if defined( CONFIG_BT_NIMBLE_ROLE_CENTRAL) +#if defined(CONFIG_BT_ENABLED) && defined(CONFIG_BT_NIMBLE_ROLE_CENTRAL) #include "NimBLERemoteService.h" #include "NimBLEUtils.h" @@ -386,6 +384,4 @@ std::string NimBLERemoteService::toString() { return res; } // toString - -#endif // #if defined( CONFIG_BT_NIMBLE_ROLE_CENTRAL) -#endif /* CONFIG_BT_ENABLED */ +#endif /* CONFIG_BT_ENABLED && CONFIG_BT_NIMBLE_ROLE_CENTRAL */ diff --git a/src/NimBLERemoteService.h b/src/NimBLERemoteService.h index 751c9ef..0443cfd 100644 --- a/src/NimBLERemoteService.h +++ b/src/NimBLERemoteService.h @@ -14,11 +14,9 @@ #ifndef COMPONENTS_NIMBLEREMOTESERVICE_H_ #define COMPONENTS_NIMBLEREMOTESERVICE_H_ -#include "sdkconfig.h" -#if defined(CONFIG_BT_ENABLED) #include "nimconfig.h" -#if defined( CONFIG_BT_NIMBLE_ROLE_CENTRAL) +#if defined(CONFIG_BT_ENABLED) && defined(CONFIG_BT_NIMBLE_ROLE_CENTRAL) #include "NimBLEClient.h" #include "NimBLEUUID.h" @@ -83,6 +81,5 @@ private: uint16_t m_endHandle; }; // NimBLERemoteService -#endif // #if defined( CONFIG_BT_NIMBLE_ROLE_CENTRAL) -#endif /* CONFIG_BT_ENABLED */ +#endif /* CONFIG_BT_ENABLED && CONFIG_BT_NIMBLE_ROLE_CENTRAL */ #endif /* COMPONENTS_NIMBLEREMOTESERVICE_H_ */ diff --git a/src/NimBLEScan.cpp b/src/NimBLEScan.cpp index 0370552..d9dcb7d 100644 --- a/src/NimBLEScan.cpp +++ b/src/NimBLEScan.cpp @@ -11,11 +11,9 @@ * Created on: Jul 1, 2017 * Author: kolban */ -#include "sdkconfig.h" -#if defined(CONFIG_BT_ENABLED) #include "nimconfig.h" -#if defined(CONFIG_BT_NIMBLE_ROLE_OBSERVER) +#if defined(CONFIG_BT_ENABLED) && defined(CONFIG_BT_NIMBLE_ROLE_OBSERVER) #include "NimBLEScan.h" #include "NimBLEDevice.h" @@ -534,5 +532,4 @@ NimBLEAdvertisedDevice *NimBLEScanResults::getDevice(const NimBLEAddress &addres return nullptr; } -#endif // #if defined(CONFIG_BT_NIMBLE_ROLE_OBSERVER) -#endif /* CONFIG_BT_ENABLED */ +#endif /* CONFIG_BT_ENABLED && CONFIG_BT_NIMBLE_ROLE_OBSERVER */ diff --git a/src/NimBLEScan.h b/src/NimBLEScan.h index 49d67c8..76a1142 100644 --- a/src/NimBLEScan.h +++ b/src/NimBLEScan.h @@ -13,16 +13,18 @@ */ #ifndef COMPONENTS_NIMBLE_SCAN_H_ #define COMPONENTS_NIMBLE_SCAN_H_ -#include "sdkconfig.h" -#if defined(CONFIG_BT_ENABLED) #include "nimconfig.h" -#if defined(CONFIG_BT_NIMBLE_ROLE_OBSERVER) +#if defined(CONFIG_BT_ENABLED) && defined(CONFIG_BT_NIMBLE_ROLE_OBSERVER) #include "NimBLEAdvertisedDevice.h" #include "NimBLEUtils.h" +#if defined(CONFIG_NIMBLE_CPP_IDF) #include "host/ble_gap.h" +#else +#include "nimble/nimble/host/include/host/ble_gap.h" +#endif #include @@ -97,6 +99,5 @@ private: uint8_t m_maxResults; }; -#endif // #if defined(CONFIG_BT_NIMBLE_ROLE_OBSERVER) -#endif /* CONFIG_BT_ENABLED */ +#endif /* CONFIG_BT_ENABLED CONFIG_BT_NIMBLE_ROLE_OBSERVER */ #endif /* COMPONENTS_NIMBLE_SCAN_H_ */ diff --git a/src/NimBLESecurity.cpp b/src/NimBLESecurity.cpp index aa06296..df6d192 100644 --- a/src/NimBLESecurity.cpp +++ b/src/NimBLESecurity.cpp @@ -12,7 +12,7 @@ * Author: chegewara */ -#include "sdkconfig.h" +#include "nimconfig.h" #if defined(CONFIG_BT_ENABLED) #include "NimBLESecurity.h" diff --git a/src/NimBLESecurity.h b/src/NimBLESecurity.h index 5a7619f..157577d 100644 --- a/src/NimBLESecurity.h +++ b/src/NimBLESecurity.h @@ -14,10 +14,16 @@ #ifndef COMPONENTS_NIMBLESECURITY_H_ #define COMPONENTS_NIMBLESECURITY_H_ -#include "sdkconfig.h" + +#include "nimconfig.h" #if defined(CONFIG_BT_ENABLED) +#if defined(CONFIG_NIMBLE_CPP_IDF) #include "host/ble_gap.h" +#else +#include "nimble/nimble/host/include/host/ble_gap.h" +#endif + /**** FIX COMPILATION ****/ #undef min #undef max diff --git a/src/NimBLEServer.cpp b/src/NimBLEServer.cpp index 082c51a..86996ab 100644 --- a/src/NimBLEServer.cpp +++ b/src/NimBLEServer.cpp @@ -12,19 +12,20 @@ * Author: kolban */ -#include "sdkconfig.h" -#if defined(CONFIG_BT_ENABLED) - #include "nimconfig.h" -#if defined(CONFIG_BT_NIMBLE_ROLE_PERIPHERAL) +#if defined(CONFIG_BT_ENABLED) && defined(CONFIG_BT_NIMBLE_ROLE_PERIPHERAL) #include "NimBLEServer.h" #include "NimBLEDevice.h" #include "NimBLELog.h" +#if defined(CONFIG_NIMBLE_CPP_IDF) #include "services/gap/ble_svc_gap.h" #include "services/gatt/ble_svc_gatt.h" - +#else +#include "nimble/nimble/host/services/gap/include/services/gap/ble_svc_gap.h" +#include "nimble/nimble/host/services/gatt/include/services/gatt/ble_svc_gatt.h" +#endif static const char* LOG_TAG = "NimBLEServer"; static NimBLEServerCallbacks defaultCallbacks; @@ -842,6 +843,4 @@ bool NimBLEServerCallbacks::onConfirmPIN(uint32_t pin){ return true; } - -#endif // #if defined(CONFIG_BT_NIMBLE_ROLE_PERIPHERAL) -#endif // CONFIG_BT_ENABLED +#endif /* CONFIG_BT_ENABLED && CONFIG_BT_NIMBLE_ROLE_PERIPHERAL */ diff --git a/src/NimBLEServer.h b/src/NimBLEServer.h index ebcf39f..e1517c8 100644 --- a/src/NimBLEServer.h +++ b/src/NimBLEServer.h @@ -14,11 +14,9 @@ #ifndef MAIN_NIMBLESERVER_H_ #define MAIN_NIMBLESERVER_H_ -#include "sdkconfig.h" -#if defined(CONFIG_BT_ENABLED) #include "nimconfig.h" -#if defined(CONFIG_BT_NIMBLE_ROLE_PERIPHERAL) +#if defined(CONFIG_BT_ENABLED) && defined(CONFIG_BT_NIMBLE_ROLE_PERIPHERAL) #define NIMBLE_ATT_REMOVE_HIDE 1 #define NIMBLE_ATT_REMOVE_DELETE 2 @@ -168,7 +166,5 @@ public: virtual bool onConfirmPIN(uint32_t pin); }; // NimBLEServerCallbacks - -#endif // #if defined(CONFIG_BT_NIMBLE_ROLE_PERIPHERAL) -#endif /* CONFIG_BT_ENABLED */ +#endif /* CONFIG_BT_ENABLED && CONFIG_BT_NIMBLE_ROLE_PERIPHERAL */ #endif /* MAIN_NIMBLESERVER_H_ */ diff --git a/src/NimBLEService.cpp b/src/NimBLEService.cpp index 9c43e90..b2e5b07 100644 --- a/src/NimBLEService.cpp +++ b/src/NimBLEService.cpp @@ -14,11 +14,8 @@ // A service is identified by a UUID. A service is also the container for one or more characteristics. -#include "sdkconfig.h" -#if defined(CONFIG_BT_ENABLED) - #include "nimconfig.h" -#if defined(CONFIG_BT_NIMBLE_ROLE_PERIPHERAL) +#if defined(CONFIG_BT_ENABLED) && defined(CONFIG_BT_NIMBLE_ROLE_PERIPHERAL) #include "NimBLEService.h" #include "NimBLEUtils.h" @@ -432,5 +429,4 @@ NimBLEServer* NimBLEService::getServer() { return m_pServer; }// getServer -#endif // #if defined(CONFIG_BT_NIMBLE_ROLE_PERIPHERAL) -#endif // CONFIG_BT_ENABLED +#endif /* CONFIG_BT_ENABLED && CONFIG_BT_NIMBLE_ROLE_PERIPHERAL */ diff --git a/src/NimBLEService.h b/src/NimBLEService.h index ebf913d..2543428 100644 --- a/src/NimBLEService.h +++ b/src/NimBLEService.h @@ -14,11 +14,9 @@ #ifndef MAIN_NIMBLESERVICE_H_ #define MAIN_NIMBLESERVICE_H_ -#include "sdkconfig.h" -#if defined(CONFIG_BT_ENABLED) #include "nimconfig.h" -#if defined(CONFIG_BT_NIMBLE_ROLE_PERIPHERAL) +#if defined(CONFIG_BT_ENABLED) && defined(CONFIG_BT_NIMBLE_ROLE_PERIPHERAL) #include "NimBLEServer.h" #include "NimBLECharacteristic.h" @@ -85,7 +83,5 @@ private: }; // NimBLEService - -#endif // #if defined(CONFIG_BT_NIMBLE_ROLE_PERIPHERAL) -#endif // CONFIG_BT_ENABLED +#endif /* CONFIG_BT_ENABLED && CONFIG_BT_NIMBLE_ROLE_PERIPHERAL */ #endif /* MAIN_NIMBLESERVICE_H_ */ diff --git a/src/NimBLEUUID.cpp b/src/NimBLEUUID.cpp index 9338d7d..4234650 100644 --- a/src/NimBLEUUID.cpp +++ b/src/NimBLEUUID.cpp @@ -11,7 +11,8 @@ * Created on: Jun 21, 2017 * Author: kolban */ -#include "sdkconfig.h" + +#include "nimconfig.h" #if defined(CONFIG_BT_ENABLED) #include "NimBLEUtils.h" diff --git a/src/NimBLEUUID.h b/src/NimBLEUUID.h index 982f9c3..724db19 100644 --- a/src/NimBLEUUID.h +++ b/src/NimBLEUUID.h @@ -14,10 +14,16 @@ #ifndef COMPONENTS_NIMBLEUUID_H_ #define COMPONENTS_NIMBLEUUID_H_ -#include "sdkconfig.h" + +#include "nimconfig.h" #if defined(CONFIG_BT_ENABLED) +#if defined(CONFIG_NIMBLE_CPP_IDF) #include "host/ble_uuid.h" +#else +#include "nimble/nimble/host/include/host/ble_uuid.h" +#endif + /**** FIX COMPILATION ****/ #undef min #undef max diff --git a/src/NimBLEUtils.cpp b/src/NimBLEUtils.cpp index 7a1f55b..5e7f79f 100644 --- a/src/NimBLEUtils.cpp +++ b/src/NimBLEUtils.cpp @@ -6,7 +6,7 @@ * */ -#include "sdkconfig.h" +#include "nimconfig.h" #if defined(CONFIG_BT_ENABLED) #include "NimBLEUtils.h" diff --git a/src/NimBLEUtils.h b/src/NimBLEUtils.h index acbc93e..2fe4b3c 100644 --- a/src/NimBLEUtils.h +++ b/src/NimBLEUtils.h @@ -8,10 +8,15 @@ #ifndef COMPONENTS_NIMBLEUTILS_H_ #define COMPONENTS_NIMBLEUTILS_H_ -#include "sdkconfig.h" + +#include "nimconfig.h" #if defined(CONFIG_BT_ENABLED) +#if defined(CONFIG_NIMBLE_CPP_IDF) #include "host/ble_gap.h" +#else +#include "nimble/nimble/host/include/host/ble_gap.h" +#endif /**** FIX COMPILATION ****/ #undef min diff --git a/src/nimconfig.h b/src/nimconfig.h index 451b199..c5c1dda 100644 --- a/src/nimconfig.h +++ b/src/nimconfig.h @@ -10,6 +10,23 @@ #include "sdkconfig.h" #include "nimconfig_rename.h" +#if defined(CONFIG_BT_ENABLED) + +// Allows cpp wrapper to select the correct include paths when using esp-idf +#define CONFIG_NIMBLE_CPP_IDF + +/* Cannot use client without scan */ +#if defined(CONFIG_BT_NIMBLE_ROLE_CENTRAL) && !defined(CONFIG_BT_NIMBLE_ROLE_OBSERVER) +#define CONFIG_BT_NIMBLE_ROLE_OBSERVER +#endif + +/* Cannot use server without advertise */ +#if defined(CONFIG_BT_NIMBLE_ROLE_PERIPHERAL) && !defined(CONFIG_BT_NIMBLE_ROLE_BROADCASTER) +#define CONFIG_BT_NIMBLE_ROLE_BROADCASTER +#endif + +#endif /* CONFIG_BT_ENABLED */ + #ifdef _DOXYGEN_ /** @brief Un-comment to change the number of simultaneous connections (esp controller max is 9) */ @@ -21,10 +38,11 @@ /** @brief Un-comment to change default device name */ #define CONFIG_BT_NIMBLE_SVC_GAP_DEVICE_NAME "nimble" -/** @brief Un-comment to see debug log messages from the NimBLE host +/** @brief Un-comment to set the debug log messages level from the NimBLE host stack.\n + * Values: 0 = DEBUG, 1 = INFO, 2 = WARNING, 3 = ERROR, 4 = CRITICAL, 5+ = NONE\n * Uses approx. 32kB of flash memory. */ -#define CONFIG_BT_NIMBLE_DEBUG +#define CONFIG_BT_NIMBLE_LOG_LEVEL 5 /** @brief Un-comment to see NimBLE host return codes as text debug log messages. * Uses approx. 7kB of flash memory.