Skip to content

Commit 933c55c

Browse files
committed
Refactor include directives to correct paths for arduino/idf.
1 parent e238a18 commit 933c55c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+177
-185
lines changed

src/NimBLE2904.cpp

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,8 @@
1616
* See also:
1717
* https://www.bluetooth.com/specifications/gatt/viewer?attributeXmlFile=org.bluetooth.descriptor.gatt.characteristic_presentation_format.xml
1818
*/
19-
#include "sdkconfig.h"
20-
#if defined(CONFIG_BT_ENABLED)
21-
2219
#include "nimconfig.h"
23-
#if defined(CONFIG_BT_NIMBLE_ROLE_PERIPHERAL)
20+
#if defined(CONFIG_BT_ENABLED) && defined(CONFIG_BT_NIMBLE_ROLE_PERIPHERAL)
2421

2522
#include "NimBLE2904.h"
2623

@@ -86,5 +83,4 @@ void NimBLE2904::setUnit(uint16_t unit) {
8683
setValue((uint8_t*) &m_data, sizeof(m_data));
8784
} // setUnit
8885

89-
#endif // #if defined(CONFIG_BT_NIMBLE_ROLE_PERIPHERAL)
90-
#endif
86+
#endif /* CONFIG_BT_ENABLED && CONFIG_BT_NIMBLE_ROLE_PERIPHERAL */

src/NimBLE2904.h

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,8 @@
1414

1515
#ifndef MAIN_NIMBLE2904_H_
1616
#define MAIN_NIMBLE2904_H_
17-
#include "sdkconfig.h"
18-
#if defined(CONFIG_BT_ENABLED)
19-
2017
#include "nimconfig.h"
21-
#if defined(CONFIG_BT_NIMBLE_ROLE_PERIPHERAL)
18+
#if defined(CONFIG_BT_ENABLED) && defined(CONFIG_BT_NIMBLE_ROLE_PERIPHERAL)
2219

2320
#include "NimBLEDescriptor.h"
2421

@@ -82,6 +79,5 @@ class NimBLE2904: public NimBLEDescriptor {
8279
BLE2904_Data m_data;
8380
}; // BLE2904
8481

85-
#endif // #if defined(CONFIG_BT_NIMBLE_ROLE_PERIPHERAL)
86-
#endif /* CONFIG_BT_ENABLED */
82+
#endif /* CONFIG_BT_ENABLED && CONFIG_BT_NIMBLE_ROLE_PERIPHERAL */
8783
#endif /* MAIN_NIMBLE2904_H_ */

src/NimBLEAddress.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
* Created on: Jul 2, 2017
1212
* Author: kolban
1313
*/
14-
#include "sdkconfig.h"
14+
#include "nimconfig.h"
1515
#if defined(CONFIG_BT_ENABLED)
1616

1717
#include <algorithm>

src/NimBLEAddress.h

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,15 @@
1414

1515
#ifndef COMPONENTS_NIMBLEADDRESS_H_
1616
#define COMPONENTS_NIMBLEADDRESS_H_
17-
#include "sdkconfig.h"
17+
#include "nimconfig.h"
1818
#if defined(CONFIG_BT_ENABLED)
1919

20+
#if defined(CONFIG_NIMBLE_CPP_IDF)
2021
#include "nimble/ble.h"
22+
#else
23+
#include "nimble/nimble/include/nimble/ble.h"
24+
#endif
25+
2126
/**** FIX COMPILATION ****/
2227
#undef min
2328
#undef max

src/NimBLEAdvertisedDevice.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,17 +14,18 @@
1414

1515
#ifndef COMPONENTS_NIMBLEADVERTISEDDEVICE_H_
1616
#define COMPONENTS_NIMBLEADVERTISEDDEVICE_H_
17-
#include "sdkconfig.h"
18-
#if defined(CONFIG_BT_ENABLED)
19-
2017
#include "nimconfig.h"
21-
#if defined(CONFIG_BT_NIMBLE_ROLE_OBSERVER)
18+
#if defined(CONFIG_BT_ENABLED) && defined(CONFIG_BT_NIMBLE_ROLE_OBSERVER)
2219

