Skip to content

Commit 76ff374

Browse files
committed
Fix builds when exluding roles
1 parent 84b79fd commit 76ff374

Some content is hidden

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

59 files changed

+298
-281
lines changed

src/NimBLE2904.cpp

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,8 @@
1515
* limitations under the License.
1616
*/
1717

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

2321
NimBLE2904::NimBLE2904(NimBLECharacteristic* pChr)
2422
: NimBLEDescriptor(NimBLEUUID((uint16_t)0x2904), BLE_GATT_CHR_F_READ, sizeof(NimBLE2904Data), pChr) {
@@ -71,4 +69,4 @@ void NimBLE2904::setUnit(uint16_t unit) {
7169
setValue(m_data);
7270
} // setUnit
7371

74-
#endif /* CONFIG_BT_ENABLED && CONFIG_BT_NIMBLE_ROLE_PERIPHERAL */
72+
#endif // CONFIG_BT_ENABLED && CONFIG_BT_NIMBLE_ROLE_PERIPHERAL

src/NimBLE2904.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
#define NIMBLE_CPP_2904_H_
2020

2121
#include "nimconfig.h"
22-
#if defined(CONFIG_BT_ENABLED) && defined(CONFIG_BT_NIMBLE_ROLE_PERIPHERAL)
22+
#if CONFIG_BT_ENABLED && CONFIG_BT_NIMBLE_ROLE_PERIPHERAL
2323

2424
# include "NimBLEDescriptor.h"
2525

src/NimBLEAddress.cpp

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,9 @@
1515
* limitations under the License.
1616
*/
1717

18-
#include "nimconfig.h"
19-
#if defined(CONFIG_BT_ENABLED)
18+
#include "NimBLEAddress.h"
19+
#if CONFIG_BT_ENABLED
2020

21-
# include "NimBLEAddress.h"
2221
# include "NimBLELog.h"
2322

2423
# include <algorithm>
@@ -224,11 +223,16 @@ NimBLEAddress::operator std::string() const {
224223
snprintf(buffer,
225224
sizeof(buffer),
226225
NIMBLE_CPP_ADDR_FMT,
227-
this->val[5], NIMBLE_CPP_ADDR_DELIMITER,
228-
this->val[4], NIMBLE_CPP_ADDR_DELIMITER,
229-
this->val[3], NIMBLE_CPP_ADDR_DELIMITER,
230-
this->val[2], NIMBLE_CPP_ADDR_DELIMITER,
231-
this->val[1], NIMBLE_CPP_ADDR_DELIMITER,
226+
this->val[5],
227+
NIMBLE_CPP_ADDR_DELIMITER,
228+
this->val[4],
229+
NIMBLE_CPP_ADDR_DELIMITER,
230+
this->val[3],
231+
NIMBLE_CPP_ADDR_DELIMITER,
232+
this->val[2],
233+
NIMBLE_CPP_ADDR_DELIMITER,
234+
this->val[1],
235+
NIMBLE_CPP_ADDR_DELIMITER,
232236
this->val[0]);
233237
return std::string{buffer};
234238
} // operator std::string

src/NimBLEAddress.h

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,9 @@
1717

1818
#ifndef NIMBLE_CPP_ADDRESS_H_
1919
#define NIMBLE_CPP_ADDRESS_H_
20+
2021
#include "nimconfig.h"
21-
#if defined(CONFIG_BT_ENABLED)
22+
#if CONFIG_BT_ENABLED
2223

2324
# if defined(CONFIG_NIMBLE_CPP_IDF)
2425
# include "nimble/ble.h"
@@ -66,5 +67,5 @@ class NimBLEAddress : private ble_addr_t {
6667
operator uint64_t() const;
6768
};
6869

69-
#endif /* CONFIG_BT_ENABLED */
70-
#endif /* NIMBLE_CPP_ADDRESS_H_ */
70+
#endif // CONFIG_BT_ENABLED
71+
#endif // NIMBLE_CPP_ADDRESS_H_

src/NimBLEAdvertisedDevice.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,10 @@
1515
* limitations under the License.
1616
*/
1717

18-
#include "nimconfig.h"
19-
#if defined(CONFIG_BT_ENABLED) && defined(CONFIG_BT_NIMBLE_ROLE_OBSERVER)
18+
#include "NimBLEAdvertisedDevice.h"
19+
#if CONFIG_BT_ENABLED && CONFIG_BT_NIMBLE_ROLE_OBSERVER
2020

2121
# include "NimBLEDevice.h"
22-
# include "NimBLEAdvertisedDevice.h"
2322
# include "NimBLEUtils.h"
2423
# include "NimBLELog.h"
2524

@@ -814,4 +813,4 @@ const std::vector<uint8_t>::const_iterator NimBLEAdvertisedDevice::end() const {
814813
return m_payload.cend();
815814
}
816815

817-
#endif /* CONFIG_BT_ENABLED && CONFIG_BT_NIMBLE_ROLE_CENTRAL */
816+
#endif // CONFIG_BT_ENABLED && CONFIG_BT_NIMBLE_ROLE_OBSERVER

src/NimBLEAdvertisedDevice.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
#define NIMBLE_CPP_ADVERTISED_DEVICE_H_
2020

2121
#include "nimconfig.h"
22-
#if defined(CONFIG_BT_ENABLED) && defined(CONFIG_BT_NIMBLE_ROLE_OBSERVER)
22+
#if CONFIG_BT_ENABLED && CONFIG_BT_NIMBLE_ROLE_OBSERVER
2323

2424
# include "NimBLEAddress.h"
2525
# include "NimBLEScan.h"

src/NimBLEAdvertisementData.cpp

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,9 @@
1515
* limitations under the License.
1616
*/
1717

18-
#include "nimconfig.h"
19-
#if (defined(CONFIG_BT_ENABLED) && defined(CONFIG_BT_NIMBLE_ROLE_BROADCASTER) && !CONFIG_BT_NIMBLE_EXT_ADV) || \
20-
defined(_DOXYGEN_)
18+
#include "NimBLEAdvertisementData.h"
19+
#if (CONFIG_BT_ENABLED && CONFIG_BT_NIMBLE_ROLE_BROADCASTER && !CONFIG_BT_NIMBLE_EXT_ADV) || defined(_DOXYGEN_)
2120

22-
# include "NimBLEAdvertisementData.h"
2321
# include "NimBLEDevice.h"
2422
# include "NimBLEUtils.h"
2523
# include "NimBLEUUID.h"
@@ -585,4 +583,4 @@ std::string NimBLEAdvertisementData::toString() const {
585583
return str;
586584
} // toString
587585

588-
#endif // CONFIG_BT_ENABLED && CONFIG_BT_NIMBLE_ROLE_BROADCASTER && !CONFIG_BT_NIMBLE_EXT_ADV
586+
#endif // (CONFIG_BT_ENABLED && CONFIG_BT_NIMBLE_ROLE_BROADCASTER && !CONFIG_BT_NIMBLE_EXT_ADV) || defined(_DOXYGEN_)

src/NimBLEAdvertisementData.h

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,7 @@
1919
#define NIMBLE_CPP_ADVERTISEMENT_DATA_H_
2020

2121
#include "nimconfig.h"
22-
#if (defined(CONFIG_BT_ENABLED) && defined(CONFIG_BT_NIMBLE_ROLE_BROADCASTER) && !CONFIG_BT_NIMBLE_EXT_ADV) || \
23-
defined(_DOXYGEN_)
22+
#if (CONFIG_BT_ENABLED && CONFIG_BT_NIMBLE_ROLE_BROADCASTER && !CONFIG_BT_NIMBLE_EXT_ADV) || defined(_DOXYGEN_)
2423

2524
# include <cstdint>
2625
# include <string>
@@ -75,5 +74,5 @@ class NimBLEAdvertisementData {
7574
std::vector<uint8_t> m_payload{};
7675
}; // NimBLEAdvertisementData
7776

78-
#endif // CONFIG_BT_ENABLED && CONFIG_BT_NIMBLE_ROLE_BROADCASTER && !CONFIG_BT_NIMBLE_EXT_ADV
77+
#endif // (CONFIG_BT_ENABLED && CONFIG_BT_NIMBLE_ROLE_BROADCASTER && !CONFIG_BT_NIMBLE_EXT_ADV) || defined(_DOXYGEN_)
7978
#endif // NIMBLE_CPP_ADVERTISEMENT_DATA_H_

src/NimBLEAdvertising.cpp

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,14 @@
1515
* limitations under the License.
1616
*/
1717

18-
#include "nimconfig.h"
19-
#if (defined(CONFIG_BT_ENABLED) && defined(CONFIG_BT_NIMBLE_ROLE_BROADCASTER) && !CONFIG_BT_NIMBLE_EXT_ADV) || \
20-
defined(_DOXYGEN_)
18+
#include "NimBLEAdvertising.h"
19+
#if (CONFIG_BT_ENABLED && CONFIG_BT_NIMBLE_ROLE_BROADCASTER && !CONFIG_BT_NIMBLE_EXT_ADV) || defined(_DOXYGEN_)
2120

2221
# if defined(CONFIG_NIMBLE_CPP_IDF)
2322
# include "services/gap/ble_svc_gap.h"
2423
# else
2524
# include "nimble/nimble/host/services/gap/include/services/gap/ble_svc_gap.h"
2625
# endif
27-
# include "NimBLEAdvertising.h"
2826
# include "NimBLEDevice.h"
2927
# include "NimBLEServer.h"
3028
# include "NimBLEUtils.h"
@@ -44,7 +42,7 @@ NimBLEAdvertising::NimBLEAdvertising()
4442
m_duration{BLE_HS_FOREVER},
4543
m_scanResp{false},
4644
m_advDataSet{false} {
47-
# if !defined(CONFIG_BT_NIMBLE_ROLE_PERIPHERAL)
45+
# if !CONFIG_BT_NIMBLE_ROLE_PERIPHERAL
4846
m_advParams.conn_mode = BLE_GAP_CONN_MODE_NON;
4947
# else
5048
m_advParams.conn_mode = BLE_GAP_CONN_MODE_UND;
@@ -197,7 +195,7 @@ bool NimBLEAdvertising::start(uint32_t duration, const NimBLEAddress* dirAddr) {
197195
return true;
198196
}
199197

200-
# if defined(CONFIG_BT_NIMBLE_ROLE_PERIPHERAL)
198+
# if CONFIG_BT_NIMBLE_ROLE_PERIPHERAL
201199
NimBLEServer* pServer = NimBLEDevice::getServer();
202200
if (pServer != nullptr) {
203201
pServer->start(); // make sure the GATT server is ready before advertising
@@ -222,7 +220,7 @@ bool NimBLEAdvertising::start(uint32_t duration, const NimBLEAddress* dirAddr) {
222220
duration = BLE_HS_FOREVER;
223221
}
224222

225-
# if defined(CONFIG_BT_NIMBLE_ROLE_PERIPHERAL)
223+
# if CONFIG_BT_NIMBLE_ROLE_PERIPHERAL
226224
int rc = ble_gap_adv_start(NimBLEDevice::m_ownAddrType,
227225
(dirAddr != nullptr) ? dirAddr->getBase() : NULL,
228226
duration,
@@ -622,4 +620,4 @@ bool NimBLEAdvertising::setServiceData(const NimBLEUUID& uuid, const std::string
622620
return setServiceData(uuid, reinterpret_cast<const uint8_t*>(data.data()), data.length());
623621
} // setServiceData
624622

625-
#endif /* CONFIG_BT_ENABLED && CONFIG_BT_NIMBLE_ROLE_BROADCASTER && !CONFIG_BT_NIMBLE_EXT_ADV */
623+
#endif // (CONFIG_BT_ENABLED && CONFIG_BT_NIMBLE_ROLE_BROADCASTER && !CONFIG_BT_NIMBLE_EXT_ADV) || defined(_DOXYGEN_)

src/NimBLEAdvertising.h

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,7 @@
1919
#define NIMBLE_CPP_ADVERTISING_H_
2020

2121
#include "nimconfig.h"
22-
#if (defined(CONFIG_BT_ENABLED) && defined(CONFIG_BT_NIMBLE_ROLE_BROADCASTER) && !CONFIG_BT_NIMBLE_EXT_ADV) || \
23-
defined(_DOXYGEN_)
22+
#if (CONFIG_BT_ENABLED && CONFIG_BT_NIMBLE_ROLE_BROADCASTER && !CONFIG_BT_NIMBLE_EXT_ADV) || defined(_DOXYGEN_)
2423

2524
# if defined(CONFIG_NIMBLE_CPP_IDF)
2625
# include "host/ble_gap.h"
@@ -106,5 +105,5 @@ class NimBLEAdvertising {
106105
bool m_advDataSet : 1;
107106
};
108107

109-
#endif /* CONFIG_BT_ENABLED && CONFIG_BT_NIMBLE_ROLE_BROADCASTER && !CONFIG_BT_NIMBLE_EXT_ADV */
110-
#endif /* NIMBLE_CPP_ADVERTISING_H_ */
108+
#endif // (CONFIG_BT_ENABLED && CONFIG_BT_NIMBLE_ROLE_BROADCASTER && !CONFIG_BT_NIMBLE_EXT_ADV) || defined(_DOXYGEN_)
109+
#endif // NIMBLE_CPP_ADVERTISING_H_

0 commit comments

Comments
 (0)