Skip to content

Commit ac2bf13

Browse files
committed
Add a flag to to use arduino header paths - fixes PIO builds
1 parent dd32365 commit ac2bf13

28 files changed

Lines changed: 107 additions & 110 deletions

Kconfig

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -204,8 +204,4 @@ config NIMBLE_CPP_FREERTOS_TASK_BLOCK_BIT
204204
Configure the bit to set in the task notification value when a task is blocked waiting for an event.
205205
This should be set to a bit that is not used by other notifications in the system.
206206

207-
config NIMBLE_CPP_IDF
208-
bool
209-
default BT_NIMBLE_ENABLED
210-
211207
endmenu

src/NimBLEAddress.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,10 @@
2121
#include "syscfg/syscfg.h"
2222
#if CONFIG_BT_NIMBLE_ENABLED
2323

24-
# if defined(CONFIG_NIMBLE_CPP_IDF)
25-
# include "nimble/ble.h"
26-
# else
24+
# ifdef USING_NIMBLE_ARDUINO_HEADERS
2725
# include "nimble/nimble/include/nimble/ble.h"
26+
# else
27+
# include "nimble/ble.h"
2828
# endif
2929

3030
/**** FIX COMPILATION ****/
@@ -63,8 +63,8 @@ class NimBLEAddress : private ble_addr_t {
6363
const NimBLEAddress& reverseByteOrder();
6464
bool operator==(const NimBLEAddress& rhs) const;
6565
bool operator!=(const NimBLEAddress& rhs) const;
66-
operator std::string() const;
67-
operator uint64_t() const;
66+
operator std::string() const;
67+
operator uint64_t() const;
6868
};
6969

7070
#endif // CONFIG_BT_NIMBLE_ENABLED

src/NimBLEAdvertisedDevice.h

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,12 @@
2525
# include "NimBLEScan.h"
2626
# include "NimBLEUUID.h"
2727

28-
# if defined(CONFIG_NIMBLE_CPP_IDF)
29-
# include "host/ble_hs_adv.h"
30-
# include "host/ble_gap.h"
31-
# else
28+
# ifdef USING_NIMBLE_ARDUINO_HEADERS
3229
# include "nimble/nimble/host/include/host/ble_hs_adv.h"
3330
# include "nimble/nimble/host/include/host/ble_gap.h"
31+
# else
32+
# include "host/ble_hs_adv.h"
33+
# include "host/ble_gap.h"
3434
# endif
3535