2320
#include "NimBLEAddress.h"
2421
#include "NimBLEScan.h"
2522
#include "NimBLEUUID.h"
2623

24+
#if defined(CONFIG_NIMBLE_CPP_IDF)
2725
#include "host/ble_hs_adv.h"
26+
#else
27+
#include "nimble/nimble/host/include/host/ble_hs_adv.h"
28+
#endif
2829

2930
#include <map>
3031
#include <vector>
@@ -171,6 +172,5 @@ class NimBLEAdvertisedDeviceCallbacks {
171172
virtual void onResult(NimBLEAdvertisedDevice* advertisedDevice) = 0;
172173
};
173174

174-
#endif // #if defined( CONFIG_BT_NIMBLE_ROLE_CENTRAL)
175-
#endif /* CONFIG_BT_ENABLED */
175+
#endif /* CONFIG_BT_ENABLED && CONFIG_BT_NIMBLE_ROLE_OBSERVER */
176176
#endif /* COMPONENTS_NIMBLEADVERTISEDDEVICE_H_ */

src/NimBLEAdvertising.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,14 @@
1313
* Author: kolban
1414
*
1515
*/
16-
#include "sdkconfig.h"
17-
#if defined(CONFIG_BT_ENABLED)
18-
1916
#include "nimconfig.h"
20-
#if defined(CONFIG_BT_NIMBLE_ROLE_BROADCASTER)
17+
#if defined(CONFIG_BT_ENABLED) && defined(CONFIG_BT_NIMBLE_ROLE_BROADCASTER)
2118

19+
#if defined(CONFIG_NIMBLE_CPP_IDF)
2220
#include "services/gap/ble_svc_gap.h"
21+
#else
22+
#include "nimble/nimble/host/services/gap/include/services/gap/ble_svc_gap.h"
23+
#endif
2324
#include "NimBLEAdvertising.h"
2425
#include "NimBLEDevice.h"
2526
#include "NimBLEServer.h"
@@ -1028,5 +1029,4 @@ std::string NimBLEAdvertisementData::getPayload() {
10281029
return m_payload;
10291030
} // getPayload
10301031

1031-
#endif // #if defined(CONFIG_BT_NIMBLE_ROLE_PERIPHERAL)
1032-
#endif /* CONFIG_BT_ENABLED */
1032+
#endif /* CONFIG_BT_ENABLED && CONFIG_BT_NIMBLE_ROLE_BROADCASTER */

src/NimBLEAdvertising.h

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,15 @@
1414

1515
#ifndef MAIN_BLEADVERTISING_H_
1616
#define MAIN_BLEADVERTISING_H_
17-
#include "sdkconfig.h"
18-
#if defined(CONFIG_BT_ENABLED)
19-
2017
#include "nimconfig.h"
21-
#if defined(CONFIG_BT_NIMBLE_ROLE_BROADCASTER)
18+
#if defined(CONFIG_BT_ENABLED) && defined(CONFIG_BT_NIMBLE_ROLE_BROADCASTER)
2219

20+
#if defined(CONFIG_NIMBLE_CPP_IDF)
2321
#include "host/ble_gap.h"
22+
#else
23+
#include "nimble/nimble/host/include/host/ble_gap.h"
24+
#endif
25+
2426
/**** FIX COMPILATION ****/
2527
#undef min
2628
#undef max
@@ -132,6 +134,5 @@ class NimBLEAdvertising {
132134
std::vector<uint8_t> m_uri;
133135
};
134136

135-
#endif // #if defined(CONFIG_BT_NIMBLE_ROLE_PERIPHERAL)
136-
#endif /* CONFIG_BT_ENABLED */
137+
#endif /* CONFIG_BT_ENABLED && CONFIG_BT_NIMBLE_ROLE_BROADCASTER */
137138
#endif /* MAIN_BLEADVERTISING_H_ */

