diff --git a/src/NimBLEAddress.h b/src/NimBLEAddress.h index 89d19ab8..7e1701c6 100644 --- a/src/NimBLEAddress.h +++ b/src/NimBLEAddress.h @@ -21,10 +21,10 @@ #include "syscfg/syscfg.h" #if CONFIG_BT_NIMBLE_ENABLED -# if defined(CONFIG_NIMBLE_CPP_IDF) -# include "nimble/ble.h" -# else +# ifdef USING_NIMBLE_ARDUINO_HEADERS # include "nimble/nimble/include/nimble/ble.h" +# else +# include "nimble/ble.h" # endif /**** FIX COMPILATION ****/ @@ -63,8 +63,8 @@ class NimBLEAddress : private ble_addr_t { const NimBLEAddress& reverseByteOrder(); bool operator==(const NimBLEAddress& rhs) const; bool operator!=(const NimBLEAddress& rhs) const; - operator std::string() const; - operator uint64_t() const; + operator std::string() const; + operator uint64_t() const; }; #endif // CONFIG_BT_NIMBLE_ENABLED diff --git a/src/NimBLEAdvertisedDevice.h b/src/NimBLEAdvertisedDevice.h index 5489b27a..6a41394e 100644 --- a/src/NimBLEAdvertisedDevice.h +++ b/src/NimBLEAdvertisedDevice.h @@ -25,12 +25,12 @@ # include "NimBLEScan.h" # include "NimBLEUUID.h" -# if defined(CONFIG_NIMBLE_CPP_IDF) -# include "host/ble_hs_adv.h" -# include "host/ble_gap.h" -# else +# ifdef USING_NIMBLE_ARDUINO_HEADERS # include "nimble/nimble/host/include/host/ble_hs_adv.h" # include "nimble/nimble/host/include/host/ble_gap.h" +# else +# include "host/ble_hs_adv.h" +# include "host/ble_gap.h" # endif # include @@ -158,13 +158,13 @@ class NimBLEAdvertisedDevice { uint8_t findAdvField(uint8_t type, uint8_t index = 0, size_t* data_loc = nullptr) const; size_t findServiceData(uint8_t index, uint8_t* bytes) const; - NimBLEAddress m_address{}; - uint8_t m_advType{}; - int8_t m_rssi{}; - uint8_t m_callbackSent{}; - uint16_t m_advLength{}; - ble_npl_time_t m_time{}; - NimBLEAdvertisedDevice* m_pNextWaiting{}; // intrusive list node; self-pointer means "not in list", set in ctor + NimBLEAddress m_address{}; + uint8_t m_advType{}; + int8_t m_rssi{}; + uint8_t m_callbackSent{}; + uint16_t m_advLength{}; + ble_npl_time_t m_time{}; + NimBLEAdvertisedDevice* m_pNextWaiting{}; // intrusive list node; self-pointer means "not in list", set in ctor # if MYNEWT_VAL(BLE_EXT_ADV) bool m_isLegacyAdv{}; diff --git a/src/NimBLEAdvertisementData.cpp b/src/NimBLEAdvertisementData.cpp index f45ba3e7..5f598978 100644 --- a/src/NimBLEAdvertisementData.cpp +++ b/src/NimBLEAdvertisementData.cpp @@ -23,10 +23,10 @@ # include "NimBLEUUID.h" # include "NimBLELog.h" -# if defined(CONFIG_NIMBLE_CPP_IDF) -# include "host/ble_hs_adv.h" -# else +#ifdef USING_NIMBLE_ARDUINO_HEADERS # include "nimble/nimble/host/include/host/ble_hs_adv.h" +# else +# include "host/ble_hs_adv.h" # endif static const char* LOG_TAG = "NimBLEAdvertisementData"; diff --git a/src/NimBLEAdvertising.cpp b/src/NimBLEAdvertising.cpp index 53ec2235..b196c153 100644 --- a/src/NimBLEAdvertising.cpp +++ b/src/NimBLEAdvertising.cpp @@ -18,11 +18,12 @@ #include "NimBLEAdvertising.h" #if (CONFIG_BT_NIMBLE_ENABLED && MYNEWT_VAL(BLE_ROLE_BROADCASTER) && !MYNEWT_VAL(BLE_EXT_ADV)) || defined(_DOXYGEN_) -# if defined(CONFIG_NIMBLE_CPP_IDF) -# include "services/gap/ble_svc_gap.h" -# else +#ifdef USING_NIMBLE_ARDUINO_HEADERS # include "nimble/nimble/host/services/gap/include/services/gap/ble_svc_gap.h" +# else +# include "services/gap/ble_svc_gap.h" # endif + # include "NimBLEDevice.h" # include "NimBLEServer.h" # include "NimBLEUtils.h" diff --git a/src/NimBLEAdvertising.h b/src/NimBLEAdvertising.h index c2811454..316002ff 100644 --- a/src/NimBLEAdvertising.h +++ b/src/NimBLEAdvertising.h @@ -21,10 +21,10 @@ #include "syscfg/syscfg.h" #if (CONFIG_BT_NIMBLE_ENABLED && MYNEWT_VAL(BLE_ROLE_BROADCASTER) && !MYNEWT_VAL(BLE_EXT_ADV)) || defined(_DOXYGEN_) -# if defined(CONFIG_NIMBLE_CPP_IDF) -# include "host/ble_gap.h" -# else +#ifdef USING_NIMBLE_ARDUINO_HEADERS # include "nimble/nimble/host/include/host/ble_gap.h" +# else +# include "host/ble_gap.h" # endif /**** FIX COMPILATION ****/ diff --git a/src/NimBLEAttValue.cpp b/src/NimBLEAttValue.cpp index e24d1019..8dbe4866 100644 --- a/src/NimBLEAttValue.cpp +++ b/src/NimBLEAttValue.cpp @@ -18,10 +18,10 @@ #include "NimBLEAttValue.h" #if CONFIG_BT_NIMBLE_ENABLED -# if defined(CONFIG_NIMBLE_CPP_IDF) -# include "nimble/nimble_npl.h" -# else +# ifdef USING_NIMBLE_ARDUINO_HEADERS # include "nimble/nimble/include/nimble/nimble_npl.h" +# else +# include "nimble/nimble_npl.h" # endif # include "NimBLEUtils.h" diff --git a/src/NimBLECharacteristic.cpp b/src/NimBLECharacteristic.cpp index f4406347..343d4071 100644 --- a/src/NimBLECharacteristic.cpp +++ b/src/NimBLECharacteristic.cpp @@ -18,7 +18,7 @@ #include "NimBLECharacteristic.h" #if CONFIG_BT_NIMBLE_ENABLED && MYNEWT_VAL(BLE_ROLE_PERIPHERAL) -# if defined(CONFIG_NIMBLE_CPP_IDF) +# ifndef USING_NIMBLE_ARDUINO_HEADERS # if !defined(ESP_IDF_VERSION_MAJOR) || ESP_IDF_VERSION_MAJOR < 5 # define ble_gatts_notify_custom ble_gattc_notify_custom # define ble_gatts_indicate_custom ble_gattc_indicate_custom diff --git a/src/NimBLEClient.cpp b/src/NimBLEClient.cpp index c8760240..f17d0489 100644 --- a/src/NimBLEClient.cpp +++ b/src/NimBLEClient.cpp @@ -23,10 +23,10 @@ # include "NimBLEDevice.h" # include "NimBLELog.h" -# if defined(CONFIG_NIMBLE_CPP_IDF) -# include "nimble/nimble_port.h" -# else +# ifdef USING_NIMBLE_ARDUINO_HEADERS # include "nimble/porting/nimble/include/nimble/nimble_port.h" +# else +# include "nimble/nimble_port.h" # endif # include @@ -550,7 +550,7 @@ bool NimBLEClient::updateConnParams(uint16_t minInterval, uint16_t maxInterval, * @param [in] txOctets The preferred number of payload octets to use (Range 0x001B-0x00FB). */ bool NimBLEClient::setDataLen(uint16_t txOctets) { -# if defined(CONFIG_NIMBLE_CPP_IDF) && !defined(ESP_IDF_VERSION) || \ +# if !defined(USING_NIMBLE_ARDUINO_HEADERS) && !defined(ESP_IDF_VERSION) || \ (ESP_IDF_VERSION_MAJOR * 100 + ESP_IDF_VERSION_MINOR * 10 + ESP_IDF_VERSION_PATCH) < 432 return false; # else diff --git a/src/NimBLEClient.h b/src/NimBLEClient.h index 89e7ce61..9b9b8538 100644 --- a/src/NimBLEClient.h +++ b/src/NimBLEClient.h @@ -21,10 +21,10 @@ #include "syscfg/syscfg.h" #if CONFIG_BT_NIMBLE_ENABLED && MYNEWT_VAL(BLE_ROLE_CENTRAL) -# if defined(CONFIG_NIMBLE_CPP_IDF) -# include "host/ble_gap.h" -# else +# ifdef USING_NIMBLE_ARDUINO_HEADERS # include "nimble/nimble/host/include/host/ble_gap.h" +# else +# include "host/ble_gap.h" # endif # include "NimBLEAddress.h" @@ -118,7 +118,7 @@ class NimBLEClient { * - deleteOnConnectFail: false * - asyncConnect: false * - exchangeMTU: true - * - connectFailRetries: 2 + * - connectFailRetries: 2 */ Config() : deleteCallbacks(0), diff --git a/src/NimBLEConnInfo.h b/src/NimBLEConnInfo.h index 1c63cd87..724d9099 100644 --- a/src/NimBLEConnInfo.h +++ b/src/NimBLEConnInfo.h @@ -18,10 +18,10 @@ #ifndef NIMBLE_CPP_CONNINFO_H_ #define NIMBLE_CPP_CONNINFO_H_ -#if defined(CONFIG_NIMBLE_CPP_IDF) -# include "host/ble_gap.h" -#else +#ifdef USING_NIMBLE_ARDUINO_HEADERS # include "nimble/nimble/host/include/host/ble_gap.h" +#else +# include "host/ble_gap.h" #endif #include "NimBLEAddress.h" diff --git a/src/NimBLEDevice.cpp b/src/NimBLEDevice.cpp index 13504fe7..b309b027 100644 --- a/src/NimBLEDevice.cpp +++ b/src/NimBLEDevice.cpp @@ -24,7 +24,7 @@ # include "esp_bt.h" # endif # include "nvs_flash.h" -# if defined(CONFIG_NIMBLE_CPP_IDF) +# ifndef USING_NIMBLE_ARDUINO_HEADERS # if (ESP_IDF_VERSION < ESP_IDF_VERSION_VAL(5, 0, 0) || CONFIG_BT_NIMBLE_LEGACY_VHCI_ENABLE) # include "esp_nimble_hci.h" # endif @@ -35,14 +35,14 @@ # include "host/util/util.h" # include "services/gap/ble_svc_gap.h" # include "services/gatt/ble_svc_gatt.h" -# else +# else // USING_NIMBLE_ARDUINO_HEADERS # include "nimble/esp_port/esp-hci/include/esp_nimble_hci.h" # endif # else # include "nimble/nimble/controller/include/controller/ble_phy.h" # endif -# ifndef CONFIG_NIMBLE_CPP_IDF +# ifdef USING_NIMBLE_ARDUINO_HEADERS # 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" @@ -914,7 +914,7 @@ bool NimBLEDevice::init(const std::string& deviceName) { esp_bt_controller_mem_release(ESP_BT_MODE_CLASSIC_BT); # endif -# if ESP_IDF_VERSION < ESP_IDF_VERSION_VAL(5, 0, 0) || !defined(CONFIG_NIMBLE_CPP_IDF) +# if ESP_IDF_VERSION < ESP_IDF_VERSION_VAL(5, 0, 0) || defined(USING_NIMBLE_ARDUINO_HEADERS) esp_bt_controller_config_t bt_cfg = BT_CONTROLLER_INIT_CONFIG_DEFAULT(); # if defined(CONFIG_IDF_TARGET_ESP32) bt_cfg.mode = ESP_BT_MODE_BLE; @@ -1028,7 +1028,7 @@ bool NimBLEDevice::deinit(bool clearAll) { rc = nimble_port_stop(); if (rc == 0) { nimble_port_deinit(); -# ifdef CONFIG_NIMBLE_CPP_IDF +# ifndef USING_NIMBLE_ARDUINO_HEADERS # if ESP_IDF_VERSION < ESP_IDF_VERSION_VAL(5, 0, 0) rc = esp_nimble_hci_and_controller_deinit(); if (rc != ESP_OK) { diff --git a/src/NimBLEDevice.h b/src/NimBLEDevice.h index 211c05c3..fb64c83d 100644 --- a/src/NimBLEDevice.h +++ b/src/NimBLEDevice.h @@ -29,10 +29,10 @@ (CONFIG_BTDM_BLE_SCAN_DUPL || CONFIG_BT_LE_SCAN_DUPL || CONFIG_BT_CTRL_BLE_SCAN_DUPL) # endif -# if defined(CONFIG_NIMBLE_CPP_IDF) -# include +# ifdef USING_NIMBLE_ARDUINO_HEADERS +# include "nimble/nimble/host/include/host/ble_gap.h" # else -# include +# include "host/ble_gap.h" # endif /**** FIX COMPILATION ****/ diff --git a/src/NimBLEExtAdvertising.cpp b/src/NimBLEExtAdvertising.cpp index d3f78c33..237e75b0 100644 --- a/src/NimBLEExtAdvertising.cpp +++ b/src/NimBLEExtAdvertising.cpp @@ -18,10 +18,10 @@ #include "NimBLEExtAdvertising.h" #if CONFIG_BT_NIMBLE_ENABLED && MYNEWT_VAL(BLE_ROLE_BROADCASTER) && MYNEWT_VAL(BLE_EXT_ADV) -# if defined(CONFIG_NIMBLE_CPP_IDF) -# include "services/gap/ble_svc_gap.h" -# else +#ifdef USING_NIMBLE_ARDUINO_HEADERS # include "nimble/nimble/host/services/gap/include/services/gap/ble_svc_gap.h" +#else +# include "services/gap/ble_svc_gap.h" # endif # include "NimBLEDevice.h" diff --git a/src/NimBLEExtAdvertising.h b/src/NimBLEExtAdvertising.h index 4591ce46..a9cc7347 100644 --- a/src/NimBLEExtAdvertising.h +++ b/src/NimBLEExtAdvertising.h @@ -21,10 +21,10 @@ #include "syscfg/syscfg.h" #if CONFIG_BT_NIMBLE_ENABLED && MYNEWT_VAL(BLE_ROLE_BROADCASTER) && MYNEWT_VAL(BLE_EXT_ADV) -# if defined(CONFIG_NIMBLE_CPP_IDF) -# include "host/ble_gap.h" -# else +# ifdef USING_NIMBLE_ARDUINO_HEADERS # include "nimble/nimble/host/include/host/ble_gap.h" +# else +# include "host/ble_gap.h" # endif /**** FIX COMPILATION ****/ diff --git a/src/NimBLEL2CAPChannel.cpp b/src/NimBLEL2CAPChannel.cpp index 4a155860..78d87e75 100644 --- a/src/NimBLEL2CAPChannel.cpp +++ b/src/NimBLEL2CAPChannel.cpp @@ -9,10 +9,10 @@ # include "NimBLELog.h" # include "NimBLEUtils.h" -# if defined(CONFIG_NIMBLE_CPP_IDF) -# include "host/ble_gap.h" -# else +# ifdef USING_NIMBLE_ARDUINO_HEADERS # include "nimble/nimble/host/include/host/ble_gap.h" +# else +# include "host/ble_gap.h" # endif // L2CAP buffer block size diff --git a/src/NimBLEL2CAPChannel.h b/src/NimBLEL2CAPChannel.h index b7fafa4a..89d4e27b 100644 --- a/src/NimBLEL2CAPChannel.h +++ b/src/NimBLEL2CAPChannel.h @@ -9,12 +9,12 @@ #if CONFIG_BT_NIMBLE_ENABLED && MYNEWT_VAL(BLE_L2CAP_COC_MAX_NUM) # include "inttypes.h" -# if defined(CONFIG_NIMBLE_CPP_IDF) -# include "host/ble_l2cap.h" -# include "os/os_mbuf.h" -# else +# ifdef USING_NIMBLE_ARDUINO_HEADERS # include "nimble/nimble/host/include/host/ble_l2cap.h" # include "nimble/porting/nimble/include/os/os_mbuf.h" +# else +# include "host/ble_l2cap.h" +# include "os/os_mbuf.h" # endif /**** FIX COMPILATION ****/ diff --git a/src/NimBLELocalValueAttribute.h b/src/NimBLELocalValueAttribute.h index 56acb729..5fd37e55 100644 --- a/src/NimBLELocalValueAttribute.h +++ b/src/NimBLELocalValueAttribute.h @@ -21,10 +21,10 @@ #include "syscfg/syscfg.h" #if CONFIG_BT_NIMBLE_ENABLED && MYNEWT_VAL(BLE_ROLE_PERIPHERAL) -# if defined(CONFIG_NIMBLE_CPP_IDF) -# include "host/ble_hs.h" -# else +#ifdef USING_NIMBLE_ARDUINO_HEADERS # include "nimble/nimble/host/include/host/ble_hs.h" +# else +# include "host/ble_hs.h" # endif /**** FIX COMPILATION ****/ diff --git a/src/NimBLELog.h b/src/NimBLELog.h index de1d24d1..ad57a0aa 100644 --- a/src/NimBLELog.h +++ b/src/NimBLELog.h @@ -33,7 +33,7 @@ # endif # endif -# if defined(CONFIG_NIMBLE_CPP_IDF) +# ifndef USING_NIMBLE_ARDUINO_HEADERS # include "esp_log.h" # include "console/console.h" @@ -172,7 +172,7 @@ # define NIMBLE_LOGE(tag, format, ...) (void)tag # endif -# endif /* CONFIG_NIMBLE_CPP_IDF */ +# endif /* !USING_NIMBLE_ARDUINO_HEADERS */ # define NIMBLE_LOGD_IF(cond, tag, format, ...) { if (cond) { NIMBLE_LOGD(tag, format, ##__VA_ARGS__); }} # define NIMBLE_LOGI_IF(cond, tag, format, ...) { if (cond) { NIMBLE_LOGI(tag, format, ##__VA_ARGS__); }} diff --git a/src/NimBLERemoteValueAttribute.h b/src/NimBLERemoteValueAttribute.h index bc76319b..06e89881 100644 --- a/src/NimBLERemoteValueAttribute.h +++ b/src/NimBLERemoteValueAttribute.h @@ -21,10 +21,10 @@ #include "syscfg/syscfg.h" #if CONFIG_BT_NIMBLE_ENABLED && MYNEWT_VAL(BLE_ROLE_CENTRAL) -# if defined(CONFIG_NIMBLE_CPP_IDF) -# include +#ifdef USING_NIMBLE_ARDUINO_HEADERS +# include "nimble/nimble/host/include/host/ble_gatt.h" # else -# include +# include "host/ble_gatt.h" # endif /**** FIX COMPILATION ****/ diff --git a/src/NimBLEScan.cpp b/src/NimBLEScan.cpp index 063f3215..6f80d6e9 100644 --- a/src/NimBLEScan.cpp +++ b/src/NimBLEScan.cpp @@ -20,10 +20,10 @@ # include "NimBLEDevice.h" # include "NimBLELog.h" -# if defined(CONFIG_NIMBLE_CPP_IDF) -# include "nimble/nimble_port.h" -# else +# ifdef USING_NIMBLE_ARDUINO_HEADERS # include "nimble/porting/nimble/include/nimble/nimble_port.h" +# else +# include "nimble/nimble_port.h" # endif # include @@ -553,15 +553,15 @@ bool NimBLEScan::start(uint32_t duration, bool isContinue, bool restart) { scan_params.itvl = m_scanParams.itvl; scan_params.window = m_scanParams.window; int rc = ble_gap_ext_disc(NimBLEDevice::m_ownAddrType, - duration / 10, // 10ms units - m_period, - m_scanParams.filter_duplicates, - m_scanParams.filter_policy, - m_scanParams.limited, - m_phy & SCAN_1M ? &scan_params : NULL, - m_phy & SCAN_CODED ? &scan_params : NULL, - NimBLEScan::handleGapEvent, - NULL); + duration / 10, // 10ms units + m_period, + m_scanParams.filter_duplicates, + m_scanParams.filter_policy, + m_scanParams.limited, + m_phy & SCAN_1M ? &scan_params : NULL, + m_phy & SCAN_CODED ? &scan_params : NULL, + NimBLEScan::handleGapEvent, + NULL); # else int rc = ble_gap_disc(NimBLEDevice::m_ownAddrType, duration ? duration : BLE_HS_FOREVER, diff --git a/src/NimBLEScan.h b/src/NimBLEScan.h index 9e689084..2b8a2499 100644 --- a/src/NimBLEScan.h +++ b/src/NimBLEScan.h @@ -24,10 +24,10 @@ # include "NimBLEAdvertisedDevice.h" # include "NimBLEUtils.h" -# if defined(CONFIG_NIMBLE_CPP_IDF) -# include "host/ble_gap.h" -# else +# ifdef USING_NIMBLE_ARDUINO_HEADERS # include "nimble/nimble/host/include/host/ble_gap.h" +# else +# include "host/ble_gap.h" # endif # include diff --git a/src/NimBLEServer.cpp b/src/NimBLEServer.cpp index 480d3264..1cab58ed 100644 --- a/src/NimBLEServer.cpp +++ b/src/NimBLEServer.cpp @@ -25,12 +25,12 @@ # include "NimBLEClient.h" # endif -# if defined(CONFIG_NIMBLE_CPP_IDF) -# include "services/gap/ble_svc_gap.h" -# include "services/gatt/ble_svc_gatt.h" -# else +# ifdef USING_NIMBLE_ARDUINO_HEADERS # 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" +# else +# include "services/gap/ble_svc_gap.h" +# include "services/gatt/ble_svc_gatt.h" # endif # define NIMBLE_SERVER_GET_PEER_NAME_ON_CONNECT_CB 0 @@ -1072,7 +1072,7 @@ void NimBLEServer::updateConnParams( * @param [in] octets The preferred number of payload octets to use (Range 0x001B-0x00FB). */ void NimBLEServer::setDataLen(uint16_t connHandle, uint16_t octets) const { -# if defined(CONFIG_NIMBLE_CPP_IDF) && !defined(ESP_IDF_VERSION) || \ +# if !defined(USING_NIMBLE_ARDUINO_HEADERS) && !defined(ESP_IDF_VERSION) || \ (ESP_IDF_VERSION_MAJOR * 100 + ESP_IDF_VERSION_MINOR * 10 + ESP_IDF_VERSION_PATCH) < 432 return; # else diff --git a/src/NimBLEServer.h b/src/NimBLEServer.h index a5171d2e..b2b79e1e 100644 --- a/src/NimBLEServer.h +++ b/src/NimBLEServer.h @@ -21,10 +21,10 @@ #include "syscfg/syscfg.h" #if CONFIG_BT_NIMBLE_ENABLED && MYNEWT_VAL(BLE_ROLE_PERIPHERAL) -# if defined(CONFIG_NIMBLE_CPP_IDF) -# include "host/ble_gap.h" -# else +# ifdef USING_NIMBLE_ARDUINO_HEADERS # include "nimble/nimble/host/include/host/ble_gap.h" +# else +# include "host/ble_gap.h" # endif /**** FIX COMPILATION ****/ diff --git a/src/NimBLEStream.cpp b/src/NimBLEStream.cpp index 3b72ace5..7ed0c908 100644 --- a/src/NimBLEStream.cpp +++ b/src/NimBLEStream.cpp @@ -20,12 +20,12 @@ # include "NimBLEDevice.h" # include "NimBLELog.h" -# if defined(CONFIG_NIMBLE_CPP_IDF) -# include "os/os_mbuf.h" -# include "nimble/nimble_port.h" -# else +# ifdef USING_NIMBLE_ARDUINO_HEADERS # include "nimble/porting/nimble/include/os/os_mbuf.h" # include "nimble/porting/nimble/include/nimble/nimble_port.h" +# else +# include "os/os_mbuf.h" +# include "nimble/nimble_port.h" # endif # include # include diff --git a/src/NimBLEStream.h b/src/NimBLEStream.h index 28d3d467..47ccb83d 100644 --- a/src/NimBLEStream.h +++ b/src/NimBLEStream.h @@ -21,10 +21,10 @@ #include "syscfg/syscfg.h" #if CONFIG_BT_NIMBLE_ENABLED && (MYNEWT_VAL(BLE_ROLE_PERIPHERAL) || MYNEWT_VAL(BLE_ROLE_CENTRAL)) -# if defined(CONFIG_NIMBLE_CPP_IDF) -# include "nimble/nimble_npl.h" -# else +# ifdef USING_NIMBLE_ARDUINO_HEADERS # include "nimble/nimble/include/nimble/nimble_npl.h" +# else +# include "nimble/nimble_npl.h" # endif # include diff --git a/src/NimBLEUUID.h b/src/NimBLEUUID.h index 50ab5a66..10844f84 100644 --- a/src/NimBLEUUID.h +++ b/src/NimBLEUUID.h @@ -21,10 +21,10 @@ #include "syscfg/syscfg.h" #if CONFIG_BT_NIMBLE_ENABLED -# if defined(CONFIG_NIMBLE_CPP_IDF) -# include "host/ble_uuid.h" -# else +# ifdef USING_NIMBLE_ARDUINO_HEADERS # include "nimble/nimble/host/include/host/ble_uuid.h" +# else +# include "host/ble_uuid.h" # endif /**** FIX COMPILATION ****/ @@ -65,7 +65,7 @@ class NimBLEUUID { bool operator==(const NimBLEUUID& rhs) const; bool operator!=(const NimBLEUUID& rhs) const; - operator std::string() const; + operator std::string() const; private: ble_uuid_any_t m_uuid{}; diff --git a/src/NimBLEUtils.cpp b/src/NimBLEUtils.cpp index 1156eb88..75969a59 100644 --- a/src/NimBLEUtils.cpp +++ b/src/NimBLEUtils.cpp @@ -21,10 +21,10 @@ # include "NimBLEAddress.h" # include "NimBLELog.h" -# if defined(CONFIG_NIMBLE_CPP_IDF) -# include "host/ble_hs.h" -# else +#ifdef USING_NIMBLE_ARDUINO_HEADERS # include "nimble/nimble/host/include/host/ble_hs.h" +#else +# include "host/ble_hs.h" # endif /**** FIX COMPILATION ****/ diff --git a/src/nimconfig.h b/src/nimconfig.h index 40ed0e64..c38ee035 100644 --- a/src/nimconfig.h +++ b/src/nimconfig.h @@ -225,4 +225,7 @@ # define CONFIG_BT_CONTROLLER_ENABLED (1) #endif +// Indicate that NimBLE Arduino headers are being used, +// allows for drop-in compatibility with the esp-nimble-cpp library where it is not defined. +#define USING_NIMBLE_ARDUINO_HEADERS (1) #endif // NIMCONFIG_H