NimBLE-Arduino 2.1.2
|
Advertisement data set by the programmer to be published by the BLE server. More...
#include <NimBLEAdvertisementData.h>
Public Member Functions | |
bool | addData (const uint8_t *data, size_t length) |
Add data to the payload to be advertised. | |
bool | addData (const std::vector< uint8_t > &data) |
Add data to the payload to be advertised. | |
bool | setAppearance (uint16_t appearance) |
Set the appearance. | |
bool | setFlags (uint8_t) |
Set the advertisement flags. | |
bool | addTxPower () |
Adds Tx power level to the advertisement data. | |
bool | setPreferredParams (uint16_t minInterval, uint16_t maxInterval) |
Set the preferred min and max connection intervals to advertise. | |
bool | addServiceUUID (const NimBLEUUID &serviceUUID) |
Add a service uuid to exposed list of services. | |
bool | addServiceUUID (const char *serviceUUID) |
Add a service uuid to exposed list of services. | |
bool | removeServiceUUID (const NimBLEUUID &serviceUUID) |
Remove a service UUID from the advertisement. | |
bool | removeServiceUUID (const char *serviceUUID) |
Remove a service UUID from the advertisement. | |
bool | removeServices () |
Remove all service UUIDs from the advertisement. | |
bool | setManufacturerData (const uint8_t *data, size_t length) |
Set manufacturer specific data. | |
bool | setManufacturerData (const std::string &data) |
Set manufacturer specific data. | |
bool | setManufacturerData (const std::vector< uint8_t > &data) |
Set manufacturer specific data. | |
bool | setURI (const std::string &uri) |
Set the URI to advertise. | |
bool | setName (const std::string &name, bool isComplete=true) |
Set the complete name of this device. | |
bool | setShortName (const std::string &name) |
Set the short name. | |
bool | setCompleteServices (const NimBLEUUID &uuid) |
Set a single service to advertise as a complete list of services. | |
bool | setCompleteServices16 (const std::vector< NimBLEUUID > &uuids) |
Set the complete list of 16 bit services to advertise. | |
bool | setCompleteServices32 (const std::vector< NimBLEUUID > &uuids) |
Set the complete list of 32 bit services to advertise. | |
bool | setPartialServices (const NimBLEUUID &uuid) |
Set a single service to advertise as a partial list of services. | |
bool | setPartialServices16 (const std::vector< NimBLEUUID > &uuids) |
Set the partial list of services to advertise. | |
bool | setPartialServices32 (const std::vector< NimBLEUUID > &uuids) |
Set the partial list of services to advertise. | |
bool | setServiceData (const NimBLEUUID &uuid, const uint8_t *data, size_t length) |
Set the service data advertised for the UUID. | |
bool | setServiceData (const NimBLEUUID &uuid, const std::string &data) |
Set the service data (UUID + data) | |
bool | setServiceData (const NimBLEUUID &uuid, const std::vector< uint8_t > &data) |
Set the service data advertised for the UUID. | |
bool | removeData (uint8_t type) |
Remove data from the advertisement data. | |
void | clearData () |
Clear the advertisement data for reuse. | |
int | getDataLocation (uint8_t type) const |
Get the location of the data in the payload. | |
std::string | toString () const |
Get the string representation of the advertisement data. | |
std::vector< uint8_t > | getPayload () const |
Retrieve the payload that is to be advertised. | |
Advertisement data set by the programmer to be published by the BLE server.
bool NimBLEAdvertisementData::addData | ( | const std::vector< uint8_t > & | data | ) |
Add data to the payload to be advertised.
[in] | data | The data to be added to the payload. |
bool NimBLEAdvertisementData::addData | ( | const uint8_t * | data, |
size_t | length | ||
) |
Add data to the payload to be advertised.
[in] | data | The data to be added to the payload. |
[in] | length | The size of data to be added to the payload. |
bool NimBLEAdvertisementData::addServiceUUID | ( | const char * | serviceUUID | ) |
Add a service uuid to exposed list of services.
[in] | serviceUUID | The string representation of the service to expose. |
bool NimBLEAdvertisementData::addServiceUUID | ( | const NimBLEUUID & | serviceUUID | ) |
Add a service uuid to exposed list of services.
[in] | serviceUUID | The UUID of the service to expose. |
bool NimBLEAdvertisementData::addTxPower | ( | ) |
Adds Tx power level to the advertisement data.
int NimBLEAdvertisementData::getDataLocation | ( | uint8_t | type | ) | const |
Get the location of the data in the payload.
[in] | type | The type of data to search for. |
std::vector< uint8_t > NimBLEAdvertisementData::getPayload | ( | ) | const |
Retrieve the payload that is to be advertised.
bool NimBLEAdvertisementData::removeData | ( | uint8_t | type | ) |
Remove data from the advertisement data.
[in] | type | The type of data to remove. |
bool NimBLEAdvertisementData::removeServiceUUID | ( | const char * | serviceUUID | ) |
Remove a service UUID from the advertisement.
[in] | serviceUUID | The UUID of the service to remove. |
bool NimBLEAdvertisementData::removeServiceUUID | ( | const NimBLEUUID & | serviceUUID | ) |
Remove a service UUID from the advertisement.
[in] | serviceUUID | The UUID of the service to remove. |
bool NimBLEAdvertisementData::setAppearance | ( | uint16_t | appearance | ) |
Set the appearance.
[in] | appearance | The appearance code value. |
If the appearance value is 0 then it will be removed from the advertisement if set previously.
bool NimBLEAdvertisementData::setCompleteServices | ( | const NimBLEUUID & | uuid | ) |
Set a single service to advertise as a complete list of services.
[in] | uuid | The service to advertise. |
bool NimBLEAdvertisementData::setCompleteServices16 | ( | const std::vector< NimBLEUUID > & | uuids | ) |
Set the complete list of 16 bit services to advertise.
[in] | uuids | A vector of 16 bit UUID's to advertise. |
bool NimBLEAdvertisementData::setCompleteServices32 | ( | const std::vector< NimBLEUUID > & | uuids | ) |
Set the complete list of 32 bit services to advertise.
[in] | uuids | A vector of 32 bit UUID's to advertise. |
bool NimBLEAdvertisementData::setFlags | ( | uint8_t | flag | ) |
Set the advertisement flags.
[in] | flag | The flags to be set in the advertisement.
|
bool NimBLEAdvertisementData::setManufacturerData | ( | const std::string & | data | ) |
Set manufacturer specific data.
[in] | data | The manufacturer data to advertise. |
bool NimBLEAdvertisementData::setManufacturerData | ( | const std::vector< uint8_t > & | data | ) |
Set manufacturer specific data.
[in] | data | The manufacturer data to advertise. |
bool NimBLEAdvertisementData::setManufacturerData | ( | const uint8_t * | data, |
size_t | length | ||
) |
Set manufacturer specific data.
[in] | data | The manufacturer data to advertise. |
[in] | length | The length of the data. |
bool NimBLEAdvertisementData::setName | ( | const std::string & | name, |
bool | isComplete = true |
||
) |
Set the complete name of this device.
[in] | name | The name to advertise. |
[in] | isComplete | If true the name is complete, which will set the data type accordingly. |
If the name is longer than 29 characters it will be truncated. and the data type will be set to incomplete name.
bool NimBLEAdvertisementData::setPartialServices | ( | const NimBLEUUID & | uuid | ) |
Set a single service to advertise as a partial list of services.
[in] | uuid | The service to advertise. |
bool NimBLEAdvertisementData::setPartialServices16 | ( | const std::vector< NimBLEUUID > & | uuids | ) |
Set the partial list of services to advertise.
[in] | uuids | A vector of 16 bit UUID's to advertise. |
bool NimBLEAdvertisementData::setPartialServices32 | ( | const std::vector< NimBLEUUID > & | uuids | ) |
Set the partial list of services to advertise.
[in] | uuids | A vector of 32 bit UUID's to advertise. |
bool NimBLEAdvertisementData::setPreferredParams | ( | uint16_t | minInterval, |
uint16_t | maxInterval | ||
) |
Set the preferred min and max connection intervals to advertise.
[in] | minInterval | The minimum preferred connection interval. |
[in] | maxInterval | The Maximum preferred connection interval. |
Range = 0x0006(7.5ms) to 0x0C80(4000ms), values not within the range will be limited to this range.
bool NimBLEAdvertisementData::setServiceData | ( | const NimBLEUUID & | uuid, |
const std::string & | data | ||
) |
Set the service data (UUID + data)
[in] | uuid | The UUID to set with the service data. |
[in] | data | The data to be associated with the service data advertised. |
bool NimBLEAdvertisementData::setServiceData | ( | const NimBLEUUID & | uuid, |
const std::vector< uint8_t > & | data | ||
) |
Set the service data advertised for the UUID.
[in] | uuid | The UUID the service data belongs to. |
[in] | data | The data to advertise. |
bool NimBLEAdvertisementData::setServiceData | ( | const NimBLEUUID & | uuid, |
const uint8_t * | data, | ||
size_t | length | ||
) |
Set the service data advertised for the UUID.
[in] | uuid | The UUID the service data belongs to. |
[in] | data | The data to advertise. |
[in] | length | The length of the data. |
bool NimBLEAdvertisementData::setShortName | ( | const std::string & | name | ) |
Set the short name.
[in] | name | The short name of the device. |
bool NimBLEAdvertisementData::setURI | ( | const std::string & | uri | ) |
Set the URI to advertise.
[in] | uri | The uri to advertise. |
std::string NimBLEAdvertisementData::toString | ( | ) | const |
Get the string representation of the advertisement data.