src/NimBLEBeacon.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
* Created on: Jan 4, 2018
1212
* Author: kolban
1313
*/
14-
#include "sdkconfig.h"
14+
#include "nimconfig.h"
1515
#if defined(CONFIG_BT_ENABLED)
1616

1717
#include <string.h>

src/NimBLECharacteristic.cpp

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,9 @@
99
* Created on: Jun 22, 2017
1010
* Author: kolban
1111
*/
12-
#include "sdkconfig.h"
13-
#if defined(CONFIG_BT_ENABLED)
1412

1513
#include "nimconfig.h"
16-
#if defined(CONFIG_BT_NIMBLE_ROLE_PERIPHERAL)
14+
#if defined(CONFIG_BT_ENABLED) && defined(CONFIG_BT_NIMBLE_ROLE_PERIPHERAL)
1715

1816
#include "NimBLECharacteristic.h"
1917
#include "NimBLE2904.h"
@@ -641,6 +639,4 @@ void NimBLECharacteristicCallbacks::onSubscribe(NimBLECharacteristic* pCharacter
641639
NIMBLE_LOGD("NimBLECharacteristicCallbacks", "onSubscribe: default");
642640
}
643641

644-
645-
#endif // #if defined(CONFIG_BT_NIMBLE_ROLE_PERIPHERAL)
646-
#endif /* CONFIG_BT_ENABLED */
642+
#endif /* CONFIG_BT_ENABLED && CONFIG_BT_NIMBLE_ROLE_PERIPHERAL */

src/NimBLECharacteristic.h

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,15 @@
1313

1414
#ifndef MAIN_NIMBLECHARACTERISTIC_H_
1515
#define MAIN_NIMBLECHARACTERISTIC_H_
16-
#include "sdkconfig.h"
17-
#if defined(CONFIG_BT_ENABLED)
18-
1916
#include "nimconfig.h"
20-
#if defined(CONFIG_BT_NIMBLE_ROLE_PERIPHERAL)
17+
#if defined(CONFIG_BT_ENABLED) && defined(CONFIG_BT_NIMBLE_ROLE_PERIPHERAL)
2118

19+
#if defined(CONFIG_NIMBLE_CPP_IDF)
2220
#include "host/ble_hs.h"
21+
#else
22+
#include "nimble/nimble/host/include/host/ble_hs.h"
23+
#endif
24+
2325
/**** FIX COMPILATION ****/
2426
#undef min
2527
#undef max
@@ -195,6 +197,5 @@ class NimBLECharacteristicCallbacks {
195197
virtual void onSubscribe(NimBLECharacteristic* pCharacteristic, ble_gap_conn_desc* desc, uint16_t subValue);
196198
};
197199

198-
#endif // #if defined(CONFIG_BT_NIMBLE_ROLE_PERIPHERAL)
199-
#endif /* CONFIG_BT_ENABLED */
200+
#endif /* CONFIG_BT_ENABLED && CONFIG_BT_NIMBLE_ROLE_PERIPHERAL */
200201
#endif /*MAIN_NIMBLECHARACTERISTIC_H_*/

src/NimBLEClient.cpp

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,8 @@
1111
* Author: kolban
1212
*/
1313

14-
#include "sdkconfig.h"
15-
#if defined(CONFIG_BT_ENABLED)
16-
1714
#include "nimconfig.h"
18-
#if defined( CONFIG_BT_NIMBLE_ROLE_CENTRAL)
15+
#if defined(CONFIG_BT_ENABLED) && defined(CONFIG_BT_NIMBLE_ROLE_CENTRAL)
1916

2017
#include "NimBLEClient.h"
2118
#include "NimBLEDevice.h"
@@ -24,8 +21,11 @@
2421
#include <string>
2522
#include <unordered_set>
2623

24+
#if defined(CONFIG_NIMBLE_CPP_IDF)
2725
#include "nimble/nimble_port.h"
28-
26+
#else
27+
#include "nimble/porting/nimble/include/nimble/nimble_port.h"
28+
#endif
2929

