mirror of
https://github.com/h2zero/esp-nimble-cpp.git
synced 2024-11-21 20:50:55 +01:00
Release 1.4.0
* Fix typos * Update docs
This commit is contained in:
parent
70ed6e293f
commit
efa48c0d57
27 changed files with 159 additions and 164 deletions
21
CHANGELOG.md
21
CHANGELOG.md
|
@ -2,6 +2,27 @@
|
|||
|
||||
All notable changes to this project will be documented in this file.
|
||||
|
||||
## [1.4.0] - 2022-07-31
|
||||
|
||||
### Fixed
|
||||
- Fixed missing data from long notification values.
|
||||
- Fixed NimbleCharacteristicCallbacks::onRead not being called when a non-long read command is received.
|
||||
- Prevent a potential crash when retrieving characteristics from a service if the result was successful but no characteristics found.
|
||||
- logs/typos.
|
||||
|
||||
### Changed
|
||||
- AD flags are no longer set in the advertisements of non-connectable beacons, freeing up 3 bytes of advertisement room.
|
||||
- Save resources when retrieving descriptors if the characteristic handle is the same as the end handle (no descriptors).
|
||||
- Subscribing to characteristic notifications/indications will now always use write with response, as per BLE specifications.
|
||||
- `NimBLEClient::discoverAttributes` now returns a bool value to indicate success/failure.
|
||||
- Scan result callbacks are no longer called when the scan response data is updated in order to reduce duplicates.
|
||||
|
||||
### Added
|
||||
- Preliminary support for non-esp devices, NRF51 and NRF52 devices supported with [n-able arduino core](https://github.com/h2zero/n-able-Arduino)
|
||||
- Alias added for `NimBLEServerCallbacks::onMTUChange` to `onMtuChanged` in order to support porting code from original library.
|
||||
- `NimBLEAttValue` Class added to reduce and control RAM footprint of characteristic/descriptor values and support conversions from Arduino Strings and many other data types.
|
||||
- Bluetooth 5 extended advertising support for capable devices. CODED Phy, 2M Phy, extended advertising data, and multi-advertising are supported, periodic advertising will be implemented in the future.
|
||||
|
||||
## [1.3.3] - 2022-02-15
|
||||
|
||||
### Changed
|
||||
|
|
2
Kconfig
2
Kconfig
|
@ -42,7 +42,7 @@ config NIMBLE_CPP_ENABLE_GAP_EVENT_CODE_TEXT
|
|||
messages in the debug log. This will use approximately 1kB
|
||||
of flash memory.
|
||||
|
||||
config NIMBLE_CPP_ENABLE_ADVERTISMENT_TYPE_TEXT
|
||||
config NIMBLE_CPP_ENABLE_ADVERTISEMENT_TYPE_TEXT
|
||||
bool "Show advertisment types as text in debug log."
|
||||
default "n"
|
||||
help
|
||||
|
|
|
@ -38,7 +38,7 @@ PROJECT_NAME = esp-nimble-cpp
|
|||
# could be handy for archiving the generated documentation or if some version
|
||||
# control system is used.
|
||||
|
||||
PROJECT_NUMBER = 1.3.2
|
||||
PROJECT_NUMBER = 1.4.0
|
||||
|
||||
# Using the PROJECT_BRIEF tag one can provide an optional one line description
|
||||
# for a project that appears at the top of each page and should give viewer a
|
||||
|
@ -2267,7 +2267,8 @@ PREDEFINED = _DOXYGEN_ \
|
|||
CONFIG_BT_NIMBLE_ROLE_CENTRAL \
|
||||
CONFIG_BT_NIMBLE_ROLE_OBSERVER \
|
||||
CONFIG_BT_NIMBLE_ROLE_PERIPHERAL \
|
||||
CONFIG_BT_NIMBLE_ROLE_BROADCASTER
|
||||
CONFIG_BT_NIMBLE_ROLE_BROADCASTER \
|
||||
CONFIG_BT_NIMBLE_EXT_ADV
|
||||
|
||||
# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then this
|
||||
# tag can be used to specify a list of macro names that should be expanded. The
|
||||
|
|
|
@ -4,7 +4,7 @@ This guide describes the required changes to existing projects migrating from th
|
|||
|
||||
**The changes listed here are only the required changes that must be made**, and a short overview of options for migrating existing applications.
|
||||
|
||||
For more information on the improvements and additions please refer to the [class documentation](https://h2zero.github.io/esp-nimble-cpp/annotated.html) and [Improvements and updates](Improvements_and_updates.md)
|
||||
For more information on the improvements and additions please refer to the [class documentation](https://h2zero.github.io/NimBLE-Arduino/annotated.html) and [Improvements and updates](Improvements_and_updates.md)
|
||||
|
||||
* [General Changes](#general-information)
|
||||
* [Server](#server-api)
|
||||
|
@ -27,22 +27,22 @@ For more information on the improvements and additions please refer to the [clas
|
|||
### Header Files
|
||||
All classes are accessible by including `NimBLEDevice.h` in your application, no further headers need to be included.
|
||||
|
||||
(Mainly for Arduino) You may choose to include `NimBLELog.h` in your appplication if you want to use the `NIMBLE_LOGx` macros for debugging. These macros are used the same way as the `ESP_LOGx` macros.
|
||||
(Mainly for Arduino) You may choose to include `NimBLELog.h` in your application if you want to use the `NIMBLE_LOGx` macros for debugging. These macros are used the same way as the `ESP_LOGx` macros.
|
||||
<br/>
|
||||
|
||||
### Class Names
|
||||
Class names remain the same as the original with the addition of a "Nim" prefix.
|
||||
For example `BLEDevice` is now `NimBLEDevice` and `BLEServer` is now `NimBLEServer` etc.
|
||||
|
||||
For convienience definitions have been added to allow applications to use either name for all classes this means **no class names need to be changed in existing code** and makes migrating easier.
|
||||
For convenience definitions have been added to allow applications to use either name for all classes this means **no class names need to be changed in existing code** and makes migrating easier.
|
||||
<br/>
|
||||
|
||||
### BLE Addresses
|
||||
`BLEAddress` (`NimBLEAddress`) When constructing an address the constructor now takes an *(optional)* `uint8_t type` paramameter to specify the address type. Default is (0) Public static address.
|
||||
`BLEAddress` (`NimBLEAddress`) When constructing an address the constructor now takes an *(optional)* `uint8_t type` parameter to specify the address type. Default is (0) Public static address.
|
||||
|
||||
For example `BLEAddress addr(11:22:33:44:55:66, 1)` will create the address object with an address type of: 1 (Random).
|
||||
|
||||
As this paramameter is optional no changes to existing code are needed, it is mentioned here for information.
|
||||
As this parameter is optional no changes to existing code are needed, it is mentioned here for information.
|
||||
|
||||
`BLEAddress::getNative` (`NimBLEAddress::getNative`) returns a uint8_t pointer to the native address byte array. In this library the address bytes are stored in reverse order from the original library. This is due to the way the NimBLE stack expects addresses to be presented to it. All other functions such as `toString` are
|
||||
not affected as the endian change is made within them.
|
||||
|
@ -213,8 +213,8 @@ Calling `NimBLEAdvertising::setAdvertisementData` will entirely replace any data
|
|||
|
||||
> BLEAdvertising::start (NimBLEAdvertising::start)
|
||||
|
||||
Now takes 2 optional parameters, the first is the duration to advertise for (in seconds), the second is a callback that is invoked when advertsing ends and takes a pointer to a `NimBLEAdvertising` object (similar to the `NimBLEScan::start` API).
|
||||
This provides an opportunity to update the advertisment data if desired.
|
||||
Now takes 2 optional parameters, the first is the duration to advertise for (in seconds), the second is a callback that is invoked when advertising ends and takes a pointer to a `NimBLEAdvertising` object (similar to the `NimBLEScan::start` API).
|
||||
This provides an opportunity to update the advertisement data if desired.
|
||||
<br/>
|
||||
|
||||
<a name="client-api"></a>
|
||||
|
@ -297,7 +297,7 @@ Are **deprecated** a template: `NimBLERemoteCharacteristic::readValue<type\>(tim
|
|||
**Has been removed from the API**
|
||||
Originally it stored an unnecessary copy of the data and was returning a `uint8_t` pointer to volatile internal data.
|
||||
The user application should use `NimBLERemoteCharacteristic::readValue` or `NimBLERemoteCharacteristic::getValue`.
|
||||
To obatain a copy of the data, then cast the returned std::string to the type required such as:
|
||||
To obtain a copy of the data, then cast the returned std::string to the type required such as:
|
||||
```
|
||||
std::string value = pChr->readValue();
|
||||
uint8_t *data = (uint8_t*)value.data();
|
||||
|
|
|
@ -13,18 +13,6 @@ NimBLE is a completely open source Bluetooth Low Energy stack produced by [Apach
|
|||
It is more suited to resource constrained devices than bluedroid and has now been ported to the ESP32 by Espressif.
|
||||
<br/>
|
||||
|
||||
# Arduino Installation
|
||||
**Arduino Library manager:** Go to `sketch` -> `Include Library` -> `Manage Libraries` and search for NimBLE and install.
|
||||
|
||||
**Alternatively:** Download as .zip and extract to Arduino/libraries folder, or in Arduino IDE from Sketch menu -> Include library -> Add .Zip library.
|
||||
|
||||
`#include "NimBLEDevice.h"` at the beginning of your sketch.
|
||||
|
||||
Call `NimBLEDevice::init` in `setup`.
|
||||
|
||||
Tested and working with esp32-arduino in Arduino IDE and platform IO.
|
||||
<br/>
|
||||
|
||||
# ESP-IDF Installation
|
||||
### v4.0+
|
||||
Download as .zip and extract or clone into the components folder in your esp-idf project.
|
||||
|
@ -57,21 +45,6 @@ Also see [Improvements and updates](Improvements_and_updates.md) for information
|
|||
For more advanced usage see [Usage tips](Usage_tips.md) for more performance and optimization.
|
||||
<br/>
|
||||
|
||||
### Arduino specific
|
||||
See the Refactored_original_examples in the examples folder for highlights of the differences with the original library.
|
||||
|
||||
More advanced examples highlighting many available features are in examples/NimBLE_Server, NimBLE_Client.
|
||||
|
||||
Beacon examples provided by [beegee-tokyo](https://github.com/beegee-tokyo) are in examples/BLE_Beacon_Scanner, BLE_EddystoneTLM_Beacon, BLE_EddystoneURL_Beacon.
|
||||
|
||||
Change the settings in the nimconfig.h file to customize NimBLE to your project, such as increasing max connections (default is 3).
|
||||
<br/>
|
||||
|
||||
### Arduino command line and platformio
|
||||
As an alternative to changing the configuration in nimconfig.h, Arduino command line and platformio.ini options are available.
|
||||
See the command line configuration options available in [Command line config](Command_line_config.md).
|
||||
<br/>
|
||||
|
||||
# Need help? Have a question or suggestion?
|
||||
Come chat on [gitter](https://gitter.im/NimBLE-Arduino/community?utm_source=share-link&utm_medium=link&utm_campaign=share-link) or open an issue at [NimBLE-Arduino](https://github.com/h2zero/NimBLE-Arduino/issues) or [esp-nimble-cpp](https://github.com/h2zero/esp-nimble-cpp/issues)
|
||||
<br/>
|
||||
|
|
|
@ -22,11 +22,11 @@
|
|||
#include "NimBLE2904.h"
|
||||
|
||||
|
||||
NimBLE2904::NimBLE2904(NimBLECharacteristic* pCharacterisitic)
|
||||
NimBLE2904::NimBLE2904(NimBLECharacteristic* pCharacteristic)
|
||||
: NimBLEDescriptor(NimBLEUUID((uint16_t) 0x2904),
|
||||
BLE_GATT_CHR_F_READ,
|
||||
sizeof(BLE2904_Data),
|
||||
pCharacterisitic)
|
||||
pCharacteristic)
|
||||
{
|
||||
m_data.m_format = 0;
|
||||
m_data.m_exponent = 0;
|
||||
|
|
|
@ -156,7 +156,7 @@ std::string NimBLEAddress::toString() const {
|
|||
|
||||
|
||||
/**
|
||||
* @brief Convienience operator to check if this address is equal to another.
|
||||
* @brief Convenience operator to check if this address is equal to another.
|
||||
*/
|
||||
bool NimBLEAddress::operator ==(const NimBLEAddress & rhs) const {
|
||||
return memcmp(rhs.m_address, m_address, sizeof m_address) == 0;
|
||||
|
@ -164,7 +164,7 @@ bool NimBLEAddress::operator ==(const NimBLEAddress & rhs) const {
|
|||
|
||||
|
||||
/**
|
||||
* @brief Convienience operator to check if this address is not equal to another.
|
||||
* @brief Convenience operator to check if this address is not equal to another.
|
||||
*/
|
||||
bool NimBLEAddress::operator !=(const NimBLEAddress & rhs) const {
|
||||
return !this->operator==(rhs);
|
||||
|
@ -186,7 +186,7 @@ NimBLEAddress::operator std::string() const {
|
|||
|
||||
|
||||
/**
|
||||
* @brief Convienience operator to convert the native address representation to uint_64.
|
||||
* @brief Convenience operator to convert the native address representation to uint_64.
|
||||
*/
|
||||
NimBLEAddress::operator uint64_t() const {
|
||||
uint64_t address = 0;
|
||||
|
|
|
@ -52,9 +52,9 @@ NimBLEAddress NimBLEAdvertisedDevice::getAddress() {
|
|||
* @brief Get the advertisement type.
|
||||
* @return The advertising type the device is reporting:
|
||||
* * BLE_HCI_ADV_TYPE_ADV_IND (0) - indirect advertising
|
||||
* * BLE_HCI_ADV_TYPE_ADV_DIRECT_IND_HD (1) - direct advertisng - high duty cycle
|
||||
* * BLE_HCI_ADV_TYPE_ADV_DIRECT_IND_HD (1) - direct advertising - high duty cycle
|
||||
* * BLE_HCI_ADV_TYPE_ADV_SCAN_IND (2) - indirect scan response
|
||||
* * BLE_HCI_ADV_TYPE_ADV_NONCONN_IND (3) - indirect advertisng - not connectable
|
||||
* * BLE_HCI_ADV_TYPE_ADV_NONCONN_IND (3) - indirect advertising - not connectable
|
||||
* * BLE_HCI_ADV_TYPE_ADV_DIRECT_IND_LD (4) - direct advertising - low duty cycle
|
||||
*/
|
||||
uint8_t NimBLEAdvertisedDevice::getAdvType() {
|
||||
|
@ -66,7 +66,7 @@ uint8_t NimBLEAdvertisedDevice::getAdvType() {
|
|||
* @brief Get the appearance.
|
||||
*
|
||||
* A %BLE device can declare its own appearance. The appearance is how it would like to be shown to an end user
|
||||
* typcially in the form of an icon.
|
||||
* typically in the form of an icon.
|
||||
*
|
||||
* @return The appearance of the advertised device.
|
||||
*/
|
||||
|
@ -308,7 +308,7 @@ std::string NimBLEAdvertisedDevice::getServiceData(const NimBLEUUID &uuid) {
|
|||
|
||||
|
||||
/**
|
||||
* @brief Get the UUID of the serice data at the index.
|
||||
* @brief Get the UUID of the service data at the index.
|
||||
* @param [in] index The index of the service data UUID requested.
|
||||
* @return The advertised service data UUID or an empty UUID if not found.
|
||||
*/
|
||||
|
@ -448,7 +448,7 @@ uint8_t NimBLEAdvertisedDevice::getServiceUUIDCount() {
|
|||
|
||||
|
||||
/**
|
||||
* @brief Check advertised services for existance of the required UUID
|
||||
* @brief Check advertised services for existence of the required UUID
|
||||
* @param [in] uuid The service uuid to look for in the advertisement.
|
||||
* @return Return true if service is advertised
|
||||
*/
|
||||
|
@ -794,7 +794,7 @@ void NimBLEAdvertisedDevice::setPayload(const uint8_t *payload, uint8_t length,
|
|||
|
||||
/**
|
||||
* @brief Get the length of the advertisement data in the payload.
|
||||
* @return The number of bytes in the payload that is from the advertisment.
|
||||
* @return The number of bytes in the payload that is from the advertisement.
|
||||
*/
|
||||
uint8_t NimBLEAdvertisedDevice::getAdvLength() {
|
||||
return m_advLength;
|
||||
|
|
|
@ -758,7 +758,7 @@ int NimBLEAdvertising::handleGapEvent(struct ble_gap_event *event, void *arg) {
|
|||
*/
|
||||
void NimBLEAdvertisementData::addData(const std::string &data) {
|
||||
if ((m_payload.length() + data.length()) > BLE_HS_ADV_MAX_SZ) {
|
||||
NIMBLE_LOGE(LOG_TAG, "Advertisement data length exceded");
|
||||
NIMBLE_LOGE(LOG_TAG, "Advertisement data length exceeded");
|
||||
return;
|
||||
}
|
||||
m_payload.append(data);
|
||||
|
|
|
@ -54,7 +54,7 @@ struct Has_c_str_len<T, decltype(void(std::declval<T &>().c_str())),
|
|||
/**
|
||||
* @brief A specialized container class to hold BLE attribute values.
|
||||
* @details This class is designed to be more memory efficient than using\n
|
||||
* standard container types for value storage, while being convertable to\n
|
||||
* standard container types for value storage, while being convertible to\n
|
||||
* many different container classes.
|
||||
*/
|
||||
class NimBLEAttValue
|
||||
|
|
|
@ -130,7 +130,7 @@ void NimBLEBeacon::setManufacturerId(uint16_t manufacturerId) {
|
|||
*/
|
||||
void NimBLEBeacon::setMinor(uint16_t minor) {
|
||||
m_beaconData.minor = ENDIAN_CHANGE_U16(minor);
|
||||
} // setMinior
|
||||
} // setMinor
|
||||
|
||||
|
||||
/**
|
||||
|
|
|
@ -126,8 +126,8 @@ void NimBLECharacteristic::addDescriptor(NimBLEDescriptor *pDescriptor) {
|
|||
|
||||
|
||||
/**
|
||||
* @brief Remove a descriptor from the characterisitc.
|
||||
* @param[in] pDescriptor A pointer to the descriptor instance to remove from the characterisitc.
|
||||
* @brief Remove a descriptor from the characteristic.
|
||||
* @param[in] pDescriptor A pointer to the descriptor instance to remove from the characteristic.
|
||||
* @param[in] deleteDsc If true it will delete the descriptor instance and free it's resources.
|
||||
*/
|
||||
void NimBLECharacteristic::removeDescriptor(NimBLEDescriptor *pDescriptor, bool deleteDsc) {
|
||||
|
@ -442,7 +442,7 @@ void NimBLECharacteristic::notify(const uint8_t* value, size_t length, bool is_n
|
|||
!(m_properties & NIMBLE_PROPERTY::INDICATE))
|
||||
{
|
||||
NIMBLE_LOGE(LOG_TAG,
|
||||
"<< notify-Error; Notify/indicate not enabled for characterisitc: %s",
|
||||
"<< notify-Error; Notify/indicate not enabled for characteristic: %s",
|
||||
std::string(getUUID()).c_str());
|
||||
}
|
||||
|
||||
|
|
|
@ -157,35 +157,35 @@ size_t NimBLEClient::deleteService(const NimBLEUUID &uuid) {
|
|||
|
||||
/**
|
||||
* @brief Connect to the BLE Server.
|
||||
* @param [in] deleteAttibutes If true this will delete any attribute objects this client may already\n
|
||||
* @param [in] deleteAttributes If true this will delete any attribute objects this client may already\n
|
||||
* have created and clears the vectors after successful connection.
|
||||
* @return True on success.
|
||||
*/
|
||||
bool NimBLEClient::connect(bool deleteAttibutes) {
|
||||
return connect(m_peerAddress, deleteAttibutes);
|
||||
bool NimBLEClient::connect(bool deleteAttributes) {
|
||||
return connect(m_peerAddress, deleteAttributes);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Connect to an advertising device.
|
||||
* @param [in] device The device to connect to.
|
||||
* @param [in] deleteAttibutes If true this will delete any attribute objects this client may already\n
|
||||
* @param [in] deleteAttributes If true this will delete any attribute objects this client may already\n
|
||||
* have created and clears the vectors after successful connection.
|
||||
* @return True on success.
|
||||
*/
|
||||
bool NimBLEClient::connect(NimBLEAdvertisedDevice* device, bool deleteAttibutes) {
|
||||
bool NimBLEClient::connect(NimBLEAdvertisedDevice* device, bool deleteAttributes) {
|
||||
NimBLEAddress address(device->getAddress());
|
||||
return connect(address, deleteAttibutes);
|
||||
return connect(address, deleteAttributes);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief Connect to the BLE Server.
|
||||
* @param [in] address The address of the server.
|
||||
* @param [in] deleteAttibutes If true this will delete any attribute objects this client may already\n
|
||||
* @param [in] deleteAttributes If true this will delete any attribute objects this client may already\n
|
||||
* have created and clears the vectors after successful connection.
|
||||
* @return True on success.
|
||||
*/
|
||||
bool NimBLEClient::connect(const NimBLEAddress &address, bool deleteAttibutes) {
|
||||
bool NimBLEClient::connect(const NimBLEAddress &address, bool deleteAttributes) {
|
||||
NIMBLE_LOGD(LOG_TAG, ">> connect(%s)", address.toString().c_str());
|
||||
|
||||
if(!NimBLEDevice::m_synced) {
|
||||
|
@ -259,7 +259,7 @@ bool NimBLEClient::connect(const NimBLEAddress &address, bool deleteAttibutes) {
|
|||
break;
|
||||
|
||||
case BLE_HS_EALREADY:
|
||||
// Already attemting to connect to this device, cancel the previous
|
||||
// Already attempting to connect to this device, cancel the previous
|
||||
// attempt and report failure here so we don't get 2 connections.
|
||||
NIMBLE_LOGE(LOG_TAG, "Already attempting to connect to %s - cancelling",
|
||||
std::string(m_peerAddress).c_str());
|
||||
|
@ -317,7 +317,7 @@ bool NimBLEClient::connect(const NimBLEAddress &address, bool deleteAttibutes) {
|
|||
NIMBLE_LOGI(LOG_TAG, "Connection established");
|
||||
}
|
||||
|
||||
if(deleteAttibutes) {
|
||||
if(deleteAttributes) {
|
||||
deleteServices();
|
||||
}
|
||||
|
||||
|
@ -390,8 +390,8 @@ int NimBLEClient::disconnect(uint8_t reason) {
|
|||
// We use a timer to detect a controller error in the event that it does
|
||||
// not inform the stack when disconnection is complete.
|
||||
// This is a common error in certain esp-idf versions.
|
||||
// The disconnect timeout time is the supervison timeout time + 1 second.
|
||||
// In the case that the event happenss shortly after the supervision timeout
|
||||
// The disconnect timeout time is the supervision timeout time + 1 second.
|
||||
// In the case that the event happens shortly after the supervision timeout
|
||||
// we don't want to prematurely reset the host.
|
||||
ble_npl_time_t ticks;
|
||||
ble_npl_time_ms_to_ticks((desc.supervision_timeout + 100) * 10, &ticks);
|
||||
|
@ -431,7 +431,7 @@ void NimBLEClient::setConnectPhy(uint8_t mask) {
|
|||
|
||||
|
||||
/**
|
||||
* @brief Set the connection paramaters to use when connecting to a server.
|
||||
* @brief Set the connection parameters to use when connecting to a server.
|
||||
* @param [in] minInterval The minimum connection interval in 1.25ms units.
|
||||
* @param [in] maxInterval The maximum connection interval in 1.25ms units.
|
||||
* @param [in] latency The number of packets allowed to skip (extends max interval).
|
||||
|
|
|
@ -38,9 +38,9 @@ class NimBLEAdvertisedDevice;
|
|||
*/
|
||||
class NimBLEClient {
|
||||
public:
|
||||
bool connect(NimBLEAdvertisedDevice* device, bool deleteAttibutes = true);
|
||||
bool connect(const NimBLEAddress &address, bool deleteAttibutes = true);
|
||||
bool connect(bool deleteAttibutes = true);
|
||||
bool connect(NimBLEAdvertisedDevice* device, bool deleteAttributes = true);
|
||||
bool connect(const NimBLEAddress &address, bool deleteAttributes = true);
|
||||
bool connect(bool deleteAttributes = true);
|
||||
int disconnect(uint8_t reason = BLE_ERR_REM_USER_CONN_TERM);
|
||||
NimBLEAddress getPeerAddress();
|
||||
void setPeerAddress(const NimBLEAddress &address);
|
||||
|
@ -137,7 +137,7 @@ public:
|
|||
* @brief Called when server requests to update the connection parameters.
|
||||
* @param [in] pClient A pointer to the calling client object.
|
||||
* @param [in] params A pointer to the struct containing the connection parameters requested.
|
||||
* @return True to accept the parmeters.
|
||||
* @return True to accept the parameters.
|
||||
*/
|
||||
virtual bool onConnParamsUpdateRequest(NimBLEClient* pClient, const ble_gap_upd_params* params);
|
||||
|
||||
|
|
|
@ -261,7 +261,7 @@ void NimBLEDescriptor::setValue(const std::vector<uint8_t>& vec) {
|
|||
|
||||
/**
|
||||
* @brief Set the characteristic this descriptor belongs to.
|
||||
* @param [in] pChar A pointer to the characteristic this descriptior belongs to.
|
||||
* @param [in] pChar A pointer to the characteristic this descriptor belongs to.
|
||||
*/
|
||||
void NimBLEDescriptor::setCharacteristic(NimBLECharacteristic* pChar) {
|
||||
m_pCharacteristic = pChar;
|
||||
|
|
|
@ -802,7 +802,7 @@ void NimBLEDevice::onSync(void)
|
|||
}
|
||||
#endif
|
||||
|
||||
// Yield for houskeeping before returning to operations.
|
||||
// Yield for housekeeping before returning to operations.
|
||||
// Occasionally triggers exception without.
|
||||
taskYIELD();
|
||||
|
||||
|
@ -851,7 +851,7 @@ void NimBLEDevice::init(const std::string &deviceName) {
|
|||
esp_err_t errRc = ESP_OK;
|
||||
|
||||
#ifdef CONFIG_ENABLE_ARDUINO_DEPENDS
|
||||
// make sure the linker includes esp32-hal-bt.c so ardruino init doesn't release BLE memory.
|
||||
// make sure the linker includes esp32-hal-bt.c so Arduino init doesn't release BLE memory.
|
||||
btStarted();
|
||||
#endif
|
||||
|
||||
|
|
|
@ -85,8 +85,8 @@ float NimBLEEddystoneTLM::getTemp() {
|
|||
} // getTemp
|
||||
|
||||
/**
|
||||
* @brief Get the count of advertisments sent.
|
||||
* @return The number of advertisments.
|
||||
* @brief Get the count of advertisements sent.
|
||||
* @return The number of advertisements.
|
||||
*/
|
||||
uint32_t NimBLEEddystoneTLM::getCount() {
|
||||
return ENDIAN_CHANGE_U32(m_eddystoneData.advCount);
|
||||
|
@ -94,8 +94,8 @@ uint32_t NimBLEEddystoneTLM::getCount() {
|
|||
|
||||
|
||||
/**
|
||||
* @brief Get the advertisment time.
|
||||
* @return The advertisment time.
|
||||
* @brief Get the advertisement time.
|
||||
* @return The advertisement time.
|
||||
*/
|
||||
uint32_t NimBLEEddystoneTLM::getTime() {
|
||||
return (ENDIAN_CHANGE_U32(m_eddystoneData.tmil)) / 10;
|
||||
|
@ -158,7 +158,7 @@ std::string NimBLEEddystoneTLM::toString() {
|
|||
|
||||
|
||||
/**
|
||||
* @brief Set the raw data for the beacon advertisment.
|
||||
* @brief Set the raw data for the beacon advertisement.
|
||||
* @param [in] data The raw data to advertise.
|
||||
*/
|
||||
void NimBLEEddystoneTLM::setData(const std::string &data) {
|
||||
|
@ -208,8 +208,8 @@ void NimBLEEddystoneTLM::setTemp(float temp) {
|
|||
|
||||
|
||||
/**
|
||||
* @brief Set the advertisment count.
|
||||
* @param [in] advCount The advertisment number.
|
||||
* @brief Set the advertisement count.
|
||||
* @param [in] advCount The advertisement number.
|
||||
*/
|
||||
void NimBLEEddystoneTLM::setCount(uint32_t advCount) {
|
||||
m_eddystoneData.advCount = advCount;
|
||||
|
@ -217,8 +217,8 @@ void NimBLEEddystoneTLM::setCount(uint32_t advCount) {
|
|||
|
||||
|
||||
/**
|
||||
* @brief Set the advertisment time.
|
||||
* @param [in] tmil The advertisment time in milliseconds.
|
||||
* @brief Set the advertisement time.
|
||||
* @param [in] tmil The advertisement time in milliseconds.
|
||||
*/
|
||||
void NimBLEEddystoneTLM::setTime(uint32_t tmil) {
|
||||
m_eddystoneData.tmil = tmil;
|
||||
|
|
|
@ -152,7 +152,7 @@ std::string NimBLEEddystoneURL::getDecodedURL() {
|
|||
|
||||
|
||||
/**
|
||||
* @brief Set the raw data for the beacon advertisment.
|
||||
* @brief Set the raw data for the beacon advertisement.
|
||||
* @param [in] data The raw data to advertise.
|
||||
*/
|
||||
void NimBLEEddystoneURL::setData(const std::string &data) {
|
||||
|
|
|
@ -272,7 +272,7 @@ bool NimBLEExtAdvertising::stop() {
|
|||
|
||||
/**
|
||||
* @brief Set a callback to call when the advertisement stops.
|
||||
* @param [in] pCallbacks A pointer to a callback to be invoked when an advertisment stops.
|
||||
* @param [in] pCallbacks A pointer to a callback to be invoked when an advertisement stops.
|
||||
* @param [in] deleteCallbacks if true callback class will be deleted when advertising is destructed.
|
||||
*/
|
||||
void NimBLEExtAdvertising::setCallbacks(NimBLEExtAdvertisingCallbacks* pCallbacks,
|
||||
|
|
|
@ -99,7 +99,7 @@ void NimBLEHIDDevice::manufacturer(std::string name) {
|
|||
}
|
||||
|
||||
/**
|
||||
* @brief Sets the Plug n Play characterisc value.
|
||||
* @brief Sets the Plug n Play characteristic value.
|
||||
* @param [in] sig The vendor ID source number.
|
||||
* @param [in] vid The vendor ID number.
|
||||
* @param [in] pid The product ID number.
|
||||
|
|
|
@ -165,7 +165,7 @@ std::vector<NimBLERemoteCharacteristic*>* NimBLERemoteService::getCharacteristic
|
|||
|
||||
|
||||
/**
|
||||
* @brief Callback for Characterisic discovery.
|
||||
* @brief Callback for Characteristic discovery.
|
||||
* @return success == 0 or error code.
|
||||
*/
|
||||
int NimBLERemoteService::characteristicDiscCB(uint16_t conn_handle,
|
||||
|
|
|
@ -164,7 +164,7 @@ NimBLEScan::~NimBLEScan() {
|
|||
NIMBLE_LOGD(LOG_TAG, "discovery complete; reason=%d",
|
||||
event->disc_complete.reason);
|
||||
|
||||
// If a device advertised with scan reponse available and it was not received
|
||||
// If a device advertised with scan response available and it was not received
|
||||
// the callback would not have been invoked, so do it here.
|
||||
if(pScan->m_pAdvertisedDeviceCallbacks) {
|
||||
for(auto &it : pScan->m_scanResults.m_advertisedDevicesVector) {
|
||||
|
@ -211,7 +211,7 @@ void NimBLEScan::setActiveScan(bool active) {
|
|||
* from devices it has not already seen.
|
||||
* @param [in] enabled If true, scanned devices will only be reported once.
|
||||
* @details The controller has a limited buffer and will start reporting
|
||||
* dupicate devices once the limit is reached.
|
||||
* duplicate devices once the limit is reached.
|
||||
*/
|
||||
void NimBLEScan::setDuplicateFilter(bool enabled) {
|
||||
m_scan_params.filter_duplicates = enabled;
|
||||
|
@ -236,7 +236,7 @@ void NimBLEScan::setLimitedOnly(bool enabled) {
|
|||
* directed, connectable advertising packets not sent to the scanner.
|
||||
* * BLE_HCI_SCAN_FILT_USE_WL (1)
|
||||
* Scanner processes advertisements from white list only. A connectable,\n
|
||||
* directed advertisment is ignored unless it contains scanners address.
|
||||
* directed advertisement is ignored unless it contains scanners address.
|
||||
* * BLE_HCI_SCAN_FILT_NO_WL_INITA (2)
|
||||
* Scanner process all advertising packets (white list not used). A\n
|
||||
* connectable, directed advertisement shall not be ignored if the InitA
|
||||
|
|
|
@ -61,8 +61,8 @@ void NimBLESecurity::setCapability(esp_ble_io_cap_t iocap) {
|
|||
|
||||
|
||||
/**
|
||||
* @brief Sets the keys we will distibute during encryption.
|
||||
* @param [in] init_key A bitmask of the keys we will distibute.\n
|
||||
* @brief Sets the keys we will distribute during encryption.
|
||||
* @param [in] init_key A bitmask of the keys we will distribute.\n
|
||||
* Can be one or more of:
|
||||
* * ESP_BLE_ENC_KEY_MASK (1 << 0)
|
||||
* * ESP_BLE_ID_KEY_MASK (1 << 1)
|
||||
|
|
|
@ -373,7 +373,7 @@ int NimBLEServer::handleGapEvent(struct ble_gap_event *event, void *arg) {
|
|||
|
||||
case BLE_GAP_EVENT_DISCONNECT: {
|
||||
// If Host reset tell the device now before returning to prevent
|
||||
// any errors caused by calling host functions before resyncing.
|
||||
// any errors caused by calling host functions before resync.
|
||||
switch(event->disconnect.reason) {
|
||||
case BLE_HS_ETIMEOUT_HCI:
|
||||
case BLE_HS_EOS:
|
||||
|
@ -636,7 +636,7 @@ void NimBLEServer::setCallbacks(NimBLEServerCallbacks* pCallbacks, bool deleteCa
|
|||
* @brief Remove a service from the server.
|
||||
*
|
||||
* @details Immediately removes access to the service by clients, sends a service changed indication,
|
||||
* and removes the service (if applicable) from the advertisments.
|
||||
* and removes the service (if applicable) from the advertisements.
|
||||
* The service is not deleted unless the deleteSvc parameter is true, otherwise the service remains
|
||||
* available and can be re-added in the future. If desired a removed but not deleted service can
|
||||
* be deleted later by calling this method with deleteSvc set to true.
|
||||
|
|
|
@ -151,7 +151,7 @@ public:
|
|||
* @brief Handle a client disconnection.
|
||||
* This is called when a client discconnects.
|
||||
* @param [in] pServer A pointer to the %BLE server that received the client disconnection.
|
||||
* @param [in] desc A pointer to the connection description structure containig information
|
||||
* @param [in] desc A pointer to the connection description structure containing information
|
||||
* about the connection.
|
||||
*/
|
||||
virtual void onDisconnect(NimBLEServer* pServer, ble_gap_conn_desc* desc);
|
||||
|
@ -159,7 +159,7 @@ public:
|
|||
/**
|
||||
* @brief Called when the connection MTU changes.
|
||||
* @param [in] MTU The new MTU value.
|
||||
* @param [in] desc A pointer to the connection description structure containig information
|
||||
* @param [in] desc A pointer to the connection description structure containing information
|
||||
* about the connection.
|
||||
*/
|
||||
virtual void onMTUChange(uint16_t MTU, ble_gap_conn_desc* desc);
|
||||
|
|
|
@ -297,7 +297,7 @@ std::string NimBLEUUID::toString() const {
|
|||
|
||||
|
||||
/**
|
||||
* @brief Convienience operator to check if this UUID is equal to another.
|
||||
* @brief Convenience operator to check if this UUID is equal to another.
|
||||
*/
|
||||
bool NimBLEUUID::operator ==(const NimBLEUUID & rhs) const {
|
||||
if(m_valueSet && rhs.m_valueSet) {
|
||||
|
@ -336,7 +336,7 @@ bool NimBLEUUID::operator ==(const NimBLEUUID & rhs) const {
|
|||
|
||||
|
||||
/**
|
||||
* @brief Convienience operator to check if this UUID is not equal to another.
|
||||
* @brief Convenience operator to check if this UUID is not equal to another.
|
||||
*/
|
||||
bool NimBLEUUID::operator !=(const NimBLEUUID & rhs) const {
|
||||
return !this->operator==(rhs);
|
||||
|
@ -344,7 +344,7 @@ bool NimBLEUUID::operator !=(const NimBLEUUID & rhs) const {
|
|||
|
||||
|
||||
/**
|
||||
* @brief Convienience operator to convert this UUID to string representation.
|
||||
* @brief Convenience operator to convert this UUID to string representation.
|
||||
* @details This allows passing NimBLEUUID to functions
|
||||
* that accept std::string and/or or it's methods as a parameter.
|
||||
*/
|
||||
|
|
|
@ -355,7 +355,7 @@ const char* NimBLEUtils::returnCodeToString(int rc) {
|
|||
* @return A string representation of the advertising flags.
|
||||
*/
|
||||
const char* NimBLEUtils::advTypeToString(uint8_t advType) {
|
||||
#if defined(CONFIG_NIMBLE_CPP_ENABLE_ADVERTISMENT_TYPE_TEXT)
|
||||
#if defined(CONFIG_NIMBLE_CPP_ENABLE_ADVERTISEMENT_TYPE_TEXT)
|
||||
switch(advType) {
|
||||
case BLE_HCI_ADV_TYPE_ADV_IND : //0
|
||||
return "Undirected - Connectable / Scannable";
|
||||
|
@ -370,10 +370,10 @@ const char* NimBLEUtils::advTypeToString(uint8_t advType) {
|
|||
default:
|
||||
return "Unknown flag";
|
||||
}
|
||||
#else // #if defined(CONFIG_NIMBLE_CPP_ENABLE_ADVERTISMENT_TYPE_TEXT)
|
||||
#else // #if defined(CONFIG_NIMBLE_CPP_ENABLE_ADVERTISEMENT_TYPE_TEXT)
|
||||
(void)advType;
|
||||
return "";
|
||||
#endif // #if defined(CONFIG_NIMBLE_CPP_ENABLE_ADVERTISMENT_TYPE_TEXT)
|
||||
#endif // #if defined(CONFIG_NIMBLE_CPP_ENABLE_ADVERTISEMENT_TYPE_TEXT)
|
||||
} // adFlagsToString
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue