Build advertising data. More...
#include <AdvertisingDataSimpleBuilder.h>
Public Member Functions | |
AdvertisingDataSimpleBuilder () | |
Construct a AdvertisingDataSimpleBuilder. More... | |
AdvertisingDataSimpleBuilder & | setAppearance (adv_data_appearance_t appearance) |
Add device appearance in the advertising payload. More... | |
AdvertisingDataSimpleBuilder & | setFlags (adv_data_flags_t flags=adv_data_flags_t::default_flags) |
Add BLE flags in the advertising payload. More... | |
AdvertisingDataSimpleBuilder & | setTxPowerAdvertised (advertising_power_t txPower) |
Add the advertising TX in the advertising payload. More... | |
AdvertisingDataSimpleBuilder & | setName (const char *name, bool complete=true) |
Add device name to the advertising payload. More... | |
AdvertisingDataSimpleBuilder & | setManufacturerSpecificData (mbed::Span< const uint8_t > data) |
Add manufacturer specific data to the advertising payload. More... | |
AdvertisingDataSimpleBuilder & | setAdvertisingInterval (adv_interval_t interval) |
Add advertising interval to the payload. More... | |
AdvertisingDataSimpleBuilder & | setConnectionIntervalPreference (conn_interval_t min, conn_interval_t max) |
Add connection interval preferences to the payload. More... | |
AdvertisingDataSimpleBuilder & | setServiceData (UUID service, mbed::Span< const uint8_t > data) |
Add service data to the advertising payload. More... | |
AdvertisingDataSimpleBuilder & | setLocalService (const UUID &data, bool complete=true) |
Add local service ID to the advertising payload. More... | |
AdvertisingDataSimpleBuilder & | setLocalServiceList (mbed::Span< const UUID > data, bool complete=true) |
Add local service IDs to the advertising payload. More... | |
AdvertisingDataSimpleBuilder & | setRequestedService (const UUID &data) |
Add a UUID of a solicited service. More... | |
AdvertisingDataSimpleBuilder & | setRequestedServiceList (mbed::Span< const UUID > data) |
Add a list of UUIDs of solicited services. More... | |
AdvertisingDataSimpleBuilder & | addData (adv_data_type_t advDataType, mbed::Span< const uint8_t > fieldData) |
Add a new field into the payload. More... | |
mbed::Span< const uint8_t > | getAdvertisingData () const |
Get the subspan of the buffer containing valid data. More... | |
Build advertising data.
It is a simplified version of AdvertisingDataBuilder that can generate advertising data "inline".
It differs from AdvertisingDataBuilder on the following points:
Definition at line 61 of file AdvertisingDataSimpleBuilder.h.
Construct a AdvertisingDataSimpleBuilder.
Definition at line 66 of file AdvertisingDataSimpleBuilder.h.
AdvertisingDataSimpleBuilder& addData | ( | adv_data_type_t | advDataType, |
mbed::Span< const uint8_t > | fieldData | ||
) |
Add a new field into the payload.
The operation fails if type is already present.
[in] | advDataType | The type of the field to add. |
[in] | fieldData | Span of data to add. |
Definition at line 292 of file AdvertisingDataSimpleBuilder.h.
mbed::Span<const uint8_t> getAdvertisingData | ( | void | ) | const |
Get the subspan of the buffer containing valid data.
Definition at line 307 of file AdvertisingDataSimpleBuilder.h.
AdvertisingDataSimpleBuilder& setAdvertisingInterval | ( | adv_interval_t | interval | ) |
Add advertising interval to the payload.
This field can only carry 2 bytes.
interval | Interval to advertise. Cannot be larger than 0xFFFF. |
Definition at line 163 of file AdvertisingDataSimpleBuilder.h.
AdvertisingDataSimpleBuilder& setAppearance | ( | adv_data_appearance_t | appearance | ) |
Add device appearance in the advertising payload.
[in] | appearance | The appearance to advertise. |
Definition at line 79 of file AdvertisingDataSimpleBuilder.h.
AdvertisingDataSimpleBuilder& setConnectionIntervalPreference | ( | conn_interval_t | min, |
conn_interval_t | max | ||
) |
Add connection interval preferences to the payload.
min | Minimum connection interval to advertise. |
max | Maximum connection interval to advertise. |
Definition at line 178 of file AdvertisingDataSimpleBuilder.h.
AdvertisingDataSimpleBuilder& setFlags | ( | adv_data_flags_t | flags = adv_data_flags_t::default_flags | ) |
Add BLE flags in the advertising payload.
[in] | flags | Bitfield describing the capability of the device. See allowed flags in Flags_t. |
Definition at line 96 of file AdvertisingDataSimpleBuilder.h.
AdvertisingDataSimpleBuilder& setLocalService | ( | const UUID & | data, |
bool | complete = true |
||
) |
Add local service ID to the advertising payload.
If the data can't fit, no modification will take place.
[in] | data | New data to be added. |
[in] | complete | True if this is a complete list. |
Definition at line 216 of file AdvertisingDataSimpleBuilder.h.
AdvertisingDataSimpleBuilder& setLocalServiceList | ( | mbed::Span< const UUID > | data, |
bool | complete = true |
||
) |
Add local service IDs to the advertising payload.
If the data can't fit, no modification will take place.
[in] | data | New data to be added. |
[in] | complete | True if this is a complete list. |
Definition at line 240 of file AdvertisingDataSimpleBuilder.h.
AdvertisingDataSimpleBuilder& setManufacturerSpecificData | ( | mbed::Span< const uint8_t > | data | ) |
Add manufacturer specific data to the advertising payload.
[in] | data | New data to be added. |
Definition at line 149 of file AdvertisingDataSimpleBuilder.h.
AdvertisingDataSimpleBuilder& setName | ( | const char * | name, |
bool | complete = true |
||
) |
Add device name to the advertising payload.
[in] | name | Null terminated string containing the name. |
[in] | complete | Complete local name if true, otherwise |
Definition at line 133 of file AdvertisingDataSimpleBuilder.h.
AdvertisingDataSimpleBuilder& setRequestedService | ( | const UUID & | data | ) |
Add a UUID of a solicited service.
[in] | data | List of 128 or 16 bit service UUIDs. |
Definition at line 259 of file AdvertisingDataSimpleBuilder.h.
AdvertisingDataSimpleBuilder& setRequestedServiceList | ( | mbed::Span< const UUID > | data | ) |
Add a list of UUIDs of solicited services.
[in] | data | List of 128 or 16 bit service UUIDs. |
Definition at line 275 of file AdvertisingDataSimpleBuilder.h.
AdvertisingDataSimpleBuilder& setServiceData | ( | UUID | service, |
mbed::Span< const uint8_t > | data | ||
) |
Add service data to the advertising payload.
[in] | service | UUID of the service. |
[in] | data | New data to be added. |
Definition at line 198 of file AdvertisingDataSimpleBuilder.h.
AdvertisingDataSimpleBuilder& setTxPowerAdvertised | ( | advertising_power_t | txPower | ) |
Add the advertising TX in the advertising payload.
[in] | txPower | Transmission power level in dB. |
Definition at line 114 of file AdvertisingDataSimpleBuilder.h.