3030
static const char* LOG_TAG = "NimBLEClient";
3131
static NimBLEClientCallbacks defaultCallbacks;
@@ -1170,5 +1170,4 @@ bool NimBLEClientCallbacks::onConfirmPIN(uint32_t pin){
11701170
return true;
11711171
}
11721172

1173-
#endif // #if defined( CONFIG_BT_NIMBLE_ROLE_CENTRAL)
1174-
#endif // CONFIG_BT_ENABLED
1173+
#endif /* CONFIG_BT_ENABLED && CONFIG_BT_NIMBLE_ROLE_CENTRAL */

src/NimBLEClient.h

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,8 @@
1414
#ifndef MAIN_NIMBLECLIENT_H_
1515
#define MAIN_NIMBLECLIENT_H_
1616

17-
#include "sdkconfig.h"
18-
#if defined(CONFIG_BT_ENABLED)
19-
2017
#include "nimconfig.h"
21-
#if defined(CONFIG_BT_NIMBLE_ROLE_CENTRAL)
18+
#if defined(CONFIG_BT_ENABLED) && defined(CONFIG_BT_NIMBLE_ROLE_CENTRAL)
2219

2320
#include "NimBLEAddress.h"
2421
#include "NimBLEUUID.h"
@@ -158,6 +155,5 @@ class NimBLEClientCallbacks {
158155
virtual bool onConfirmPIN(uint32_t pin);
159156
};
160157

161-
#endif // #if defined(CONFIG_BT_NIMBLE_ROLE_CENTRAL)
162-
#endif // CONFIG_BT_ENABLED
158+
#endif /* CONFIG_BT_ENABLED && CONFIG_BT_NIMBLE_ROLE_CENTRAL */
163159
#endif /* MAIN_NIMBLECLIENT_H_ */

src/NimBLEDescriptor.cpp

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,9 @@
1111
* Created on: Jun 22, 2017
1212
* Author: kolban
1313
*/
14-
#include "sdkconfig.h"
15-
#if defined(CONFIG_BT_ENABLED)
1614

1715
#include "nimconfig.h"
18-
#if defined(CONFIG_BT_NIMBLE_ROLE_PERIPHERAL)
16+
#if defined(CONFIG_BT_ENABLED) && defined(CONFIG_BT_NIMBLE_ROLE_PERIPHERAL)
1917

2018
#include "NimBLEService.h"
2119
#include "NimBLEDescriptor.h"
@@ -289,5 +287,4 @@ void NimBLEDescriptorCallbacks::onWrite(NimBLEDescriptor* pDescriptor) {
289287
NIMBLE_LOGD("NimBLEDescriptorCallbacks", "onWrite: default");
290288
} // onWrite
291289

292-
#endif // #if defined(CONFIG_BT_NIMBLE_ROLE_PERIPHERAL)
293-
#endif /* CONFIG_BT_ENABLED */
290+
#endif /* CONFIG_BT_ENABLED && CONFIG_BT_NIMBLE_ROLE_PERIPHERAL */

src/NimBLEDescriptor.h

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,9 @@
1414

1515
#ifndef MAIN_NIMBLEDESCRIPTOR_H_
1616
#define MAIN_NIMBLEDESCRIPTOR_H_
17-
#include "sdkconfig.h"
18-
#if defined(CONFIG_BT_ENABLED)
1917

2018
#include "nimconfig.h"
21-
#if defined(CONFIG_BT_NIMBLE_ROLE_PERIPHERAL)
19+
#if defined(CONFIG_BT_ENABLED) && defined(CONFIG_BT_NIMBLE_ROLE_PERIPHERAL)
2220

