forked from h2zero/esp-nimble-cpp
Fix builds when exluding roles
This commit is contained in:
@ -15,10 +15,8 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "nimconfig.h"
|
||||
#if defined(CONFIG_BT_ENABLED) && defined(CONFIG_BT_NIMBLE_ROLE_PERIPHERAL)
|
||||
|
||||
# include "NimBLE2904.h"
|
||||
#include "NimBLE2904.h"
|
||||
#if CONFIG_BT_ENABLED && CONFIG_BT_NIMBLE_ROLE_PERIPHERAL
|
||||
|
||||
NimBLE2904::NimBLE2904(NimBLECharacteristic* pChr)
|
||||
: NimBLEDescriptor(NimBLEUUID((uint16_t)0x2904), BLE_GATT_CHR_F_READ, sizeof(NimBLE2904Data), pChr) {
|
||||
@ -71,4 +69,4 @@ void NimBLE2904::setUnit(uint16_t unit) {
|
||||
setValue(m_data);
|
||||
} // setUnit
|
||||
|
||||
#endif /* CONFIG_BT_ENABLED && CONFIG_BT_NIMBLE_ROLE_PERIPHERAL */
|
||||
#endif // CONFIG_BT_ENABLED && CONFIG_BT_NIMBLE_ROLE_PERIPHERAL
|
||||
|
@ -19,7 +19,7 @@
|
||||
#define NIMBLE_CPP_2904_H_
|
||||
|
||||
#include "nimconfig.h"
|
||||
#if defined(CONFIG_BT_ENABLED) && defined(CONFIG_BT_NIMBLE_ROLE_PERIPHERAL)
|
||||
#if CONFIG_BT_ENABLED && CONFIG_BT_NIMBLE_ROLE_PERIPHERAL
|
||||
|
||||
# include "NimBLEDescriptor.h"
|
||||
|
||||
|
@ -15,10 +15,9 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "nimconfig.h"
|
||||
#if defined(CONFIG_BT_ENABLED)
|
||||
#include "NimBLEAddress.h"
|
||||
#if CONFIG_BT_ENABLED
|
||||
|
||||
# include "NimBLEAddress.h"
|
||||
# include "NimBLELog.h"
|
||||
|
||||
# include <algorithm>
|
||||
@ -224,11 +223,16 @@ NimBLEAddress::operator std::string() const {
|
||||
snprintf(buffer,
|
||||
sizeof(buffer),
|
||||
NIMBLE_CPP_ADDR_FMT,
|
||||
this->val[5], NIMBLE_CPP_ADDR_DELIMITER,
|
||||
this->val[4], NIMBLE_CPP_ADDR_DELIMITER,
|
||||
this->val[3], NIMBLE_CPP_ADDR_DELIMITER,
|
||||
this->val[2], NIMBLE_CPP_ADDR_DELIMITER,
|
||||
this->val[1], NIMBLE_CPP_ADDR_DELIMITER,
|
||||
this->val[5],
|
||||
NIMBLE_CPP_ADDR_DELIMITER,
|
||||
this->val[4],
|
||||
NIMBLE_CPP_ADDR_DELIMITER,
|
||||
this->val[3],
|
||||
NIMBLE_CPP_ADDR_DELIMITER,
|
||||
this->val[2],
|
||||
NIMBLE_CPP_ADDR_DELIMITER,
|
||||
this->val[1],
|
||||
NIMBLE_CPP_ADDR_DELIMITER,
|
||||
this->val[0]);
|
||||
return std::string{buffer};
|
||||
} // operator std::string
|
||||
|
@ -17,8 +17,9 @@
|
||||
|
||||
#ifndef NIMBLE_CPP_ADDRESS_H_
|
||||
#define NIMBLE_CPP_ADDRESS_H_
|
||||
|
||||
#include "nimconfig.h"
|
||||
#if defined(CONFIG_BT_ENABLED)
|
||||
#if CONFIG_BT_ENABLED
|
||||
|
||||
# if defined(CONFIG_NIMBLE_CPP_IDF)
|
||||
# include "nimble/ble.h"
|
||||
@ -66,5 +67,5 @@ class NimBLEAddress : private ble_addr_t {
|
||||
operator uint64_t() const;
|
||||
};
|
||||
|
||||
#endif /* CONFIG_BT_ENABLED */
|
||||
#endif /* NIMBLE_CPP_ADDRESS_H_ */
|
||||
#endif // CONFIG_BT_ENABLED
|
||||
#endif // NIMBLE_CPP_ADDRESS_H_
|
||||
|
@ -15,11 +15,10 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "nimconfig.h"
|
||||
#if defined(CONFIG_BT_ENABLED) && defined(CONFIG_BT_NIMBLE_ROLE_OBSERVER)
|
||||
#include "NimBLEAdvertisedDevice.h"
|
||||
#if CONFIG_BT_ENABLED && CONFIG_BT_NIMBLE_ROLE_OBSERVER
|
||||
|
||||
# include "NimBLEDevice.h"
|
||||
# include "NimBLEAdvertisedDevice.h"
|
||||
# include "NimBLEUtils.h"
|
||||
# include "NimBLELog.h"
|
||||
|
||||
@ -814,4 +813,4 @@ const std::vector<uint8_t>::const_iterator NimBLEAdvertisedDevice::end() const {
|
||||
return m_payload.cend();
|
||||
}
|
||||
|
||||
#endif /* CONFIG_BT_ENABLED && CONFIG_BT_NIMBLE_ROLE_CENTRAL */
|
||||
#endif // CONFIG_BT_ENABLED && CONFIG_BT_NIMBLE_ROLE_OBSERVER
|
||||
|
@ -19,7 +19,7 @@
|
||||
#define NIMBLE_CPP_ADVERTISED_DEVICE_H_
|
||||
|
||||
#include "nimconfig.h"
|
||||
#if defined(CONFIG_BT_ENABLED) && defined(CONFIG_BT_NIMBLE_ROLE_OBSERVER)
|
||||
#if CONFIG_BT_ENABLED && CONFIG_BT_NIMBLE_ROLE_OBSERVER
|
||||
|
||||
# include "NimBLEAddress.h"
|
||||
# include "NimBLEScan.h"
|
||||
|
@ -15,11 +15,9 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "nimconfig.h"
|
||||
#if (defined(CONFIG_BT_ENABLED) && defined(CONFIG_BT_NIMBLE_ROLE_BROADCASTER) && !CONFIG_BT_NIMBLE_EXT_ADV) || \
|
||||
defined(_DOXYGEN_)
|
||||
#include "NimBLEAdvertisementData.h"
|
||||
#if (CONFIG_BT_ENABLED && CONFIG_BT_NIMBLE_ROLE_BROADCASTER && !CONFIG_BT_NIMBLE_EXT_ADV) || defined(_DOXYGEN_)
|
||||
|
||||
# include "NimBLEAdvertisementData.h"
|
||||
# include "NimBLEDevice.h"
|
||||
# include "NimBLEUtils.h"
|
||||
# include "NimBLEUUID.h"
|
||||
@ -585,4 +583,4 @@ std::string NimBLEAdvertisementData::toString() const {
|
||||
return str;
|
||||
} // toString
|
||||
|
||||
#endif // CONFIG_BT_ENABLED && CONFIG_BT_NIMBLE_ROLE_BROADCASTER && !CONFIG_BT_NIMBLE_EXT_ADV
|
||||
#endif // (CONFIG_BT_ENABLED && CONFIG_BT_NIMBLE_ROLE_BROADCASTER && !CONFIG_BT_NIMBLE_EXT_ADV) || defined(_DOXYGEN_)
|
||||
|
@ -19,8 +19,7 @@
|
||||
#define NIMBLE_CPP_ADVERTISEMENT_DATA_H_
|
||||
|
||||
#include "nimconfig.h"
|
||||
#if (defined(CONFIG_BT_ENABLED) && defined(CONFIG_BT_NIMBLE_ROLE_BROADCASTER) && !CONFIG_BT_NIMBLE_EXT_ADV) || \
|
||||
defined(_DOXYGEN_)
|
||||
#if (CONFIG_BT_ENABLED && CONFIG_BT_NIMBLE_ROLE_BROADCASTER && !CONFIG_BT_NIMBLE_EXT_ADV) || defined(_DOXYGEN_)
|
||||
|
||||
# include <cstdint>
|
||||
# include <string>
|
||||
@ -75,5 +74,5 @@ class NimBLEAdvertisementData {
|
||||
std::vector<uint8_t> m_payload{};
|
||||
}; // NimBLEAdvertisementData
|
||||
|
||||
#endif // CONFIG_BT_ENABLED && CONFIG_BT_NIMBLE_ROLE_BROADCASTER && !CONFIG_BT_NIMBLE_EXT_ADV
|
||||
#endif // (CONFIG_BT_ENABLED && CONFIG_BT_NIMBLE_ROLE_BROADCASTER && !CONFIG_BT_NIMBLE_EXT_ADV) || defined(_DOXYGEN_)
|
||||
#endif // NIMBLE_CPP_ADVERTISEMENT_DATA_H_
|
||||
|
@ -15,16 +15,14 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "nimconfig.h"
|
||||
#if (defined(CONFIG_BT_ENABLED) && defined(CONFIG_BT_NIMBLE_ROLE_BROADCASTER) && !CONFIG_BT_NIMBLE_EXT_ADV) || \
|
||||
defined(_DOXYGEN_)
|
||||
#include "NimBLEAdvertising.h"
|
||||
#if (CONFIG_BT_ENABLED && CONFIG_BT_NIMBLE_ROLE_BROADCASTER && !CONFIG_BT_NIMBLE_EXT_ADV) || defined(_DOXYGEN_)
|
||||
|
||||
# if defined(CONFIG_NIMBLE_CPP_IDF)
|
||||
# include "services/gap/ble_svc_gap.h"
|
||||
# else
|
||||
# include "nimble/nimble/host/services/gap/include/services/gap/ble_svc_gap.h"
|
||||
# endif
|
||||
# include "NimBLEAdvertising.h"
|
||||
# include "NimBLEDevice.h"
|
||||
# include "NimBLEServer.h"
|
||||
# include "NimBLEUtils.h"
|
||||
@ -44,7 +42,7 @@ NimBLEAdvertising::NimBLEAdvertising()
|
||||
m_duration{BLE_HS_FOREVER},
|
||||
m_scanResp{false},
|
||||
m_advDataSet{false} {
|
||||
# if !defined(CONFIG_BT_NIMBLE_ROLE_PERIPHERAL)
|
||||
# if !CONFIG_BT_NIMBLE_ROLE_PERIPHERAL
|
||||
m_advParams.conn_mode = BLE_GAP_CONN_MODE_NON;
|
||||
# else
|
||||
m_advParams.conn_mode = BLE_GAP_CONN_MODE_UND;
|
||||
@ -197,7 +195,7 @@ bool NimBLEAdvertising::start(uint32_t duration, const NimBLEAddress* dirAddr) {
|
||||
return true;
|
||||
}
|
||||
|
||||
# if defined(CONFIG_BT_NIMBLE_ROLE_PERIPHERAL)
|
||||
# if CONFIG_BT_NIMBLE_ROLE_PERIPHERAL
|
||||
NimBLEServer* pServer = NimBLEDevice::getServer();
|
||||
if (pServer != nullptr) {
|
||||
pServer->start(); // make sure the GATT server is ready before advertising
|
||||
@ -222,7 +220,7 @@ bool NimBLEAdvertising::start(uint32_t duration, const NimBLEAddress* dirAddr) {
|
||||
duration = BLE_HS_FOREVER;
|
||||
}
|
||||
|
||||
# if defined(CONFIG_BT_NIMBLE_ROLE_PERIPHERAL)
|
||||
# if CONFIG_BT_NIMBLE_ROLE_PERIPHERAL
|
||||
int rc = ble_gap_adv_start(NimBLEDevice::m_ownAddrType,
|
||||
(dirAddr != nullptr) ? dirAddr->getBase() : NULL,
|
||||
duration,
|
||||
@ -622,4 +620,4 @@ bool NimBLEAdvertising::setServiceData(const NimBLEUUID& uuid, const std::string
|
||||
return setServiceData(uuid, reinterpret_cast<const uint8_t*>(data.data()), data.length());
|
||||
} // setServiceData
|
||||
|
||||
#endif /* CONFIG_BT_ENABLED && CONFIG_BT_NIMBLE_ROLE_BROADCASTER && !CONFIG_BT_NIMBLE_EXT_ADV */
|
||||
#endif // (CONFIG_BT_ENABLED && CONFIG_BT_NIMBLE_ROLE_BROADCASTER && !CONFIG_BT_NIMBLE_EXT_ADV) || defined(_DOXYGEN_)
|
||||
|
@ -19,8 +19,7 @@
|
||||
#define NIMBLE_CPP_ADVERTISING_H_
|
||||
|
||||
#include "nimconfig.h"
|
||||
#if (defined(CONFIG_BT_ENABLED) && defined(CONFIG_BT_NIMBLE_ROLE_BROADCASTER) && !CONFIG_BT_NIMBLE_EXT_ADV) || \
|
||||
defined(_DOXYGEN_)
|
||||
#if (CONFIG_BT_ENABLED && CONFIG_BT_NIMBLE_ROLE_BROADCASTER && !CONFIG_BT_NIMBLE_EXT_ADV) || defined(_DOXYGEN_)
|
||||
|
||||
# if defined(CONFIG_NIMBLE_CPP_IDF)
|
||||
# include "host/ble_gap.h"
|
||||
@ -106,5 +105,5 @@ class NimBLEAdvertising {
|
||||
bool m_advDataSet : 1;
|
||||
};
|
||||
|
||||
#endif /* CONFIG_BT_ENABLED && CONFIG_BT_NIMBLE_ROLE_BROADCASTER && !CONFIG_BT_NIMBLE_EXT_ADV */
|
||||
#endif /* NIMBLE_CPP_ADVERTISING_H_ */
|
||||
#endif // (CONFIG_BT_ENABLED && CONFIG_BT_NIMBLE_ROLE_BROADCASTER && !CONFIG_BT_NIMBLE_EXT_ADV) || defined(_DOXYGEN_)
|
||||
#endif // NIMBLE_CPP_ADVERTISING_H_
|
||||
|
@ -15,8 +15,8 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "nimconfig.h"
|
||||
#if defined(CONFIG_BT_ENABLED)
|
||||
#include "NimBLEAttValue.h"
|
||||
#if CONFIG_BT_ENABLED
|
||||
|
||||
# if defined(CONFIG_NIMBLE_CPP_IDF)
|
||||
# include "nimble/nimble_npl.h"
|
||||
@ -24,7 +24,6 @@
|
||||
# include "nimble/nimble/include/nimble/nimble_npl.h"
|
||||
# endif
|
||||
|
||||
# include "NimBLEAttValue.h"
|
||||
# include "NimBLELog.h"
|
||||
|
||||
static const char* LOG_TAG = "NimBLEAttValue";
|
||||
@ -105,7 +104,7 @@ void NimBLEAttValue::deepCopy(const NimBLEAttValue& source) {
|
||||
|
||||
// Set the value of the attribute.
|
||||
bool NimBLEAttValue::setValue(const uint8_t* value, uint16_t len) {
|
||||
m_attr_len = 0; // Just set the value length to 0 and append instead of repeating code.
|
||||
m_attr_len = 0; // Just set the value length to 0 and append instead of repeating code.
|
||||
m_attr_value[0] = '\0'; // Set the first byte to 0 incase the len of the new value is 0.
|
||||
append(value, len);
|
||||
return memcmp(m_attr_value, value, len) == 0 && m_attr_len == len;
|
||||
|
@ -17,8 +17,9 @@
|
||||
|
||||
#ifndef NIMBLE_CPP_ATTVALUE_H
|
||||
#define NIMBLE_CPP_ATTVALUE_H
|
||||
|
||||
#include "nimconfig.h"
|
||||
#if defined(CONFIG_BT_ENABLED)
|
||||
#if CONFIG_BT_ENABLED
|
||||
|
||||
# ifdef NIMBLE_CPP_ARDUINO_STRING_AVAILABLE
|
||||
# include <Arduino.h>
|
||||
@ -362,5 +363,5 @@ class NimBLEAttValue {
|
||||
# endif
|
||||
};
|
||||
|
||||
#endif /*(CONFIG_BT_ENABLED) */
|
||||
#endif /* NIMBLE_CPP_ATTVALUE_H_ */
|
||||
#endif // CONFIG_BT_ENABLED
|
||||
#endif // NIMBLE_CPP_ATTVALUE_H_
|
||||
|
@ -19,7 +19,7 @@
|
||||
#define NIMBLE_CPP_ATTRIBUTE_H_
|
||||
|
||||
#include "nimconfig.h"
|
||||
#if defined(CONFIG_BT_ENABLED) && (defined(CONFIG_BT_NIMBLE_ROLE_PERIPHERAL) || defined(CONFIG_BT_NIMBLE_ROLE_CENTRAL))
|
||||
#if CONFIG_BT_ENABLED && (CONFIG_BT_NIMBLE_ROLE_PERIPHERAL || CONFIG_BT_NIMBLE_ROLE_CENTRAL)
|
||||
|
||||
# include "NimBLEUUID.h"
|
||||
|
||||
|
@ -15,10 +15,9 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "nimconfig.h"
|
||||
#if defined(CONFIG_BT_ENABLED) && defined(CONFIG_BT_NIMBLE_ROLE_BROADCASTER)
|
||||
#include "NimBLEBeacon.h"
|
||||
#if CONFIG_BT_ENABLED && CONFIG_BT_NIMBLE_ROLE_BROADCASTER
|
||||
|
||||
# include "NimBLEBeacon.h"
|
||||
# include "NimBLEUUID.h"
|
||||
# include "NimBLELog.h"
|
||||
|
||||
|
@ -19,7 +19,7 @@
|
||||
#define NIMBLE_CPP_BEACON_H_
|
||||
|
||||
#include "nimconfig.h"
|
||||
#if defined(CONFIG_BT_ENABLED) && defined(CONFIG_BT_NIMBLE_ROLE_BROADCASTER)
|
||||
#if CONFIG_BT_ENABLED && CONFIG_BT_NIMBLE_ROLE_BROADCASTER
|
||||
|
||||
class NimBLEUUID;
|
||||
|
||||
@ -60,5 +60,5 @@ class NimBLEBeacon {
|
||||
BeaconData m_beaconData;
|
||||
}; // NimBLEBeacon
|
||||
|
||||
#endif // NIMBLE_CPP_BEACON_H_
|
||||
#endif // CONFIG_BT_ENABLED && CONFIG_BT_NIMBLE_ROLE_PERIPHERAL
|
||||
#endif // NIMBLE_CPP_BEACON_H_
|
||||
|
@ -15,10 +15,9 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "nimconfig.h"
|
||||
#if defined(CONFIG_BT_ENABLED) && defined(CONFIG_BT_NIMBLE_ROLE_PERIPHERAL)
|
||||
|
||||
# include "NimBLECharacteristic.h"
|
||||
#if CONFIG_BT_ENABLED && CONFIG_BT_NIMBLE_ROLE_PERIPHERAL
|
||||
|
||||
# include "NimBLE2904.h"
|
||||
# include "NimBLEDevice.h"
|
||||
# include "NimBLELog.h"
|
||||
@ -415,4 +414,4 @@ void NimBLECharacteristicCallbacks::onSubscribe(NimBLECharacteristic* pCharacter
|
||||
NIMBLE_LOGD("NimBLECharacteristicCallbacks", "onSubscribe: default");
|
||||
}
|
||||
|
||||
#endif /* CONFIG_BT_ENABLED && CONFIG_BT_NIMBLE_ROLE_PERIPHERAL */
|
||||
#endif // CONFIG_BT_ENABLED && CONFIG_BT_NIMBLE_ROLE_PERIPHERAL
|
||||
|
@ -17,8 +17,9 @@
|
||||
|
||||
#ifndef NIMBLE_CPP_CHARACTERISTIC_H_
|
||||
#define NIMBLE_CPP_CHARACTERISTIC_H_
|
||||
|
||||
#include "nimconfig.h"
|
||||
#if defined(CONFIG_BT_ENABLED) && defined(CONFIG_BT_NIMBLE_ROLE_PERIPHERAL)
|
||||
#if CONFIG_BT_ENABLED && CONFIG_BT_NIMBLE_ROLE_PERIPHERAL
|
||||
|
||||
class NimBLECharacteristicCallbacks;
|
||||
class NimBLEService;
|
||||
@ -253,5 +254,5 @@ class NimBLECharacteristicCallbacks {
|
||||
virtual void onSubscribe(NimBLECharacteristic* pCharacteristic, NimBLEConnInfo& connInfo, uint16_t subValue);
|
||||
};
|
||||
|
||||
#endif /* CONFIG_BT_ENABLED && CONFIG_BT_NIMBLE_ROLE_PERIPHERAL */
|
||||
#endif /*NIMBLE_CPP_CHARACTERISTIC_H_*/
|
||||
#endif // CONFIG_BT_ENABLED && CONFIG_BT_NIMBLE_ROLE_PERIPHERAL
|
||||
#endif // NIMBLE_CPP_CHARACTERISTIC_H_
|
||||
|
@ -15,10 +15,9 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "nimconfig.h"
|
||||
#if defined(CONFIG_BT_ENABLED) && defined(CONFIG_BT_NIMBLE_ROLE_CENTRAL)
|
||||
#include "NimBLEClient.h"
|
||||
#if CONFIG_BT_ENABLED && CONFIG_BT_NIMBLE_ROLE_CENTRAL
|
||||
|
||||
# include "NimBLEClient.h"
|
||||
# include "NimBLERemoteService.h"
|
||||
# include "NimBLERemoteCharacteristic.h"
|
||||
# include "NimBLEDevice.h"
|
||||
@ -126,6 +125,7 @@ size_t NimBLEClient::deleteService(const NimBLEUUID& uuid) {
|
||||
return m_svcVec.size();
|
||||
} // deleteService
|
||||
|
||||
# if CONFIG_BT_NIMBLE_ROLE_OBSERVER
|
||||
/**
|
||||
* @brief Connect to an advertising device.
|
||||
* @param [in] pDevice A pointer to the advertised device instance to connect to.
|
||||
@ -141,6 +141,7 @@ bool NimBLEClient::connect(const NimBLEAdvertisedDevice* pDevice, bool deleteAtt
|
||||
NimBLEAddress address(pDevice->getAddress());
|
||||
return connect(address, deleteAttributes, asyncConnect, exchangeMTU);
|
||||
} // connect
|
||||
# endif
|
||||
|
||||
/**
|
||||
* @brief Connect to the BLE Server using the address of the last connected device, or the address\n
|
||||
@ -227,10 +228,15 @@ bool NimBLEClient::connect(const NimBLEAddress& address, bool deleteAttributes,
|
||||
break;
|
||||
|
||||
case BLE_HS_EBUSY:
|
||||
# if CONFIG_BT_NIMBLE_ROLE_OBSERVER
|
||||
|
||||
// Scan was active, stop it through the NimBLEScan API to release any tasks and call the callback.
|
||||
if (!NimBLEDevice::getScan()->stop()) {
|
||||
rc = BLE_HS_EUNKNOWN;
|
||||
}
|
||||
# else
|
||||
rc = BLE_HS_EUNKNOWN;
|
||||
# endif
|
||||
break;
|
||||
|
||||
case BLE_HS_EDONE:
|
||||
@ -1301,4 +1307,4 @@ void NimBLEClientCallbacks::onPhyUpdate(NimBLEClient* pClient, uint8_t txPhy, ui
|
||||
} // onPhyUpdate
|
||||
#
|
||||
|
||||
#endif /* CONFIG_BT_ENABLED && CONFIG_BT_NIMBLE_ROLE_CENTRAL */
|
||||
#endif // CONFIG_BT_ENABLED && CONFIG_BT_NIMBLE_ROLE_CENTRAL
|
||||
|
@ -19,7 +19,7 @@
|
||||
#define NIMBLE_CPP_CLIENT_H_
|
||||
|
||||
#include "nimconfig.h"
|
||||
#if defined(CONFIG_BT_ENABLED) && defined(CONFIG_BT_NIMBLE_ROLE_CENTRAL)
|
||||
#if CONFIG_BT_ENABLED && CONFIG_BT_NIMBLE_ROLE_CENTRAL
|
||||
|
||||
# if defined(CONFIG_NIMBLE_CPP_IDF)
|
||||
# include "host/ble_gap.h"
|
||||
@ -48,10 +48,12 @@ struct NimBLETaskData;
|
||||
*/
|
||||
class NimBLEClient {
|
||||
public:
|
||||
# if CONFIG_BT_NIMBLE_ROLE_OBSERVER
|
||||
bool connect(const NimBLEAdvertisedDevice* device,
|
||||
bool deleteAttributes = true,
|
||||
bool asyncConnect = false,
|
||||
bool exchangeMTU = true);
|
||||
# endif
|
||||
bool connect(const NimBLEAddress& address, bool deleteAttributes = true, bool asyncConnect = false, bool exchangeMTU = true);
|
||||
bool connect(bool deleteAttributes = true, bool asyncConnect = false, bool exchangeMTU = true);
|
||||
bool disconnect(uint8_t reason = BLE_ERR_REM_USER_CONN_TERM);
|
||||
@ -227,5 +229,5 @@ class NimBLEClientCallbacks {
|
||||
virtual void onPhyUpdate(NimBLEClient* pClient, uint8_t txPhy, uint8_t rxPhy);
|
||||
};
|
||||
|
||||
#endif /* CONFIG_BT_ENABLED && CONFIG_BT_NIMBLE_ROLE_CENTRAL */
|
||||
#endif /* NIMBLE_CPP_CLIENT_H_ */
|
||||
#endif // CONFIG_BT_ENABLED && CONFIG_BT_NIMBLE_ROLE_CENTRAL
|
||||
#endif // NIMBLE_CPP_CLIENT_H_
|
||||
|
@ -15,8 +15,8 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef NIMBLECONNINFO_H_
|
||||
#define NIMBLECONNINFO_H_
|
||||
#ifndef NIMBLE_CPP_CONNINFO_H_
|
||||
#define NIMBLE_CPP_CONNINFO_H_
|
||||
|
||||
#if defined(CONFIG_NIMBLE_CPP_IDF)
|
||||
# include "host/ble_gap.h"
|
||||
@ -80,4 +80,5 @@ class NimBLEConnInfo {
|
||||
NimBLEConnInfo() {};
|
||||
NimBLEConnInfo(ble_gap_conn_desc desc) { m_desc = desc; }
|
||||
};
|
||||
#endif
|
||||
|
||||
#endif // NIMBLE_CPP_CONNINFO_H_
|
||||
|
@ -15,11 +15,10 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "nimconfig.h"
|
||||
#if defined(CONFIG_BT_ENABLED) && defined(CONFIG_BT_NIMBLE_ROLE_PERIPHERAL)
|
||||
#include "NimBLEDescriptor.h"
|
||||
#if CONFIG_BT_ENABLED && CONFIG_BT_NIMBLE_ROLE_PERIPHERAL
|
||||
|
||||
# include "NimBLEService.h"
|
||||
# include "NimBLEDescriptor.h"
|
||||
# include "NimBLELog.h"
|
||||
|
||||
# include <string>
|
||||
@ -148,4 +147,4 @@ void NimBLEDescriptorCallbacks::onWrite(NimBLEDescriptor* pDescriptor, NimBLECon
|
||||
NIMBLE_LOGD("NimBLEDescriptorCallbacks", "onWrite: default");
|
||||
} // onWrite
|
||||
|
||||
#endif /* CONFIG_BT_ENABLED && CONFIG_BT_NIMBLE_ROLE_PERIPHERAL */
|
||||
#endif // CONFIG_BT_ENABLED && CONFIG_BT_NIMBLE_ROLE_PERIPHERAL
|
||||
|
@ -19,7 +19,7 @@
|
||||
#define NIMBLE_CPP_DESCRIPTOR_H_
|
||||
|
||||
#include "nimconfig.h"
|
||||
#if defined(CONFIG_BT_ENABLED) && defined(CONFIG_BT_NIMBLE_ROLE_PERIPHERAL)
|
||||
#if CONFIG_BT_ENABLED && CONFIG_BT_NIMBLE_ROLE_PERIPHERAL
|
||||
|
||||
# include "NimBLELocalValueAttribute.h"
|
||||
# include <string>
|
||||
@ -72,5 +72,5 @@ class NimBLEDescriptorCallbacks {
|
||||
|
||||
# include "NimBLE2904.h"
|
||||
|
||||
#endif /* CONFIG_BT_ENABLED && CONFIG_BT_NIMBLE_ROLE_PERIPHERAL */
|
||||
#endif /* NIMBLE_CPP_DESCRIPTOR_H_ */
|
||||
#endif // CONFIG_BT_ENABLED && CONFIG_BT_NIMBLE_ROLE_PERIPHERAL
|
||||
#endif // NIMBLE_CPP_DESCRIPTOR_H_
|
||||
|
@ -15,11 +15,8 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "nimconfig.h"
|
||||
#if defined(CONFIG_BT_ENABLED)
|
||||
|
||||
# include "NimBLEDevice.h"
|
||||
# include "NimBLEUtils.h"
|
||||
#include "NimBLEDevice.h"
|
||||
#if CONFIG_BT_ENABLED
|
||||
|
||||
# ifdef ESP_PLATFORM
|
||||
# include "esp_err.h"
|
||||
@ -59,17 +56,6 @@
|
||||
# include "esp32-hal-bt.h"
|
||||
# endif
|
||||
|
||||
# if defined(CONFIG_BT_NIMBLE_ROLE_CENTRAL)
|
||||
# include "NimBLEClient.h"
|
||||
# endif
|
||||
|
||||
# if defined(CONFIG_BT_NIMBLE_ROLE_PERIPHERAL)
|
||||
# include "NimBLEServer.h"
|
||||
# if CONFIG_BT_NIMBLE_L2CAP_COC_MAX_NUM > 0
|
||||
# include "NimBLEL2CAPServer.h"
|
||||
# endif
|
||||
# endif
|
||||
|
||||
# include "NimBLELog.h"
|
||||
|
||||
static const char* LOG_TAG = "NimBLEDevice";
|
||||
@ -82,18 +68,18 @@ extern "C" void ble_store_config_init(void);
|
||||
NimBLEDeviceCallbacks NimBLEDevice::defaultDeviceCallbacks{};
|
||||
NimBLEDeviceCallbacks* NimBLEDevice::m_pDeviceCallbacks = &defaultDeviceCallbacks;
|
||||
|
||||
# if defined(CONFIG_BT_NIMBLE_ROLE_OBSERVER)
|
||||
# if CONFIG_BT_NIMBLE_ROLE_OBSERVER
|
||||
NimBLEScan* NimBLEDevice::m_pScan = nullptr;
|
||||
# endif
|
||||
|
||||
# if defined(CONFIG_BT_NIMBLE_ROLE_PERIPHERAL)
|
||||
# if CONFIG_BT_NIMBLE_ROLE_PERIPHERAL
|
||||
NimBLEServer* NimBLEDevice::m_pServer = nullptr;
|
||||
# if CONFIG_BT_NIMBLE_L2CAP_COC_MAX_NUM > 0
|
||||
NimBLEL2CAPServer* NimBLEDevice::m_pL2CAPServer = nullptr;
|
||||
# endif
|
||||
# endif
|
||||
|
||||
# if defined(CONFIG_BT_NIMBLE_ROLE_BROADCASTER)
|
||||
# if CONFIG_BT_NIMBLE_ROLE_BROADCASTER
|
||||
# if CONFIG_BT_NIMBLE_EXT_ADV
|
||||
NimBLEExtAdvertising* NimBLEDevice::m_bleAdvertising = nullptr;
|
||||
# else
|
||||
@ -101,7 +87,7 @@ NimBLEAdvertising* NimBLEDevice::m_bleAdvertising = nullptr;
|
||||
# endif
|
||||
# endif
|
||||
|
||||
# if defined(CONFIG_BT_NIMBLE_ROLE_CENTRAL)
|
||||
# if CONFIG_BT_NIMBLE_ROLE_CENTRAL
|
||||
std::array<NimBLEClient*, NIMBLE_MAX_CONNECTIONS> NimBLEDevice::m_pClients{};
|
||||
# endif
|
||||
|
||||
@ -132,7 +118,7 @@ extern "C" int ble_vhci_disc_duplicate_mode_enable(int mode);
|
||||
/* SERVER FUNCTIONS */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
|
||||
# if defined(CONFIG_BT_NIMBLE_ROLE_PERIPHERAL)
|
||||
# if CONFIG_BT_NIMBLE_ROLE_PERIPHERAL
|
||||
/**
|
||||
* @brief Create an instance of a server.
|
||||
* @return A pointer to the instance of the server.
|
||||
@ -156,7 +142,7 @@ NimBLEServer* NimBLEDevice::getServer() {
|
||||
return m_pServer;
|
||||
} // getServer
|
||||
|
||||
# if CONFIG_BT_NIMBLE_L2CAP_COC_MAX_NUM > 0
|
||||
# if CONFIG_BT_NIMBLE_L2CAP_COC_MAX_NUM
|
||||
/**
|
||||
* @brief Create an instance of a L2CAP server.
|
||||
* @return A pointer to the instance of the L2CAP server.
|
||||
@ -175,14 +161,14 @@ NimBLEL2CAPServer* NimBLEDevice::createL2CAPServer() {
|
||||
NimBLEL2CAPServer* NimBLEDevice::getL2CAPServer() {
|
||||
return m_pL2CAPServer;
|
||||
} // getL2CAPServer
|
||||
# endif
|
||||
# endif // #if defined(CONFIG_BT_NIMBLE_ROLE_PERIPHERAL)
|
||||
# endif // #if CONFIG_BT_NIMBLE_L2CAP_COC_MAX_NUM
|
||||
# endif // #if CONFIG_BT_NIMBLE_ROLE_PERIPHERAL
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* ADVERTISING FUNCTIONS */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
|
||||
# if defined(CONFIG_BT_NIMBLE_ROLE_BROADCASTER)
|
||||
# if CONFIG_BT_NIMBLE_ROLE_BROADCASTER
|
||||
# if CONFIG_BT_NIMBLE_EXT_ADV
|
||||
/**
|
||||
* @brief Get the instance of the extended advertising object.
|
||||
@ -246,7 +232,7 @@ bool NimBLEDevice::startAdvertising(uint32_t duration) {
|
||||
bool NimBLEDevice::stopAdvertising() {
|
||||
return getAdvertising()->stop();
|
||||
} // stopAdvertising
|
||||
# endif // #if defined(CONFIG_BT_NIMBLE_ROLE_BROADCASTER)
|
||||
# endif // #if CONFIG_BT_NIMBLE_ROLE_BROADCASTER
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* SCAN FUNCTIONS */
|
||||
@ -257,7 +243,7 @@ bool NimBLEDevice::stopAdvertising() {
|
||||
* @return The scanning object reference. This is a singleton object. The caller should not
|
||||
* try and release/delete it.
|
||||
*/
|
||||
# if defined(CONFIG_BT_NIMBLE_ROLE_OBSERVER)
|
||||
# if CONFIG_BT_NIMBLE_ROLE_OBSERVER
|
||||
NimBLEScan* NimBLEDevice::getScan() {
|
||||
if (m_pScan == nullptr) {
|
||||
m_pScan = new NimBLEScan();
|
||||
@ -335,13 +321,13 @@ void NimBLEDevice::setScanDuplicateCacheResetTime(uint16_t time) {
|
||||
}
|
||||
# endif // CONFIG_BTDM_BLE_SCAN_DUPL || CONFIG_BT_LE_SCAN_DUPL
|
||||
# endif // ESP_PLATFORM
|
||||
# endif // #if defined(CONFIG_BT_NIMBLE_ROLE_OBSERVER)
|
||||
# endif // CONFIG_BT_NIMBLE_ROLE_OBSERVER
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* CLIENT FUNCTIONS */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
|
||||
# if defined(CONFIG_BT_NIMBLE_ROLE_CENTRAL)
|
||||
# if CONFIG_BT_NIMBLE_ROLE_CENTRAL
|
||||
/**
|
||||
* @brief Creates a new client object, each client can connect to 1 peripheral device.
|
||||
* @return A pointer to the new client object, or nullptr on error.
|
||||
@ -476,7 +462,7 @@ std::vector<NimBLEClient*> NimBLEDevice::getConnectedClients() {
|
||||
return clients;
|
||||
} // getConnectedClients
|
||||
|
||||
# endif // #if defined(CONFIG_BT_NIMBLE_ROLE_CENTRAL)
|
||||
# endif // CONFIG_BT_NIMBLE_ROLE_CENTRAL
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* TRANSMIT POWER */
|
||||
@ -627,7 +613,7 @@ uint16_t NimBLEDevice::getMTU() {
|
||||
/* BOND MANAGEMENT */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
|
||||
# if defined(CONFIG_BT_NIMBLE_ROLE_CENTRAL) || defined(CONFIG_BT_NIMBLE_ROLE_PERIPHERAL)
|
||||
# if CONFIG_BT_NIMBLE_ROLE_CENTRAL || CONFIG_BT_NIMBLE_ROLE_PERIPHERAL
|
||||
/**
|
||||
* @brief Gets the number of bonded peers stored
|
||||
*/
|
||||
@ -864,13 +850,13 @@ void NimBLEDevice::onSync(void) {
|
||||
m_synced = true;
|
||||
|
||||
if (m_initialized) {
|
||||
# if defined(CONFIG_BT_NIMBLE_ROLE_OBSERVER)
|
||||
# if CONFIG_BT_NIMBLE_ROLE_OBSERVER
|
||||
if (m_pScan != nullptr) {
|
||||
m_pScan->onHostSync();
|
||||
}
|
||||
# endif
|
||||
|
||||
# if defined(CONFIG_BT_NIMBLE_ROLE_BROADCASTER)
|
||||
# if CONFIG_BT_NIMBLE_ROLE_BROADCASTER
|
||||
if (m_bleAdvertising != nullptr) {
|
||||
m_bleAdvertising->onHostSync();
|
||||
}
|
||||
@ -1038,12 +1024,12 @@ bool NimBLEDevice::deinit(bool clearAll) {
|
||||
}
|
||||
|
||||
if (clearAll) {
|
||||
# if defined(CONFIG_BT_NIMBLE_ROLE_PERIPHERAL)
|
||||
# if CONFIG_BT_NIMBLE_ROLE_PERIPHERAL
|
||||
if (NimBLEDevice::m_pServer != nullptr) {
|
||||
delete NimBLEDevice::m_pServer;
|
||||
NimBLEDevice::m_pServer = nullptr;
|
||||
}
|
||||
# if CONFIG_BT_NIMBLE_L2CAP_COC_MAX_NUM > 0
|
||||
# if CONFIG_BT_NIMBLE_L2CAP_COC_MAX_NUM
|
||||
if (NimBLEDevice::m_pL2CAPServer != nullptr) {
|
||||
delete NimBLEDevice::m_pL2CAPServer;
|
||||
NimBLEDevice::m_pL2CAPServer = nullptr;
|
||||
@ -1051,21 +1037,21 @@ bool NimBLEDevice::deinit(bool clearAll) {
|
||||
# endif
|
||||
# endif
|
||||
|
||||
# if defined(CONFIG_BT_NIMBLE_ROLE_BROADCASTER)
|
||||
# if CONFIG_BT_NIMBLE_ROLE_BROADCASTER
|
||||
if (NimBLEDevice::m_bleAdvertising != nullptr) {
|
||||
delete NimBLEDevice::m_bleAdvertising;
|
||||
NimBLEDevice::m_bleAdvertising = nullptr;
|
||||
}
|
||||
# endif
|
||||
|
||||
# if defined(CONFIG_BT_NIMBLE_ROLE_OBSERVER)
|
||||
# if CONFIG_BT_NIMBLE_ROLE_OBSERVER
|
||||
if (NimBLEDevice::m_pScan != nullptr) {
|
||||
delete NimBLEDevice::m_pScan;
|
||||
NimBLEDevice::m_pScan = nullptr;
|
||||
}
|
||||
# endif
|
||||
|
||||
# if defined(CONFIG_BT_NIMBLE_ROLE_CENTRAL)
|
||||
# if CONFIG_BT_NIMBLE_ROLE_CENTRAL
|
||||
for (auto clt : m_pClients) {
|
||||
deleteClient(clt);
|
||||
}
|
||||
@ -1266,7 +1252,7 @@ bool NimBLEDevice::startSecurity(uint16_t connHandle, int* rcPtr) {
|
||||
return rc == 0 || rc == BLE_HS_EALREADY;
|
||||
} // startSecurity
|
||||
|
||||
# if defined(CONFIG_BT_NIMBLE_ROLE_CENTRAL) || defined(CONFIG_BT_NIMBLE_ROLE_PERIPHERAL)
|
||||
# if CONFIG_BT_NIMBLE_ROLE_CENTRAL || CONFIG_BT_NIMBLE_ROLE_PERIPHERAL
|
||||
/**
|
||||
* @brief Inject the provided passkey into the Security Manager.
|
||||
* @param [in] peerInfo Connection information for the peer.
|
||||
|
@ -19,7 +19,7 @@
|
||||
#define NIMBLE_CPP_DEVICE_H_
|
||||
|
||||
#include "nimconfig.h"
|
||||
#if defined(CONFIG_BT_ENABLED)
|
||||
#if CONFIG_BT_ENABLED
|
||||
# ifdef ESP_PLATFORM
|
||||
# ifndef CONFIG_IDF_TARGET_ESP32P4
|
||||
# include <esp_bt.h>
|
||||
@ -40,16 +40,16 @@
|
||||
# include <string>
|
||||
# include <vector>
|
||||
|
||||
# if defined(CONFIG_BT_NIMBLE_ROLE_CENTRAL)
|
||||
# if CONFIG_BT_NIMBLE_ROLE_CENTRAL
|
||||
# include <array>
|
||||
class NimBLEClient;
|
||||
# endif
|
||||
|
||||
# if defined(CONFIG_BT_NIMBLE_ROLE_OBSERVER)
|
||||
# if CONFIG_BT_NIMBLE_ROLE_OBSERVER
|
||||
class NimBLEScan;
|
||||
# endif
|
||||
|
||||
# if defined(CONFIG_BT_NIMBLE_ROLE_BROADCASTER)
|
||||
# if CONFIG_BT_NIMBLE_ROLE_BROADCASTER
|
||||
# if CONFIG_BT_NIMBLE_EXT_ADV
|
||||
class NimBLEExtAdvertising;
|
||||
# else
|
||||
@ -57,14 +57,14 @@ class NimBLEAdvertising;
|
||||
# endif
|
||||
# endif
|
||||
|
||||
# if defined(CONFIG_BT_NIMBLE_ROLE_PERIPHERAL)
|
||||
# if CONFIG_BT_NIMBLE_ROLE_PERIPHERAL
|
||||
class NimBLEServer;
|
||||
# if CONFIG_BT_NIMBLE_L2CAP_COC_MAX_NUM > 0
|
||||
class NimBLEL2CAPServer;
|
||||
# endif
|
||||
# endif
|
||||
|
||||
# if defined(CONFIG_BT_NIMBLE_ROLE_PERIPHERAL) || defined(CONFIG_BT_NIMBLE_ROLE_CENTRAL)
|
||||
# if CONFIG_BT_NIMBLE_ROLE_PERIPHERAL || CONFIG_BT_NIMBLE_ROLE_CENTRAL
|
||||
class NimBLEConnInfo;
|
||||
# endif
|
||||
|
||||
@ -164,11 +164,11 @@ class NimBLEDevice {
|
||||
# endif
|
||||
# endif
|
||||
|
||||
# if defined(CONFIG_BT_NIMBLE_ROLE_OBSERVER)
|
||||
# if CONFIG_BT_NIMBLE_ROLE_OBSERVER
|
||||
static NimBLEScan* getScan();
|
||||
# endif
|
||||
|
||||
# if defined(CONFIG_BT_NIMBLE_ROLE_PERIPHERAL)
|
||||
# if CONFIG_BT_NIMBLE_ROLE_PERIPHERAL
|
||||
static NimBLEServer* createServer();
|
||||
static NimBLEServer* getServer();
|
||||
# if CONFIG_BT_NIMBLE_L2CAP_COC_MAX_NUM > 0
|
||||
@ -177,12 +177,12 @@ class NimBLEDevice {
|
||||
# endif
|
||||
# endif
|
||||
|
||||
# if defined(CONFIG_BT_NIMBLE_ROLE_PERIPHERAL) || defined(CONFIG_BT_NIMBLE_ROLE_CENTRAL)
|
||||
# if CONFIG_BT_NIMBLE_ROLE_PERIPHERAL || CONFIG_BT_NIMBLE_ROLE_CENTRAL
|
||||
static bool injectConfirmPasskey(const NimBLEConnInfo& peerInfo, bool accept);
|
||||
static bool injectPassKey(const NimBLEConnInfo& peerInfo, uint32_t pin);
|
||||
# endif
|
||||
|
||||
# if defined(CONFIG_BT_NIMBLE_ROLE_BROADCASTER)
|
||||
# if CONFIG_BT_NIMBLE_ROLE_BROADCASTER
|
||||
# if CONFIG_BT_NIMBLE_EXT_ADV
|
||||
static NimBLEExtAdvertising* getAdvertising();
|
||||
static bool startAdvertising(uint8_t instId, int duration = 0, int maxEvents = 0);
|
||||
@ -196,7 +196,7 @@ class NimBLEDevice {
|
||||
# endif
|
||||
# endif
|
||||
|
||||
# if defined(CONFIG_BT_NIMBLE_ROLE_CENTRAL)
|
||||
# if CONFIG_BT_NIMBLE_ROLE_CENTRAL
|
||||
static NimBLEClient* createClient();
|
||||
static NimBLEClient* createClient(const NimBLEAddress& peerAddress);
|
||||
static bool deleteClient(NimBLEClient* pClient);
|
||||
@ -207,7 +207,7 @@ class NimBLEDevice {
|
||||
static std::vector<NimBLEClient*> getConnectedClients();
|
||||
# endif
|
||||
|
||||
# if defined(CONFIG_BT_NIMBLE_ROLE_CENTRAL) || defined(CONFIG_BT_NIMBLE_ROLE_PERIPHERAL)
|
||||
# if CONFIG_BT_NIMBLE_ROLE_CENTRAL || CONFIG_BT_NIMBLE_ROLE_PERIPHERAL
|
||||
static bool deleteBond(const NimBLEAddress& address);
|
||||
static int getNumBonds();
|
||||
static bool isBonded(const NimBLEAddress& address);
|
||||
@ -225,18 +225,18 @@ class NimBLEDevice {
|
||||
static NimBLEDeviceCallbacks* m_pDeviceCallbacks;
|
||||
static NimBLEDeviceCallbacks defaultDeviceCallbacks;
|
||||
|
||||
# if defined(CONFIG_BT_NIMBLE_ROLE_OBSERVER)
|
||||
# if CONFIG_BT_NIMBLE_ROLE_OBSERVER
|
||||
static NimBLEScan* m_pScan;
|
||||
# endif
|
||||
|
||||
# if defined(CONFIG_BT_NIMBLE_ROLE_PERIPHERAL)
|
||||
# if CONFIG_BT_NIMBLE_ROLE_PERIPHERAL
|
||||
static NimBLEServer* m_pServer;
|
||||
# if CONFIG_BT_NIMBLE_L2CAP_COC_MAX_NUM > 0
|
||||
static NimBLEL2CAPServer* m_pL2CAPServer;
|
||||
# endif
|
||||
# endif
|
||||
|
||||
# if defined(CONFIG_BT_NIMBLE_ROLE_BROADCASTER)
|
||||
# if CONFIG_BT_NIMBLE_ROLE_BROADCASTER
|
||||
# if CONFIG_BT_NIMBLE_EXT_ADV
|
||||
static NimBLEExtAdvertising* m_bleAdvertising;
|
||||
# else
|
||||
@ -244,7 +244,7 @@ class NimBLEDevice {
|
||||
# endif
|
||||
# endif
|
||||
|
||||
# if defined(CONFIG_BT_NIMBLE_ROLE_CENTRAL)
|
||||
# if CONFIG_BT_NIMBLE_ROLE_CENTRAL
|
||||
static std::array<NimBLEClient*, NIMBLE_MAX_CONNECTIONS> m_pClients;
|
||||
# endif
|
||||
|
||||
@ -256,20 +256,20 @@ class NimBLEDevice {
|
||||
# endif
|
||||
# endif
|
||||
|
||||
# if defined(CONFIG_BT_NIMBLE_ROLE_CENTRAL)
|
||||
# if CONFIG_BT_NIMBLE_ROLE_CENTRAL
|
||||
friend class NimBLEClient;
|
||||
# endif
|
||||
|
||||
# if defined(CONFIG_BT_NIMBLE_ROLE_OBSERVER)
|
||||
# if CONFIG_BT_NIMBLE_ROLE_OBSERVER
|
||||
friend class NimBLEScan;
|
||||
# endif
|
||||
|
||||
# if defined(CONFIG_BT_NIMBLE_ROLE_PERIPHERAL)
|
||||
# if CONFIG_BT_NIMBLE_ROLE_PERIPHERAL
|
||||
friend class NimBLEServer;
|
||||
friend class NimBLECharacteristic;
|
||||
# endif
|
||||
|
||||
# if defined(CONFIG_BT_NIMBLE_ROLE_BROADCASTER)
|
||||
# if CONFIG_BT_NIMBLE_ROLE_BROADCASTER
|
||||
friend class NimBLEAdvertising;
|
||||
# if CONFIG_BT_NIMBLE_EXT_ADV
|
||||
friend class NimBLEExtAdvertising;
|
||||
@ -278,29 +278,29 @@ class NimBLEDevice {
|
||||
# endif
|
||||
};
|
||||
|
||||
# if defined(CONFIG_BT_NIMBLE_ROLE_CENTRAL)
|
||||
# if CONFIG_BT_NIMBLE_ROLE_CENTRAL
|
||||
# include "NimBLEClient.h"
|
||||
# include "NimBLERemoteService.h"
|
||||
# include "NimBLERemoteCharacteristic.h"
|
||||
# include "NimBLERemoteDescriptor.h"
|
||||
# endif
|
||||
|
||||
# if defined(CONFIG_BT_NIMBLE_ROLE_OBSERVER)
|
||||
# if CONFIG_BT_NIMBLE_ROLE_OBSERVER
|
||||
# include "NimBLEScan.h"
|
||||
# endif
|
||||
|
||||
# if defined(CONFIG_BT_NIMBLE_ROLE_PERIPHERAL)
|
||||
# if CONFIG_BT_NIMBLE_ROLE_PERIPHERAL
|
||||
# include "NimBLEServer.h"
|
||||
# include "NimBLEService.h"
|
||||
# include "NimBLECharacteristic.h"
|
||||
# include "NimBLEDescriptor.h"
|
||||
# if CONFIG_BT_NIMBLE_L2CAP_COC_MAX_NUM > 0
|
||||
# if CONFIG_BT_NIMBLE_L2CAP_COC_MAX_NUM
|
||||
# include "NimBLEL2CAPServer.h"
|
||||
# include "NimBLEL2CAPChannel.h"
|
||||
# endif
|
||||
# endif
|
||||
|
||||
# if defined(CONFIG_BT_NIMBLE_ROLE_BROADCASTER)
|
||||
# if CONFIG_BT_NIMBLE_ROLE_BROADCASTER
|
||||
# if CONFIG_BT_NIMBLE_EXT_ADV
|
||||
# include "NimBLEExtAdvertising.h"
|
||||
# else
|
||||
@ -308,10 +308,11 @@ class NimBLEDevice {
|
||||
# endif
|
||||
# endif
|
||||
|
||||
# if defined(CONFIG_BT_NIMBLE_ROLE_CENTRAL) || defined(CONFIG_BT_NIMBLE_ROLE_PERIPHERAL)
|
||||
# if CONFIG_BT_NIMBLE_ROLE_CENTRAL || CONFIG_BT_NIMBLE_ROLE_PERIPHERAL
|
||||
# include "NimBLEConnInfo.h"
|
||||
# endif
|
||||
|
||||
# include "NimBLEAddress.h"
|
||||
# include "NimBLEUtils.h"
|
||||
|
||||
/**
|
||||
|
@ -15,10 +15,9 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "nimconfig.h"
|
||||
#if defined(CONFIG_BT_ENABLED) && defined(CONFIG_BT_NIMBLE_ROLE_BROADCASTER)
|
||||
#include "NimBLEEddystoneTLM.h"
|
||||
#if CONFIG_BT_ENABLED && CONFIG_BT_NIMBLE_ROLE_BROADCASTER
|
||||
|
||||
# include "NimBLEEddystoneTLM.h"
|
||||
# include "NimBLEUUID.h"
|
||||
# include "NimBLELog.h"
|
||||
|
||||
|
@ -19,7 +19,7 @@
|
||||
#define NIMBLE_CPP_EDDYSTONETLM_H_
|
||||
|
||||
#include "nimconfig.h"
|
||||
#if defined(CONFIG_BT_ENABLED) && defined(CONFIG_BT_NIMBLE_ROLE_BROADCASTER)
|
||||
#if CONFIG_BT_ENABLED && CONFIG_BT_NIMBLE_ROLE_BROADCASTER
|
||||
|
||||
class NimBLEUUID;
|
||||
|
||||
|
@ -15,8 +15,8 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "nimconfig.h"
|
||||
#if defined(CONFIG_BT_ENABLED) && defined(CONFIG_BT_NIMBLE_ROLE_BROADCASTER) && CONFIG_BT_NIMBLE_EXT_ADV
|
||||
#include "NimBLEExtAdvertising.h"
|
||||
#if CONFIG_BT_ENABLED && CONFIG_BT_NIMBLE_ROLE_BROADCASTER && CONFIG_BT_NIMBLE_EXT_ADV
|
||||
|
||||
# if defined(CONFIG_NIMBLE_CPP_IDF)
|
||||
# include "services/gap/ble_svc_gap.h"
|
||||
@ -24,7 +24,6 @@
|
||||
# include "nimble/nimble/host/services/gap/include/services/gap/ble_svc_gap.h"
|
||||
# endif
|
||||
|
||||
# include "NimBLEExtAdvertising.h"
|
||||
# include "NimBLEDevice.h"
|
||||
# include "NimBLEServer.h"
|
||||
# include "NimBLEUtils.h"
|
||||
@ -69,7 +68,7 @@ bool NimBLEExtAdvertising::setInstanceData(uint8_t instId, NimBLEExtAdvertisemen
|
||||
adv.m_params.scan_req_notif = false;
|
||||
}
|
||||
|
||||
# if defined(CONFIG_BT_NIMBLE_ROLE_PERIPHERAL)
|
||||
# if CONFIG_BT_NIMBLE_ROLE_PERIPHERAL
|
||||
NimBLEServer* pServer = NimBLEDevice::getServer();
|
||||
if (pServer != nullptr) {
|
||||
pServer->start(); // make sure the GATT server is ready before advertising
|
||||
@ -392,7 +391,7 @@ void NimBLEExtAdvertisement::setTxPower(int8_t dbm) {
|
||||
* @param [in] enable True = connectable.
|
||||
*/
|
||||
void NimBLEExtAdvertisement::setConnectable(bool enable) {
|
||||
# if defined(CONFIG_BT_NIMBLE_ROLE_PERIPHERAL)
|
||||
# if CONFIG_BT_NIMBLE_ROLE_PERIPHERAL
|
||||
m_params.connectable = enable;
|
||||
# endif
|
||||
} // setConnectable
|
||||
@ -1091,4 +1090,4 @@ std::string NimBLEExtAdvertisement::toString() const {
|
||||
return str;
|
||||
} // toString
|
||||
|
||||
#endif /* CONFIG_BT_ENABLED && CONFIG_BT_NIMBLE_ROLE_BROADCASTER && CONFIG_BT_NIMBLE_EXT_ADV */
|
||||
#endif // CONFIG_BT_ENABLED && CONFIG_BT_NIMBLE_ROLE_BROADCASTER && CONFIG_BT_NIMBLE_EXT_ADV
|
||||
|
@ -19,7 +19,7 @@
|
||||
#define NIMBLE_CPP_EXTADVERTISING_H_
|
||||
|
||||
#include "nimconfig.h"
|
||||
#if defined(CONFIG_BT_ENABLED) && defined(CONFIG_BT_NIMBLE_ROLE_BROADCASTER) && CONFIG_BT_NIMBLE_EXT_ADV
|
||||
#if CONFIG_BT_ENABLED && CONFIG_BT_NIMBLE_ROLE_BROADCASTER && CONFIG_BT_NIMBLE_EXT_ADV
|
||||
|
||||
# if defined(CONFIG_NIMBLE_CPP_IDF)
|
||||
# include "host/ble_gap.h"
|
||||
|
@ -15,10 +15,9 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "nimconfig.h"
|
||||
#if defined(CONFIG_BT_ENABLED) && defined(CONFIG_BT_NIMBLE_ROLE_PERIPHERAL)
|
||||
#include "NimBLEHIDDevice.h"
|
||||
#if CONFIG_BT_ENABLED && CONFIG_BT_NIMBLE_ROLE_BROADCASTER && CONFIG_BT_NIMBLE_ROLE_PERIPHERAL
|
||||
|
||||
# include "NimBLEHIDDevice.h"
|
||||
# include "NimBLEServer.h"
|
||||
# include "NimBLEService.h"
|
||||
# include "NimBLE2904.h"
|
||||
@ -341,4 +340,4 @@ NimBLEService* NimBLEHIDDevice::getBatteryService() {
|
||||
return m_batterySvc;
|
||||
} // getBatteryService
|
||||
|
||||
#endif /* CONFIG_BT_ENABLED && CONFIG_BT_NIMBLE_ROLE_PERIPHERAL */
|
||||
#endif // CONFIG_BT_ENABLED && CONFIG_BT_NIMBLE_ROLE_PERIPHERAL
|
||||
|
@ -19,7 +19,7 @@
|
||||
#define NIMBLE_CPP_HIDDEVICE_H_
|
||||
|
||||
#include "nimconfig.h"
|
||||
#if defined(CONFIG_BT_ENABLED) && defined(CONFIG_BT_NIMBLE_ROLE_BROADCASTER) && defined(CONFIG_BT_NIMBLE_ROLE_PERIPHERAL)
|
||||
#if CONFIG_BT_ENABLED && CONFIG_BT_NIMBLE_ROLE_BROADCASTER && CONFIG_BT_NIMBLE_ROLE_PERIPHERAL
|
||||
|
||||
# include <stdint.h>
|
||||
# include <string>
|
||||
@ -85,5 +85,5 @@ class NimBLEHIDDevice {
|
||||
NimBLECharacteristic* locateReportCharacteristicByIdAndType(uint8_t reportId, uint8_t reportType);
|
||||
};
|
||||
|
||||
#endif // CONFIG_BT_ENABLED && CONFIG_BT_NIMBLE_ROLE_BROADCASTER && defined(CONFIG_BT_NIMBLE_ROLE_PERIPHERAL)
|
||||
#endif // CONFIG_BT_ENABLED && CONFIG_BT_NIMBLE_ROLE_BROADCASTER && CONFIG_BT_NIMBLE_ROLE_PERIPHERAL
|
||||
#endif // NIMBLE_CPP_HIDDEVICE_H_
|
||||
|
@ -1,21 +1,29 @@
|
||||
//
|
||||
// (C) Dr. Michael 'Mickey' Lauer <mickey@vanille-media.de>
|
||||
//
|
||||
#include "NimBLEL2CAPChannel.h"
|
||||
|
||||
#include "NimBLEClient.h"
|
||||
#include "NimBLELog.h"
|
||||
#include "NimBLEUtils.h"
|
||||
#include "NimBLEL2CAPChannel.h"
|
||||
#if CONFIG_BT_ENABLED && CONFIG_BT_NIMBLE_L2CAP_COC_MAX_NUM
|
||||
|
||||
# include "NimBLEClient.h"
|
||||
# include "NimBLELog.h"
|
||||
# include "NimBLEUtils.h"
|
||||
|
||||
# if defined(CONFIG_NIMBLE_CPP_IDF)
|
||||
# include "host/ble_gap.h"
|
||||
# else
|
||||
# include "nimble/nimble/host/include/host/ble_gap.h"
|
||||
# endif
|
||||
|
||||
// L2CAP buffer block size
|
||||
#define L2CAP_BUF_BLOCK_SIZE (250)
|
||||
#define L2CAP_BUF_SIZE_MTUS_PER_CHANNEL (3)
|
||||
# define L2CAP_BUF_BLOCK_SIZE (250)
|
||||
# define L2CAP_BUF_SIZE_MTUS_PER_CHANNEL (3)
|
||||
// Round-up integer division
|
||||
#define CEIL_DIVIDE(a, b) (((a) + (b) - 1) / (b))
|
||||
#define ROUND_DIVIDE(a, b) (((a) + (b) / 2) / (b))
|
||||
# define CEIL_DIVIDE(a, b) (((a) + (b) - 1) / (b))
|
||||
# define ROUND_DIVIDE(a, b) (((a) + (b) / 2) / (b))
|
||||
// Retry
|
||||
constexpr uint32_t RetryTimeout = 50;
|
||||
constexpr int RetryCounter = 3;
|
||||
constexpr int RetryCounter = 3;
|
||||
|
||||
NimBLEL2CAPChannel::NimBLEL2CAPChannel(uint16_t psm, uint16_t mtu, NimBLEL2CAPChannelCallbacks* callbacks)
|
||||
: psm(psm), mtu(mtu), callbacks(callbacks) {
|
||||
@ -84,7 +92,7 @@ int NimBLEL2CAPChannel::writeFragment(std::vector<uint8_t>::const_iterator begin
|
||||
m_pTaskData = &taskData;
|
||||
NimBLEUtils::taskWait(taskData, BLE_NPL_TIME_FOREVER);
|
||||
m_pTaskData = nullptr;
|
||||
stalled = false;
|
||||
stalled = false;
|
||||
NIMBLE_LOGD(LOG_TAG, "L2CAP Channel unstalled!");
|
||||
}
|
||||
|
||||
@ -141,7 +149,7 @@ int NimBLEL2CAPChannel::writeFragment(std::vector<uint8_t>::const_iterator begin
|
||||
return -BLE_HS_EREJECT;
|
||||
}
|
||||
|
||||
#if defined(CONFIG_BT_ENABLED) && defined(CONFIG_BT_NIMBLE_ROLE_CENTRAL)
|
||||
# if CONFIG_BT_NIMBLE_ROLE_CENTRAL
|
||||
NimBLEL2CAPChannel* NimBLEL2CAPChannel::connect(NimBLEClient* client,
|
||||
uint16_t psm,
|
||||
uint16_t mtu,
|
||||
@ -166,7 +174,7 @@ NimBLEL2CAPChannel* NimBLEL2CAPChannel::connect(NimBLEClient* cli
|
||||
}
|
||||
return channel;
|
||||
}
|
||||
#endif // CONFIG_BT_ENABLED && CONFIG_BT_NIMBLE_ROLE_CENTRAL
|
||||
# endif // CONFIG_BT_NIMBLE_ROLE_CENTRAL
|
||||
|
||||
bool NimBLEL2CAPChannel::write(const std::vector<uint8_t>& bytes) {
|
||||
if (!this->channel) {
|
||||
@ -302,3 +310,5 @@ int NimBLEL2CAPChannel::handleL2capEvent(struct ble_l2cap_event* event, void* ar
|
||||
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
#endif // #if CONFIG_BT_ENABLED && CONFIG_BT_NIMBLE_L2CAP_COC_MAX_NUM
|
||||
|
@ -1,11 +1,12 @@
|
||||
//
|
||||
// (C) Dr. Michael 'Mickey' Lauer <mickey@vanille-media.de>
|
||||
//
|
||||
#pragma once
|
||||
#ifndef NIMBLEL2CAPCHANNEL_H
|
||||
# define NIMBLEL2CAPCHANNEL_H
|
||||
|
||||
# include "nimconfig.h"
|
||||
#ifndef NIMBLE_CPP_L2CAPCHANNEL_H_
|
||||
#define NIMBLE_CPP_L2CAPCHANNEL_H_
|
||||
|
||||
#include "nimconfig.h"
|
||||
#if CONFIG_BT_ENABLED && CONFIG_BT_NIMBLE_L2CAP_COC_MAX_NUM
|
||||
|
||||
# include "inttypes.h"
|
||||
# if defined(CONFIG_NIMBLE_CPP_IDF)
|
||||
@ -85,7 +86,7 @@ class NimBLEL2CAPChannel {
|
||||
|
||||
// Runtime handling
|
||||
std::atomic<bool> stalled{false};
|
||||
NimBLETaskData* m_pTaskData{nullptr};
|
||||
NimBLETaskData* m_pTaskData{nullptr};
|
||||
|
||||
// Allocate / deallocate NimBLE memory pool
|
||||
bool setupMemPool();
|
||||
@ -121,4 +122,5 @@ class NimBLEL2CAPChannelCallbacks {
|
||||
virtual void onDisconnect(NimBLEL2CAPChannel* channel) {};
|
||||
};
|
||||
|
||||
#endif
|
||||
#endif // CONFIG_BT_ENABLED && CONFIG_BT_NIMBLE_L2CAP_COC_MAX_NUM
|
||||
#endif // NIMBLE_CPP_L2CAPCHANNEL_H_
|
||||
|
@ -1,10 +1,13 @@
|
||||
//
|
||||
// (C) Dr. Michael 'Mickey' Lauer <mickey@vanille-media.de>
|
||||
//
|
||||
|
||||
#include "NimBLEL2CAPServer.h"
|
||||
#include "NimBLEL2CAPChannel.h"
|
||||
#include "NimBLEDevice.h"
|
||||
#include "NimBLELog.h"
|
||||
#if CONFIG_BT_ENABLED && CONFIG_BT_NIMBLE_L2CAP_COC_MAX_NUM
|
||||
|
||||
# include "NimBLEL2CAPChannel.h"
|
||||
# include "NimBLEDevice.h"
|
||||
# include "NimBLELog.h"
|
||||
|
||||
static const char* LOG_TAG = "NimBLEL2CAPServer";
|
||||
|
||||
@ -33,3 +36,5 @@ NimBLEL2CAPChannel* NimBLEL2CAPServer::createService(const uint16_t
|
||||
this->services.push_back(service);
|
||||
return service;
|
||||
}
|
||||
|
||||
#endif // CONFIG_BT_ENABLED && CONFIG_BT_NIMBLE_L2CAP_COC_MAX_NUM
|
||||
|
@ -1,12 +1,14 @@
|
||||
//
|
||||
// (C) Dr. Michael 'Mickey' Lauer <mickey@vanille-media.de>
|
||||
//
|
||||
#ifndef NIMBLEL2CAPSERVER_H
|
||||
#define NIMBLEL2CAPSERVER_H
|
||||
#pragma once
|
||||
|
||||
#include "inttypes.h"
|
||||
#include <vector>
|
||||
#ifndef NIMBLE_CPP_L2CAPSERVER_H_
|
||||
#define NIMBLE_CPP_L2CAPSERVER_H_
|
||||
#include "nimconfig.h"
|
||||
#if CONFIG_BT_ENABLED && CONFIG_BT_NIMBLE_L2CAP_COC_MAX_NUM
|
||||
|
||||
# include "inttypes.h"
|
||||
# include <vector>
|
||||
|
||||
class NimBLEL2CAPChannel;
|
||||
class NimBLEL2CAPChannelCallbacks;
|
||||
@ -35,4 +37,5 @@ class NimBLEL2CAPServer {
|
||||
friend class NimBLEDevice;
|
||||
};
|
||||
|
||||
#endif
|
||||
#endif // CONFIG_BT_ENABLED && CONFIG_BT_NIMBLE_L2CAP_COC_MAX_NUM
|
||||
#endif // NIMBLE_CPP_L2CAPSERVER_H_
|
||||
|
@ -19,7 +19,7 @@
|
||||
#define NIMBLE_CPP_LOCAL_ATTRIBUTE_H_
|
||||
|
||||
#include "nimconfig.h"
|
||||
#if defined(CONFIG_BT_ENABLED) && defined(CONFIG_BT_NIMBLE_ROLE_PERIPHERAL)
|
||||
#if CONFIG_BT_ENABLED && CONFIG_BT_NIMBLE_ROLE_PERIPHERAL
|
||||
|
||||
# include "NimBLEAttribute.h"
|
||||
|
||||
|
@ -19,7 +19,7 @@
|
||||
#define NIMBLE_LOCAL_VALUE_ATTRIBUTE_H_
|
||||
|
||||
#include "nimconfig.h"
|
||||
#if defined(CONFIG_BT_ENABLED) && defined(CONFIG_BT_NIMBLE_ROLE_PERIPHERAL)
|
||||
#if CONFIG_BT_ENABLED && CONFIG_BT_NIMBLE_ROLE_PERIPHERAL
|
||||
|
||||
# if defined(CONFIG_NIMBLE_CPP_IDF)
|
||||
# include "host/ble_hs.h"
|
||||
|
@ -19,7 +19,7 @@
|
||||
#define NIMBLE_CPP_LOG_H_
|
||||
|
||||
#include "nimconfig.h"
|
||||
#if defined(CONFIG_BT_ENABLED)
|
||||
#if CONFIG_BT_ENABLED
|
||||
|
||||
# if defined(CONFIG_NIMBLE_CPP_IDF)
|
||||
# include "esp_log.h"
|
||||
|
@ -15,10 +15,9 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "nimconfig.h"
|
||||
#if defined(CONFIG_BT_ENABLED) && defined(CONFIG_BT_NIMBLE_ROLE_CENTRAL)
|
||||
#include "NimBLERemoteCharacteristic.h"
|
||||
#if CONFIG_BT_ENABLED && CONFIG_BT_NIMBLE_ROLE_CENTRAL
|
||||
|
||||
# include "NimBLERemoteCharacteristic.h"
|
||||
# include "NimBLERemoteDescriptor.h"
|
||||
# include "NimBLERemoteService.h"
|
||||
# include "NimBLEClient.h"
|
||||
@ -388,4 +387,4 @@ NimBLEClient* NimBLERemoteCharacteristic::getClient() const {
|
||||
return getRemoteService()->getClient();
|
||||
} // getClient
|
||||
|
||||
#endif /* CONFIG_BT_ENABLED && CONFIG_BT_NIMBLE_ROLE_CENTRAL */
|
||||
#endif // CONFIG_BT_ENABLED && CONFIG_BT_NIMBLE_ROLE_CENTRAL
|
||||
|
@ -19,7 +19,7 @@
|
||||
#define NIMBLE_CPP_REMOTE_CHARACTERISTIC_H_
|
||||
|
||||
#include "nimconfig.h"
|
||||
#if defined(CONFIG_BT_ENABLED) && defined(CONFIG_BT_NIMBLE_ROLE_CENTRAL)
|
||||
#if CONFIG_BT_ENABLED && CONFIG_BT_NIMBLE_ROLE_CENTRAL
|
||||
|
||||
# include "NimBLERemoteValueAttribute.h"
|
||||
# include <vector>
|
||||
|
@ -15,10 +15,9 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "nimconfig.h"
|
||||
#if defined(CONFIG_BT_ENABLED) && defined(CONFIG_BT_NIMBLE_ROLE_CENTRAL)
|
||||
#include "NimBLERemoteDescriptor.h"
|
||||
#if CONFIG_BT_ENABLED && CONFIG_BT_NIMBLE_ROLE_CENTRAL
|
||||
|
||||
# include "NimBLERemoteDescriptor.h"
|
||||
# include "NimBLERemoteCharacteristic.h"
|
||||
|
||||
/**
|
||||
@ -57,4 +56,4 @@ NimBLEClient* NimBLERemoteDescriptor::getClient() const {
|
||||
return m_pRemoteCharacteristic->getClient();
|
||||
}
|
||||
|
||||
#endif /* CONFIG_BT_ENABLED && CONFIG_BT_NIMBLE_ROLE_CENTRAL */
|
||||
#endif // CONFIG_BT_ENABLED && CONFIG_BT_NIMBLE_ROLE_CENTRAL
|
||||
|
@ -19,7 +19,7 @@
|
||||
#define NIMBLE_CPP_REMOTE_DESCRIPTOR_H_
|
||||
|
||||
#include "nimconfig.h"
|
||||
#if defined(CONFIG_BT_ENABLED) && defined(CONFIG_BT_NIMBLE_ROLE_CENTRAL)
|
||||
#if CONFIG_BT_ENABLED && CONFIG_BT_NIMBLE_ROLE_CENTRAL
|
||||
|
||||
# include "NimBLERemoteValueAttribute.h"
|
||||
|
||||
@ -44,5 +44,5 @@ class NimBLERemoteDescriptor : public NimBLERemoteValueAttribute {
|
||||
const NimBLERemoteCharacteristic* m_pRemoteCharacteristic;
|
||||
};
|
||||
|
||||
#endif /* CONFIG_BT_ENABLED && CONFIG_BT_NIMBLE_ROLE_CENTRAL */
|
||||
#endif /* NIMBLE_CPP_REMOTE_DESCRIPTOR_H_ */
|
||||
#endif // CONFIG_BT_ENABLED && CONFIG_BT_NIMBLE_ROLE_CENTRAL
|
||||
#endif // NIMBLE_CPP_REMOTE_DESCRIPTOR_H_
|
||||
|
@ -15,10 +15,9 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "nimconfig.h"
|
||||
#if defined(CONFIG_BT_ENABLED) && defined(CONFIG_BT_NIMBLE_ROLE_CENTRAL)
|
||||
#include "NimBLERemoteService.h"
|
||||
#if CONFIG_BT_ENABLED && CONFIG_BT_NIMBLE_ROLE_CENTRAL
|
||||
|
||||
# include "NimBLERemoteService.h"
|
||||
# include "NimBLERemoteCharacteristic.h"
|
||||
# include "NimBLEClient.h"
|
||||
# include "NimBLEAttValue.h"
|
||||
@ -303,4 +302,4 @@ std::string NimBLERemoteService::toString() const {
|
||||
return res;
|
||||
} // toString
|
||||
|
||||
#endif /* CONFIG_BT_ENABLED && CONFIG_BT_NIMBLE_ROLE_CENTRAL */
|
||||
#endif // CONFIG_BT_ENABLED && CONFIG_BT_NIMBLE_ROLE_CENTRAL
|
||||
|
@ -19,7 +19,7 @@
|
||||
#define NIMBLE_CPP_REMOTE_SERVICE_H_
|
||||
|
||||
#include "nimconfig.h"
|
||||
#if defined(CONFIG_BT_ENABLED) && defined(CONFIG_BT_NIMBLE_ROLE_CENTRAL)
|
||||
#if CONFIG_BT_ENABLED && CONFIG_BT_NIMBLE_ROLE_CENTRAL
|
||||
|
||||
# include "NimBLEAttribute.h"
|
||||
# include <vector>
|
||||
@ -64,5 +64,5 @@ class NimBLERemoteService : public NimBLEAttribute {
|
||||
uint16_t m_endHandle{0};
|
||||
}; // NimBLERemoteService
|
||||
|
||||
#endif /* CONFIG_BT_ENABLED && CONFIG_BT_NIMBLE_ROLE_CENTRAL */
|
||||
#endif /* NIMBLE_CPP_REMOTE_SERVICE_H_*/
|
||||
#endif // CONFIG_BT_ENABLED && CONFIG_BT_NIMBLE_ROLE_CENTRAL
|
||||
#endif // NIMBLE_CPP_REMOTE_SERVICE_H_
|
||||
|
@ -15,10 +15,9 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "nimconfig.h"
|
||||
#if defined(CONFIG_BT_ENABLED) && defined(CONFIG_BT_NIMBLE_ROLE_CENTRAL)
|
||||
#include "NimBLERemoteValueAttribute.h"
|
||||
#if CONFIG_BT_ENABLED && CONFIG_BT_NIMBLE_ROLE_CENTRAL
|
||||
|
||||
# include "NimBLERemoteValueAttribute.h"
|
||||
# include "NimBLEClient.h"
|
||||
# include "NimBLEUtils.h"
|
||||
# include "NimBLELog.h"
|
||||
|
@ -19,7 +19,7 @@
|
||||
#define NIMBLE_CPP_REMOTE_VALUE_ATTRIBUTE_H_
|
||||
|
||||
#include "nimconfig.h"
|
||||
#if defined(CONFIG_BT_ENABLED) && defined(CONFIG_BT_NIMBLE_ROLE_CENTRAL)
|
||||
#if CONFIG_BT_ENABLED && CONFIG_BT_NIMBLE_ROLE_CENTRAL
|
||||
|
||||
# if defined(CONFIG_NIMBLE_CPP_IDF)
|
||||
# include <host/ble_gatt.h>
|
||||
@ -170,5 +170,5 @@ class NimBLERemoteValueAttribute : public NimBLEValueAttribute, public NimBLEAtt
|
||||
static int onWriteCB(uint16_t conn_handle, const ble_gatt_error* error, ble_gatt_attr* attr, void* arg);
|
||||
};
|
||||
|
||||
#endif /* CONFIG_BT_ENABLED && CONFIG_BT_NIMBLE_ROLE_CENTRAL */
|
||||
#endif // CONFIG_BT_ENABLED && CONFIG_BT_NIMBLE_ROLE_CENTRAL
|
||||
#endif // NIMBLE_CPP_REMOTE_VALUE_ATTRIBUTE_H_
|
||||
|
@ -15,10 +15,9 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "nimconfig.h"
|
||||
#if defined(CONFIG_BT_ENABLED) && defined(CONFIG_BT_NIMBLE_ROLE_OBSERVER)
|
||||
#include "NimBLEScan.h"
|
||||
#if CONFIG_BT_ENABLED && CONFIG_BT_NIMBLE_ROLE_OBSERVER
|
||||
|
||||
# include "NimBLEScan.h"
|
||||
# include "NimBLEDevice.h"
|
||||
# include "NimBLELog.h"
|
||||
|
||||
@ -73,7 +72,7 @@ int NimBLEScan::handleGapEvent(ble_gap_event* event, void* arg) {
|
||||
# endif
|
||||
NimBLEAddress advertisedAddress(disc.addr);
|
||||
|
||||
# ifdef CONFIG_BT_NIMBLE_ROLE_CENTRAL
|
||||
# if CONFIG_BT_NIMBLE_ROLE_CENTRAL
|
||||
// stop processing if already connected
|
||||
NimBLEClient* pClient = NimBLEDevice::getClientByPeerAddress(advertisedAddress);
|
||||
if (pClient != nullptr && pClient->isConnected()) {
|
||||
@ -559,4 +558,4 @@ void NimBLEScanCallbacks::onScanEnd(const NimBLEScanResults& results, int reason
|
||||
NIMBLE_LOGD(CB_TAG, "Scan ended; reason %d, num results: %d", reason, results.getCount());
|
||||
}
|
||||
|
||||
#endif /* CONFIG_BT_ENABLED && CONFIG_BT_NIMBLE_ROLE_OBSERVER */
|
||||
#endif // CONFIG_BT_ENABLED && CONFIG_BT_NIMBLE_ROLE_OBSERVER
|
||||
|
@ -19,7 +19,7 @@
|
||||
#define NIMBLE_CPP_SCAN_H_
|
||||
|
||||
#include "nimconfig.h"
|
||||
#if defined(CONFIG_BT_ENABLED) && defined(CONFIG_BT_NIMBLE_ROLE_OBSERVER)
|
||||
#if CONFIG_BT_ENABLED && CONFIG_BT_NIMBLE_ROLE_OBSERVER
|
||||
|
||||
# include "NimBLEAdvertisedDevice.h"
|
||||
# include "NimBLEUtils.h"
|
||||
|
@ -15,14 +15,13 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "nimconfig.h"
|
||||
#if defined(CONFIG_BT_ENABLED) && defined(CONFIG_BT_NIMBLE_ROLE_PERIPHERAL)
|
||||
#include "NimBLEServer.h"
|
||||
#if CONFIG_BT_ENABLED && CONFIG_BT_NIMBLE_ROLE_PERIPHERAL
|
||||
|
||||
# include "NimBLEServer.h"
|
||||
# include "NimBLEDevice.h"
|
||||
# include "NimBLELog.h"
|
||||
|
||||
# if defined(CONFIG_BT_NIMBLE_ROLE_CENTRAL)
|
||||
# if CONFIG_BT_NIMBLE_ROLE_CENTRAL
|
||||
# include "NimBLEClient.h"
|
||||
# endif
|
||||
|
||||
@ -70,7 +69,7 @@ NimBLEServer::~NimBLEServer() {
|
||||
delete m_pServerCallbacks;
|
||||
}
|
||||
|
||||
# if defined(CONFIG_BT_NIMBLE_ROLE_CENTRAL)
|
||||
# if CONFIG_BT_NIMBLE_ROLE_CENTRAL
|
||||
if (m_pClient != nullptr) {
|
||||
delete m_pClient;
|
||||
}
|
||||
@ -154,7 +153,7 @@ NimBLEExtAdvertising* NimBLEServer::getAdvertising() const {
|
||||
} // getAdvertising
|
||||
# endif
|
||||
|
||||
# if !CONFIG_BT_NIMBLE_EXT_ADV || defined(_DOXYGEN_)
|
||||
# if (!CONFIG_BT_NIMBLE_EXT_ADV && CONFIG_BT_NIMBLE_ROLE_BROADCASTER) || defined(_DOXYGEN_)
|
||||
/**
|
||||
* @brief Retrieve the advertising object that can be used to advertise the existence of the server.
|
||||
* @return A pointer to an advertising object.
|
||||
@ -357,7 +356,7 @@ int NimBLEServer::handleGapEvent(ble_gap_event* event, void* arg) {
|
||||
case BLE_GAP_EVENT_CONNECT: {
|
||||
if (event->connect.status != 0) {
|
||||
NIMBLE_LOGE(LOG_TAG, "Connection failed");
|
||||
# if !CONFIG_BT_NIMBLE_EXT_ADV
|
||||
# if !CONFIG_BT_NIMBLE_EXT_ADV && CONFIG_BT_NIMBLE_ROLE_BROADCASTER
|
||||
NimBLEDevice::startAdvertising();
|
||||
# endif
|
||||
} else {
|
||||
@ -401,7 +400,7 @@ int NimBLEServer::handleGapEvent(ble_gap_event* event, void* arg) {
|
||||
}
|
||||
}
|
||||
|
||||
# if defined(CONFIG_BT_NIMBLE_ROLE_CENTRAL)
|
||||
# if CONFIG_BT_NIMBLE_ROLE_CENTRAL
|
||||
if (pServer->m_pClient && pServer->m_pClient->m_connHandle == event->disconnect.conn.conn_handle) {
|
||||
// If this was also the client make sure it's flagged as disconnected.
|
||||
pServer->m_pClient->m_connHandle = BLE_HS_CONN_HANDLE_NONE;
|
||||
@ -488,10 +487,10 @@ int NimBLEServer::handleGapEvent(ble_gap_event* event, void* arg) {
|
||||
} // BLE_GAP_EVENT_NOTIFY_TX
|
||||
|
||||
case BLE_GAP_EVENT_ADV_COMPLETE: {
|
||||
# if CONFIG_BT_NIMBLE_EXT_ADV
|
||||
# if CONFIG_BT_NIMBLE_EXT_ADV && CONFIG_BT_NIMBLE_ROLE_BROADCASTER
|
||||
case BLE_GAP_EVENT_SCAN_REQ_RCVD:
|
||||
return NimBLEExtAdvertising::handleGapEvent(event, arg);
|
||||
# else
|
||||
# elif CONFIG_BT_NIMBLE_ROLE_BROADCASTER
|
||||
return NimBLEAdvertising::handleGapEvent(event, arg);
|
||||
# endif
|
||||
} // BLE_GAP_EVENT_ADV_COMPLETE | BLE_GAP_EVENT_SCAN_REQ_RCVD
|
||||
@ -726,7 +725,7 @@ void NimBLEServer::removeService(NimBLEService* service, bool deleteSvc) {
|
||||
|
||||
service->setRemoved(deleteSvc ? NIMBLE_ATT_REMOVE_DELETE : NIMBLE_ATT_REMOVE_HIDE);
|
||||
serviceChanged();
|
||||
# if !CONFIG_BT_NIMBLE_EXT_ADV
|
||||
# if !CONFIG_BT_NIMBLE_EXT_ADV && CONFIG_BT_NIMBLE_ROLE_BROADCASTER
|
||||
NimBLEDevice::getAdvertising()->removeServiceUUID(service->getUUID());
|
||||
# endif
|
||||
} // removeService
|
||||
@ -763,7 +762,9 @@ void NimBLEServer::resetGATT() {
|
||||
return;
|
||||
}
|
||||
|
||||
# if CONFIG_BT_NIMBLE_ROLE_BROADCASTER
|
||||
NimBLEDevice::stopAdvertising();
|
||||
# endif
|
||||
ble_gatts_reset();
|
||||
ble_svc_gap_init();
|
||||
ble_svc_gatt_init();
|
||||
@ -855,7 +856,7 @@ bool NimBLEServer::stopAdvertising(uint8_t instId) const {
|
||||
|
||||
# endif
|
||||
|
||||
# if !CONFIG_BT_NIMBLE_EXT_ADV || defined(_DOXYGEN_)
|
||||
# if (!CONFIG_BT_NIMBLE_EXT_ADV && CONFIG_BT_NIMBLE_ROLE_BROADCASTER) || defined(_DOXYGEN_)
|
||||
/**
|
||||
* @brief Start advertising.
|
||||
* @param [in] duration The duration in milliseconds to advertise for, default = forever.
|
||||
@ -932,7 +933,7 @@ void NimBLEServer::setDataLen(uint16_t connHandle, uint16_t octets) const {
|
||||
# endif
|
||||
} // setDataLen
|
||||
|
||||
# if defined(CONFIG_BT_NIMBLE_ROLE_CENTRAL)
|
||||
# if CONFIG_BT_NIMBLE_ROLE_CENTRAL
|
||||
/**
|
||||
* @brief Create a client instance from the connection handle.
|
||||
* @param [in] connHandle The connection handle to create a client instance from.
|
||||
@ -1019,4 +1020,4 @@ void NimBLEServerCallbacks::onPhyUpdate(NimBLEConnInfo& connInfo, uint8_t txPhy,
|
||||
NIMBLE_LOGD("NimBLEServerCallbacks", "onPhyUpdate: default, txPhy: %d, rxPhy: %d", txPhy, rxPhy);
|
||||
} // onPhyUpdate
|
||||
|
||||
#endif /* CONFIG_BT_ENABLED && CONFIG_BT_NIMBLE_ROLE_PERIPHERAL */
|
||||
#endif // CONFIG_BT_ENABLED && CONFIG_BT_NIMBLE_ROLE_PERIPHERAL
|
||||
|
@ -19,7 +19,7 @@
|
||||
#define NIMBLE_CPP_SERVER_H_
|
||||
|
||||
#include "nimconfig.h"
|
||||
#if defined(CONFIG_BT_ENABLED) && defined(CONFIG_BT_NIMBLE_ROLE_PERIPHERAL)
|
||||
#if CONFIG_BT_ENABLED && CONFIG_BT_NIMBLE_ROLE_PERIPHERAL
|
||||
|
||||
# if defined(CONFIG_NIMBLE_CPP_IDF)
|
||||
# include "host/ble_gap.h"
|
||||
@ -45,12 +45,14 @@ class NimBLEConnInfo;
|
||||
class NimBLEAddress;
|
||||
class NimBLEService;
|
||||
class NimBLECharacteristic;
|
||||
# if CONFIG_BT_NIMBLE_EXT_ADV
|
||||
# if CONFIG_BT_NIMBLE_ROLE_BROADCASTER
|
||||
# if CONFIG_BT_NIMBLE_EXT_ADV
|
||||
class NimBLEExtAdvertising;
|
||||
# else
|
||||
# else
|
||||
class NimBLEAdvertising;
|
||||
# endif
|
||||
# endif
|
||||
# if defined(CONFIG_BT_NIMBLE_ROLE_CENTRAL)
|
||||
# if CONFIG_BT_NIMBLE_ROLE_CENTRAL
|
||||
class NimBLEClient;
|
||||
# endif
|
||||
|
||||
@ -82,32 +84,36 @@ class NimBLEServer {
|
||||
bool updatePhy(uint16_t connHandle, uint8_t txPhysMask, uint8_t rxPhysMask, uint16_t phyOptions);
|
||||
bool getPhy(uint16_t connHandle, uint8_t* txPhy, uint8_t* rxPhy);
|
||||
|
||||
# if defined(CONFIG_BT_NIMBLE_ROLE_CENTRAL)
|
||||
# if CONFIG_BT_NIMBLE_ROLE_CENTRAL
|
||||
NimBLEClient* getClient(uint16_t connHandle);
|
||||
NimBLEClient* getClient(const NimBLEConnInfo& connInfo);
|
||||
void deleteClient();
|
||||
# endif
|
||||
|
||||
# if CONFIG_BT_NIMBLE_EXT_ADV
|
||||
# if CONFIG_BT_NIMBLE_ROLE_BROADCASTER
|
||||
# if CONFIG_BT_NIMBLE_EXT_ADV
|
||||
NimBLEExtAdvertising* getAdvertising() const;
|
||||
bool startAdvertising(uint8_t instanceId, int duration = 0, int maxEvents = 0) const;
|
||||
bool stopAdvertising(uint8_t instanceId) const;
|
||||
# endif
|
||||
# endif
|
||||
|
||||
# if !CONFIG_BT_NIMBLE_EXT_ADV || defined(_DOXYGEN_)
|
||||
# if !CONFIG_BT_NIMBLE_EXT_ADV || defined(_DOXYGEN_)
|
||||
NimBLEAdvertising* getAdvertising() const;
|
||||
bool startAdvertising(uint32_t duration = 0) const;
|
||||
bool stopAdvertising() const;
|
||||
# endif
|
||||
# endif
|
||||
|
||||
private:
|
||||
friend class NimBLEDevice;
|
||||
friend class NimBLEService;
|
||||
friend class NimBLECharacteristic;
|
||||
# if CONFIG_BT_NIMBLE_EXT_ADV
|
||||
# if CONFIG_BT_NIMBLE_ROLE_BROADCASTER
|
||||
# if CONFIG_BT_NIMBLE_EXT_ADV
|
||||
friend class NimBLEExtAdvertising;
|
||||
# else
|
||||
# else
|
||||
friend class NimBLEAdvertising;
|
||||
# endif
|
||||
# endif
|
||||
|
||||
NimBLEServer();
|
||||
@ -123,7 +129,7 @@ class NimBLEServer {
|
||||
std::vector<NimBLEService*> m_svcVec;
|
||||
std::array<uint16_t, CONFIG_BT_NIMBLE_MAX_CONNECTIONS> m_connectedPeers;
|
||||
|
||||
# if defined(CONFIG_BT_NIMBLE_ROLE_CENTRAL)
|
||||
# if CONFIG_BT_NIMBLE_ROLE_CENTRAL
|
||||
NimBLEClient* m_pClient{nullptr};
|
||||
# endif
|
||||
|
||||
|
@ -15,10 +15,9 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "nimconfig.h"
|
||||
#if defined(CONFIG_BT_ENABLED) && defined(CONFIG_BT_NIMBLE_ROLE_PERIPHERAL)
|
||||
#include "NimBLEService.h"
|
||||
#if CONFIG_BT_ENABLED && CONFIG_BT_NIMBLE_ROLE_PERIPHERAL
|
||||
|
||||
# include "NimBLEService.h"
|
||||
# if CONFIG_BT_NIMBLE_EXT_ADV
|
||||
# include "NimBLEExtAdvertising.h"
|
||||
# else
|
||||
@ -376,4 +375,4 @@ bool NimBLEService::isStarted() const {
|
||||
return m_pSvcDef->type > 0;
|
||||
} // isStarted
|
||||
|
||||
#endif /* CONFIG_BT_ENABLED && CONFIG_BT_NIMBLE_ROLE_PERIPHERAL */
|
||||
#endif // CONFIG_BT_ENABLED && CONFIG_BT_NIMBLE_ROLE_PERIPHERAL
|
||||
|
@ -19,7 +19,7 @@
|
||||
#define NIMBLE_CPP_SERVICE_H_
|
||||
|
||||
#include "nimconfig.h"
|
||||
#if defined(CONFIG_BT_ENABLED) && defined(CONFIG_BT_NIMBLE_ROLE_PERIPHERAL)
|
||||
#if CONFIG_BT_ENABLED && CONFIG_BT_NIMBLE_ROLE_PERIPHERAL
|
||||
|
||||
class NimBLEService;
|
||||
|
||||
@ -69,5 +69,5 @@ class NimBLEService : public NimBLELocalAttribute {
|
||||
ble_gatt_svc_def m_pSvcDef[2]{};
|
||||
}; // NimBLEService
|
||||
|
||||
#endif /* CONFIG_BT_ENABLED && CONFIG_BT_NIMBLE_ROLE_PERIPHERAL */
|
||||
#endif /* NIMBLE_CPP_SERVICE_H_ */
|
||||
#endif // CONFIG_BT_ENABLED && CONFIG_BT_NIMBLE_ROLE_PERIPHERAL
|
||||
#endif // NIMBLE_CPP_SERVICE_H_
|
||||
|
@ -15,11 +15,10 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "nimconfig.h"
|
||||
#if defined(CONFIG_BT_ENABLED)
|
||||
#include "NimBLEUUID.h"
|
||||
#if CONFIG_BT_ENABLED
|
||||
|
||||
# include "NimBLEUtils.h"
|
||||
# include "NimBLEUUID.h"
|
||||
# include "NimBLELog.h"
|
||||
|
||||
/**** FIX COMPILATION ****/
|
||||
|
@ -19,7 +19,7 @@
|
||||
#define NIMBLE_CPP_UUID_H_
|
||||
|
||||
#include "nimconfig.h"
|
||||
#if defined(CONFIG_BT_ENABLED)
|
||||
#if CONFIG_BT_ENABLED
|
||||
|
||||
# if defined(CONFIG_NIMBLE_CPP_IDF)
|
||||
# include "host/ble_uuid.h"
|
||||
@ -70,5 +70,5 @@ class NimBLEUUID {
|
||||
ble_uuid_any_t m_uuid{};
|
||||
}; // NimBLEUUID
|
||||
|
||||
#endif /* CONFIG_BT_ENABLED */
|
||||
#endif /* NIMBLE_CPP_UUID_H_ */
|
||||
#endif // CONFIG_BT_ENABLED
|
||||
#endif // NIMBLE_CPP_UUID_H_
|
||||
|
@ -15,10 +15,9 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "nimconfig.h"
|
||||
#if defined(CONFIG_BT_ENABLED)
|
||||
#include "NimBLEUtils.h"
|
||||
#if CONFIG_BT_ENABLED
|
||||
|
||||
# include "NimBLEUtils.h"
|
||||
# include "NimBLEAddress.h"
|
||||
# include "NimBLELog.h"
|
||||
|
||||
|
@ -19,7 +19,8 @@
|
||||
#define NIMBLE_CPP_UTILS_H_
|
||||
|
||||
#include "nimconfig.h"
|
||||
#if defined(CONFIG_BT_ENABLED)
|
||||
#if CONFIG_BT_ENABLED
|
||||
|
||||
# include <string>
|
||||
|
||||
class NimBLEAddress;
|
||||
|
@ -19,7 +19,7 @@
|
||||
#define NIMBLE_CPP_VALUE_ATTRIBUTE_H_
|
||||
|
||||
#include "nimconfig.h"
|
||||
#if defined(CONFIG_BT_ENABLED) && (defined(CONFIG_BT_NIMBLE_ROLE_PERIPHERAL) || defined(CONFIG_BT_NIMBLE_ROLE_CENTRAL))
|
||||
#if CONFIG_BT_ENABLED && (CONFIG_BT_NIMBLE_ROLE_PERIPHERAL || CONFIG_BT_NIMBLE_ROLE_CENTRAL)
|
||||
|
||||
# include "NimBLEAttribute.h"
|
||||
# include "NimBLEAttValue.h"
|
||||
|
@ -8,19 +8,19 @@
|
||||
#define CONFIG_BT_NIMBLE_ENABLED
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_NIMBLE_ROLE_OBSERVER) && !defined(CONFIG_BT_NIMBLE_ROLE_OBSERVER)
|
||||
#if defined(CONFIG_NIMBLE_ROLE_OBSERVER) && !CONFIG_BT_NIMBLE_ROLE_OBSERVER
|
||||
#define CONFIG_BT_NIMBLE_ROLE_OBSERVER
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_NIMBLE_ROLE_BROADCASTER) && !defined(CONFIG_BT_NIMBLE_ROLE_BROADCASTER)
|
||||
#if defined(CONFIG_NIMBLE_ROLE_BROADCASTER) && !CONFIG_BT_NIMBLE_ROLE_BROADCASTER
|
||||
#define CONFIG_BT_NIMBLE_ROLE_BROADCASTER
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_NIMBLE_ROLE_CENTRAL) && !defined(CONFIG_BT_NIMBLE_ROLE_CENTRAL)
|
||||
#if defined(CONFIG_NIMBLE_ROLE_CENTRAL) && !CONFIG_BT_NIMBLE_ROLE_CENTRAL
|
||||
#define CONFIG_BT_NIMBLE_ROLE_CENTRAL
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_NIMBLE_ROLE_PERIPHERAL) && !defined(CONFIG_BT_NIMBLE_ROLE_PERIPHERAL)
|
||||
#if defined(CONFIG_NIMBLE_ROLE_PERIPHERAL) && !CONFIG_BT_NIMBLE_ROLE_PERIPHERAL
|
||||
#define CONFIG_BT_NIMBLE_ROLE_PERIPHERAL
|
||||
#endif
|
||||
|
||||
|
Reference in New Issue
Block a user