Skip to content

Commit ecc617f

Browse files
committed
Refactor to use MYNEWT_VAL macros.
This replaces the previously prefixed CONFIG_BT_X config macros with the underlying MYNEWT_VAL_X config macros that they affected.
1 parent 485a01b commit ecc617f

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

+291
-515
lines changed

Kconfig

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,10 @@ 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+
207211
#
208212
# BT config
209213
#

examples/NimBLE_Client/main/main.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ bool connectToServer() {
112112

113113
/** No client to reuse? Create a new one. */
114114
if (!pClient) {
115-
if (NimBLEDevice::getCreatedClientCount() >= NIMBLE_MAX_CONNECTIONS) {
115+
if (NimBLEDevice::getCreatedClientCount() >= MYNEWT_VAL(BLE_MAX_CONNECTIONS)) {
116116
printf("Max clients reached - no more connections available\n");
117117
return false;
118118
}

src/NimBLE2904.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
*/
1717

1818
#include "NimBLE2904.h"
19-
#if CONFIG_BT_ENABLED && CONFIG_BT_NIMBLE_ROLE_PERIPHERAL
19+
#if CONFIG_BT_NIMBLE_ENABLED && MYNEWT_VAL(BLE_ROLE_PERIPHERAL)
2020

2121
NimBLE2904::NimBLE2904(NimBLECharacteristic* pChr)
2222
: NimBLEDescriptor(NimBLEUUID((uint16_t)0x2904), BLE_GATT_CHR_F_READ, sizeof(NimBLE2904Data), pChr) {
@@ -69,4 +69,4 @@ void NimBLE2904::setUnit(uint16_t unit) {
6969
setValue(m_data);
7070
} // setUnit
7171

72-
#endif // CONFIG_BT_ENABLED && CONFIG_BT_NIMBLE_ROLE_PERIPHERAL
72+
#endif // CONFIG_BT_NIMBLE_ENABLED && MYNEWT_VAL(BLE_ROLE_PERIPHERAL)

src/NimBLE2904.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@
1818
#ifndef NIMBLE_CPP_2904_H_
1919
#define NIMBLE_CPP_2904_H_
2020

21-
#include "nimconfig.h"
22-
#if CONFIG_BT_ENABLED && CONFIG_BT_NIMBLE_ROLE_PERIPHERAL
21+
#include "syscfg/syscfg.h"
22+
#if CONFIG_BT_NIMBLE_ENABLED && MYNEWT_VAL(BLE_ROLE_PERIPHERAL)
2323

2424
# include "NimBLEDescriptor.h"
2525

@@ -79,5 +79,5 @@ class NimBLE2904 : public NimBLEDescriptor {
7979
NimBLE2904Data m_data{};
8080
}; // NimBLE2904
8181

82-
#endif // CONFIG_BT_ENABLED && CONFIG_BT_NIMBLE_ROLE_PERIPHERAL
82+
#endif // CONFIG_BT_NIMBLE_ENABLED && MYNEWT_VAL(BLE_ROLE_PERIPHERAL)
8383
#endif // NIMBLE_CPP_2904_H_

src/NimBLEAddress.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
*/
1717

1818
#include "NimBLEAddress.h"
19-
#if CONFIG_BT_ENABLED
19+
#if CONFIG_BT_NIMBLE_ENABLED
2020

2121
# include "NimBLELog.h"
2222

src/NimBLEAddress.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@
1818
#ifndef NIMBLE_CPP_ADDRESS_H_
1919
#define NIMBLE_CPP_ADDRESS_H_
2020

21-
#include "nimconfig.h"
22-
#if CONFIG_BT_ENABLED
21+
#include "syscfg/syscfg.h"
22+
#if CONFIG_BT_NIMBLE_ENABLED
2323

2424
# if defined(CONFIG_NIMBLE_CPP_IDF)
2525
# include "nimble/ble.h"
@@ -67,5 +67,5 @@ class NimBLEAddress : private ble_addr_t {
6767
operator uint64_t() const;
6868
};
6969

70-
#endif // CONFIG_BT_ENABLED
70+
#endif // CONFIG_BT_NIMBLE_ENABLED
7171
#endif // NIMBLE_CPP_ADDRESS_H_

src/NimBLEAdvertisedDevice.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
*/
1717

1818
#include "NimBLEAdvertisedDevice.h"
19-
#if CONFIG_BT_ENABLED && CONFIG_BT_NIMBLE_ROLE_OBSERVER
19+
#if CONFIG_BT_NIMBLE_ENABLED && MYNEWT_VAL(BLE_ROLE_OBSERVER)
2020

2121
# include "NimBLEDevice.h"
2222
# include "NimBLEUtils.h"
@@ -31,7 +31,7 @@ static const char* LOG_TAG = "NimBLEAdvertisedDevice";
3131
* @param [in] event The advertisement event data.
3232
*/
3333
NimBLEAdvertisedDevice::NimBLEAdvertisedDevice(const ble_gap_event* event, uint8_t eventType)
34-
# if CONFIG_BT_NIMBLE_EXT_ADV
34+
# if MYNEWT_VAL(BLE_EXT_ADV)
3535
: m_address{event->ext_disc.addr},
3636
m_advType{eventType},
3737
m_rssi{event->ext_disc.rssi},
@@ -58,7 +58,7 @@ NimBLEAdvertisedDevice::NimBLEAdvertisedDevice(const ble_gap_event* event, uint8
5858
* @param [in] event The advertisement event data.
5959
*/
6060
void NimBLEAdvertisedDevice::update(const ble_gap_event* event, uint8_t eventType) {
61-
# if CONFIG_BT_NIMBLE_EXT_ADV
61+
# if MYNEWT_VAL(BLE_EXT_ADV)
6262
const auto& disc = event->ext_disc;
6363
m_isLegacyAdv = disc.props & BLE_HCI_ADV_LEGACY_MASK;
6464
# else
@@ -580,7 +580,7 @@ bool NimBLEAdvertisedDevice::haveTXPower() const {
580580
return findAdvField(BLE_HS_ADV_TYPE_TX_PWR_LVL) > 0;
581581
} // haveTXPower
582582

583-
# if CONFIG_BT_NIMBLE_EXT_ADV
583+
# if MYNEWT_VAL(BLE_EXT_ADV)
584584
/**
585585
* @brief Get the set ID of the extended advertisement.
586586
* @return The set ID.
@@ -751,7 +751,7 @@ uint8_t NimBLEAdvertisedDevice::getAddressType() const {
751751
* @return True if the device is connectable.
752752
*/
753753
bool NimBLEAdvertisedDevice::isConnectable() const {
754-
# if CONFIG_BT_NIMBLE_EXT_ADV
754+
# if MYNEWT_VAL(BLE_EXT_ADV)
755755
if (m_isLegacyAdv) {
756756
return m_advType == BLE_HCI_ADV_RPT_EVTYPE_ADV_IND || m_advType == BLE_HCI_ADV_RPT_EVTYPE_DIR_IND;
757757
}
@@ -772,7 +772,7 @@ bool NimBLEAdvertisedDevice::isScannable() const {
772772
* @return True if legacy (Bluetooth 4.x), false if extended (bluetooth 5.x).
773773
*/
774774
bool NimBLEAdvertisedDevice::isLegacyAdvertisement() const {
775-
# if CONFIG_BT_NIMBLE_EXT_ADV
775+
# if MYNEWT_VAL(BLE_EXT_ADV)
776776
return m_isLegacyAdv;
777777
# else
778778
return true;
@@ -813,4 +813,4 @@ const std::vector<uint8_t>::const_iterator NimBLEAdvertisedDevice::end() const {
813813
return m_payload.cend();
814814
}
815815

816-
#endif // CONFIG_BT_ENABLED && CONFIG_BT_NIMBLE_ROLE_OBSERVER
816+
#endif // CONFIG_BT_NIMBLE_ENABLED && MYNEWT_VAL(BLE_ROLE_OBSERVER)

src/NimBLEAdvertisedDevice.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@
1818
#ifndef NIMBLE_CPP_ADVERTISED_DEVICE_H_
1919
#define NIMBLE_CPP_ADVERTISED_DEVICE_H_
2020

21-
#include "nimconfig.h"
22-
#if CONFIG_BT_ENABLED && CONFIG_BT_NIMBLE_ROLE_OBSERVER
21+
#include "syscfg/syscfg.h"
22+
#if CONFIG_BT_NIMBLE_ENABLED && MYNEWT_VAL(BLE_ROLE_OBSERVER)
2323

2424
# include "NimBLEAddress.h"
2525
# include "NimBLEScan.h"
@@ -87,7 +87,7 @@ class NimBLEAdvertisedDevice {
8787
bool isConnectable() const;
8888
bool isScannable() const;
8989
bool isLegacyAdvertisement() const;
90-
# if CONFIG_BT_NIMBLE_EXT_ADV
90+
# if MYNEWT_VAL(BLE_EXT_ADV)
9191
uint8_t getSetId() const;
9292
uint8_t getPrimaryPhy() const;
9393
uint8_t getSecondaryPhy() const;
@@ -163,7 +163,7 @@ class NimBLEAdvertisedDevice {
163163
uint8_t m_callbackSent{};
164164
uint8_t m_advLength{};
165165

166-
# if CONFIG_BT_NIMBLE_EXT_ADV
166+
# if MYNEWT_VAL(BLE_EXT_ADV)
167167
bool m_isLegacyAdv{};
168168
uint8_t m_sid{};
169169
uint8_t m_primPhy{};
@@ -174,5 +174,5 @@ class NimBLEAdvertisedDevice {
174174
std::vector<uint8_t> m_payload;
175175
};
176176

177-
#endif /* CONFIG_BT_ENABLED && CONFIG_BT_NIMBLE_ROLE_OBSERVER */
177+
#endif /* CONFIG_BT_NIMBLE_ENABLED && MYNEWT_VAL(BLE_ROLE_OBSERVER) */
178178
#endif /* NIMBLE_CPP_ADVERTISED_DEVICE_H_ */

src/NimBLEAdvertisementData.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
*/
1717

1818
#include "NimBLEAdvertisementData.h"
19-
#if (CONFIG_BT_ENABLED && CONFIG_BT_NIMBLE_ROLE_BROADCASTER && !CONFIG_BT_NIMBLE_EXT_ADV) || defined(_DOXYGEN_)
19+
#if (CONFIG_BT_NIMBLE_ENABLED && MYNEWT_VAL(BLE_ROLE_BROADCASTER) && !MYNEWT_VAL(BLE_EXT_ADV)) || defined(_DOXYGEN_)
2020

2121
# include "NimBLEDevice.h"
2222
# include "NimBLEUtils.h"
@@ -583,4 +583,4 @@ std::string NimBLEAdvertisementData::toString() const {
583583
return str;
584584
} // toString
585585

586-
#endif // (CONFIG_BT_ENABLED && CONFIG_BT_NIMBLE_ROLE_BROADCASTER && !CONFIG_BT_NIMBLE_EXT_ADV) || defined(_DOXYGEN_)
586+
#endif // (CONFIG_BT_NIMBLE_ENABLED && MYNEWT_VAL(BLE_ROLE_BROADCASTER) && !MYNEWT_VAL(BLE_EXT_ADV)) || defined(_DOXYGEN_)

src/NimBLEAdvertisementData.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@
1818
#ifndef NIMBLE_CPP_ADVERTISEMENT_DATA_H_
1919
#define NIMBLE_CPP_ADVERTISEMENT_DATA_H_
2020

21-
#include "nimconfig.h"
22-
#if (CONFIG_BT_ENABLED && CONFIG_BT_NIMBLE_ROLE_BROADCASTER && !CONFIG_BT_NIMBLE_EXT_ADV) || defined(_DOXYGEN_)
21+
#include "syscfg/syscfg.h"
22+
#if (CONFIG_BT_NIMBLE_ENABLED && MYNEWT_VAL(BLE_ROLE_BROADCASTER) && !MYNEWT_VAL(BLE_EXT_ADV)) || defined(_DOXYGEN_)
2323

2424
# include <cstdint>
2525
# include <string>
@@ -74,5 +74,5 @@ class NimBLEAdvertisementData {
7474
std::vector<uint8_t> m_payload{};
7575
}; // NimBLEAdvertisementData
7676

77-
#endif // (CONFIG_BT_ENABLED && CONFIG_BT_NIMBLE_ROLE_BROADCASTER && !CONFIG_BT_NIMBLE_EXT_ADV) || defined(_DOXYGEN_)
77+
#endif // (CONFIG_BT_NIMBLE_ENABLED && MYNEWT_VAL(BLE_ROLE_BROADCASTER) && !MYNEWT_VAL(BLE_EXT_ADV)) || defined(_DOXYGEN_)
7878
#endif // NIMBLE_CPP_ADVERTISEMENT_DATA_H_

0 commit comments

Comments
 (0)