2321
#include "NimBLECharacteristic.h"
2422
#include "NimBLEUUID.h"
@@ -113,6 +111,5 @@ class NimBLEDescriptorCallbacks {
113111

114112
#include "NimBLE2904.h"
115113

116-
#endif // #if defined(CONFIG_BT_NIMBLE_ROLE_PERIPHERAL)
117-
#endif /* CONFIG_BT_ENABLED */
114+
#endif /* CONFIG_BT_ENABLED && CONFIG_BT_NIMBLE_ROLE_PERIPHERAL */
118115
#endif /* MAIN_NIMBLEDESCRIPTOR_H_ */

src/NimBLEDevice.cpp

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,18 @@
1111
* Created on: Mar 16, 2017
1212
* Author: kolban
1313
*/
14-
#include "sdkconfig.h"
15-
#if defined(CONFIG_BT_ENABLED)
1614

1715
#include "nimconfig.h"
16+
#if defined(CONFIG_BT_ENABLED)
17+
1818
#include "NimBLEDevice.h"
1919
#include "NimBLEUtils.h"
2020

2121
#include "esp_err.h"
2222
#include "esp_bt.h"
2323
#include "nvs_flash.h"
24+
25+
#if defined(CONFIG_NIMBLE_CPP_IDF)
2426
#include "esp_nimble_hci.h"
2527
#include "nimble/nimble_port.h"
2628
#include "nimble/nimble_port_freertos.h"
@@ -29,6 +31,16 @@
2931
#include "host/util/util.h"
3032
#include "services/gap/ble_svc_gap.h"
3133
#include "services/gatt/ble_svc_gatt.h"
34+
#else
35+
#include "nimble/esp_port/esp-hci/include/esp_nimble_hci.h"
36+
#include "nimble/porting/nimble/include/nimble/nimble_port.h"
37+
#include "nimble/porting/npl/freertos/include/nimble/nimble_port_freertos.h"
38+
#include "nimble/nimble/host/include/host/ble_hs.h"
39+
#include "nimble/nimble/host/include/host/ble_hs_pvcy.h"
40+
#include "nimble/nimble/host/util/include/host/util/util.h"
41+
#include "nimble/nimble/host/services/gap/include/services/gap/ble_svc_gap.h"
42+
#include "nimble/nimble/host/services/gatt/include/services/gatt/ble_svc_gatt.h"
43+
#endif
3244

3345
#ifdef CONFIG_ENABLE_ARDUINO_DEPENDS
3446
#include "esp32-hal-bt.h"

src/NimBLEDevice.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,9 @@
1414

1515
#ifndef MAIN_NIMBLEDEVICE_H_
1616
#define MAIN_NIMBLEDEVICE_H_
17-
#include "sdkconfig.h"
18-
#if defined(CONFIG_BT_ENABLED)
1917

2018
#include "nimconfig.h"
19+
#if defined(CONFIG_BT_ENABLED)
2120

2221
#if defined(CONFIG_BT_NIMBLE_ROLE_OBSERVER)
2322
#include "NimBLEScan.h"

src/NimBLEEddystoneTLM.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,14 @@
1111
* Created on: Mar 12, 2018
1212
* Author: pcbreflux
1313
*/
14-
#include "sdkconfig.h"
14+
15+
#include "nimconfig.h"
1516
#if defined(CONFIG_BT_ENABLED)
1617

1718
#include "NimBLEEddystoneTLM.h"
1819
#include "NimBLELog.h"
1920

21+
#include <stdio.h>
2022
#include <cstring>
2123

2224
#define ENDIAN_CHANGE_U16(x) ((((x)&0xFF00)>>8) + (((x)&0xFF)<<8))

src/NimBLEEddystoneTLM.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414

1515
#ifndef _NimBLEEddystoneTLM_H_
1616
#define _NimBLEEddystoneTLM_H_
17+
1718
#include "NimBLEUUID.h"
1819

1920
#include <string>

src/NimBLEEddystoneURL.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
* Created on: Mar 12, 2018
1212
* Author: pcbreflux
1313
*/
14-
#include "sdkconfig.h"
14+
#include "nimconfig.h"
1515
#if defined(CONFIG_BT_ENABLED)
1616

1717
#include "NimBLEEddystoneURL.h"

0 commit comments

Comments
 (0)