3636
# include <vector>
@@ -158,13 +158,13 @@ class NimBLEAdvertisedDevice {
158158
uint8_t findAdvField(uint8_t type, uint8_t index = 0, size_t* data_loc = nullptr) const;
159159
size_t findServiceData(uint8_t index, uint8_t* bytes) const;
160160

161-
NimBLEAddress m_address{};
162-
uint8_t m_advType{};
163-
int8_t m_rssi{};
164-
uint8_t m_callbackSent{};
165-
uint16_t m_advLength{};
166-
ble_npl_time_t m_time{};
167-
NimBLEAdvertisedDevice* m_pNextWaiting{}; // intrusive list node; self-pointer means "not in list", set in ctor
161+
NimBLEAddress m_address{};
162+
uint8_t m_advType{};
163+
int8_t m_rssi{};
164+
uint8_t m_callbackSent{};
165+
uint16_t m_advLength{};
166+
ble_npl_time_t m_time{};
167+
NimBLEAdvertisedDevice* m_pNextWaiting{}; // intrusive list node; self-pointer means "not in list", set in ctor
168168

169169
# if MYNEWT_VAL(BLE_EXT_ADV)
170170
bool m_isLegacyAdv{};

src/NimBLEAdvertisementData.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,10 @@
2323
# include "NimBLEUUID.h"
2424
# include "NimBLELog.h"
2525

26-
# if defined(CONFIG_NIMBLE_CPP_IDF)
27-
# include "host/ble_hs_adv.h"
28-
# else
26+
#ifdef USING_NIMBLE_ARDUINO_HEADERS
2927
# include "nimble/nimble/host/include/host/ble_hs_adv.h"
28+
# else
29+
# include "host/ble_hs_adv.h"
3030
# endif
3131

3232
static const char* LOG_TAG = "NimBLEAdvertisementData";

src/NimBLEAdvertising.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,12 @@
1818
#include "NimBLEAdvertising.h"
1919
#if (CONFIG_BT_NIMBLE_ENABLED && MYNEWT_VAL(BLE_ROLE_BROADCASTER) && !MYNEWT_VAL(BLE_EXT_ADV)) || defined(_DOXYGEN_)
2020

21-
# if defined(CONFIG_NIMBLE_CPP_IDF)
22-
# include "services/gap/ble_svc_gap.h"
23-
# else
21+
#ifdef USING_NIMBLE_ARDUINO_HEADERS
2422
# include "nimble/nimble/host/services/gap/include/services/gap/ble_svc_gap.h"
23+
# else
24+
# include "services/gap/ble_svc_gap.h"
2525
# endif
26+
2627
# include "NimBLEDevice.h"
2728
# include "NimBLEServer.h"
2829
# include "NimBLEUtils.h"

src/NimBLEAdvertising.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,10 @@
2121
#include "syscfg/syscfg.h"
2222
#if (CONFIG_BT_NIMBLE_ENABLED && MYNEWT_VAL(BLE_ROLE_BROADCASTER) && !MYNEWT_VAL(BLE_EXT_ADV)) || defined(_DOXYGEN_)
2323

24-
# if defined(CONFIG_NIMBLE_CPP_IDF)
25-
# include "host/ble_gap.h"
26-
# else
24+
#ifdef USING_NIMBLE_ARDUINO_HEADERS
2725
# include "nimble/nimble/host/include/host/ble_gap.h"
26+
# else
27+
# include "host/ble_gap.h"
2828
# endif
2929

3030
/**** FIX COMPILATION ****/

src/NimBLEAttValue.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,10 @@
1818
#include "NimBLEAttValue.h"
1919
#if CONFIG_BT_NIMBLE_ENABLED
2020

21-
# if defined(CONFIG_NIMBLE_CPP_IDF)
22-
# include "nimble/nimble_npl.h"
23-
# else
21+
# ifdef USING_NIMBLE_ARDUINO_HEADERS
2422
# include "nimble/nimble/include/nimble/nimble_npl.h"
23+
# else
24+
# include "nimble/nimble_npl.h"
2525
# endif
2626

2727
# include "NimBLEUtils.h"

src/NimBLECharacteristic.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
#include "NimBLECharacteristic.h"
1919
#if CONFIG_BT_NIMBLE_ENABLED && MYNEWT_VAL(BLE_ROLE_PERIPHERAL)
2020

21-
# if defined(CONFIG_NIMBLE_CPP_IDF)
21+
# ifndef USING_NIMBLE_ARDUINO_HEADERS
2222
# if !defined(ESP_IDF_VERSION_MAJOR) || ESP_IDF_VERSION_MAJOR < 5
2323
# define ble_gatts_notify_custom ble_gattc_notify_custom
2424
# define ble_gatts_indicate_custom ble_gattc_indicate_custom

src/NimBLEClient.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,10 @@
2323
# include "NimBLEDevice.h"
2424
# include "NimBLELog.h"
2525

26-
# if defined(CONFIG_NIMBLE_CPP_IDF)
27-
# include "nimble/nimble_port.h"
28-
# else
26+
# ifdef USING_NIMBLE_ARDUINO_HEADERS
2927
# include "nimble/porting/nimble/include/nimble/nimble_port.h"
28+
# else
29+
# include "nimble/nimble_port.h"
3030
# endif
3131

3232
# include <climits>
@@ -550,7 +550,7 @@ bool NimBLEClient::updateConnParams(uint16_t minInterval, uint16_t maxInterval,
550550
* @param [in] txOctets The preferred number of payload octets to use (Range 0x001B-0x00FB).
551551
*/
552552
bool NimBLEClient::setDataLen(uint16_t txOctets) {
553-
# if defined(CONFIG_NIMBLE_CPP_IDF) && !defined(ESP_IDF_VERSION) || \
553+
# if !defined(USING_NIMBLE_ARDUINO_HEADERS) && !defined(ESP_IDF_VERSION) || \
554554
(ESP_IDF_VERSION_MAJOR * 100 + ESP_IDF_VERSION_MINOR * 10 + ESP_IDF_VERSION_PATCH) < 432
555555
return false;
556556
# else

src/NimBLEClient.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,10 @@
2121
#include "syscfg/syscfg.h"
2222
#if CONFIG_BT_NIMBLE_ENABLED && MYNEWT_VAL(BLE_ROLE_CENTRAL)
2323

24-
# if defined(CONFIG_NIMBLE_CPP_IDF)
25-
# include "host/ble_gap.h"
26-
# else
24+
# ifdef USING_NIMBLE_ARDUINO_HEADERS
2725
# include "nimble/nimble/host/include/host/ble_gap.h"
26+
# else
27+
# include "host/ble_gap.h"
2828
# endif
2929

3030
# include "NimBLEAddress.h"
@@ -118,7 +118,7 @@ class NimBLEClient {
118118
* - deleteOnConnectFail: false
119119
* - asyncConnect: false
120120
* - exchangeMTU: true
121-
* - connectFailRetries: 2
121+
* - connectFailRetries: 2
122122
*/
123123
Config()
124124
: deleteCallbacks(0),

0 commit comments

Comments
 (0)