Mistake on this page?
Report an issue in GitHub or email us
Public Member Functions
AdvertisingDataSimpleBuilder< DataSize > Class Template Reference
Ble » Gap

Build advertising data. More...

#include <AdvertisingDataSimpleBuilder.h>

Public Member Functions

 AdvertisingDataSimpleBuilder ()
 Construct a AdvertisingDataSimpleBuilder. More...
 
AdvertisingDataSimpleBuildersetAppearance (adv_data_appearance_t appearance)
 Add device appearance in the advertising payload. More...
 
AdvertisingDataSimpleBuildersetFlags (adv_data_flags_t flags=adv_data_flags_t::default_flags)
 Add BLE flags in the advertising payload. More...
 
AdvertisingDataSimpleBuildersetTxPowerAdvertised (advertising_power_t txPower)
 Add the advertising TX in the advertising payload. More...
 
AdvertisingDataSimpleBuildersetName (const char *name, bool complete=true)
 Add device name to the advertising payload. More...
 
AdvertisingDataSimpleBuildersetManufacturerSpecificData (mbed::Span< const uint8_t > data)
 Add manufacturer specific data to the advertising payload. More...
 
AdvertisingDataSimpleBuildersetAdvertisingInterval (adv_interval_t interval)
 Add advertising interval to the payload. More...
 
AdvertisingDataSimpleBuildersetConnectionIntervalPreference (conn_interval_t min, conn_interval_t max)
 Add connection interval preferences to the payload. More...
 
AdvertisingDataSimpleBuildersetServiceData (UUID service, mbed::Span< const uint8_t > data)
 Add service data to the advertising payload. More...
 
AdvertisingDataSimpleBuildersetLocalService (const UUID &data, bool complete=true)
 Add local service ID to the advertising payload. More...
 
AdvertisingDataSimpleBuildersetLocalServiceList (mbed::Span< const UUID > data, bool complete=true)
 Add local service IDs to the advertising payload. More...
 
AdvertisingDataSimpleBuildersetRequestedService (const UUID &data)
 Add a UUID of a solicited service. More...
 
AdvertisingDataSimpleBuildersetRequestedServiceList (mbed::Span< const UUID > data)
 Add a list of UUIDs of solicited services. More...
 
AdvertisingDataSimpleBuilderaddData (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...
 

Detailed Description

template<size_t DataSize>
class ble::AdvertisingDataSimpleBuilder< DataSize >

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.

Constructor & Destructor Documentation

Construct a AdvertisingDataSimpleBuilder.

Definition at line 66 of file AdvertisingDataSimpleBuilder.h.

Member Function Documentation

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.

Note
Data size for individual types cannot exceed 255 bytes.
Parameters
[in]advDataTypeThe type of the field to add.
[in]fieldDataSpan of data to add.
Returns
A reference to this object.

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.

Returns
A Span containing the payload.

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.

Parameters
intervalInterval to advertise. Cannot be larger than 0xFFFF.
Returns
a reference to this object.

Definition at line 163 of file AdvertisingDataSimpleBuilder.h.

AdvertisingDataSimpleBuilder& setAppearance ( adv_data_appearance_t  appearance)

Add device appearance in the advertising payload.

Parameters
[in]appearanceThe appearance to advertise.
Returns
A reference to this object.
Note
If the field is already present in the payload, it is replaced.

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.

Parameters
minMinimum connection interval to advertise.
maxMaximum connection interval to advertise.
Returns
a reference to this object.

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.

Parameters
[in]flagsBitfield describing the capability of the device. See allowed flags in Flags_t.
Returns
A reference to this object.
Note
If the field is already present in the payload, it is replaced.

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.

Note
Data size for individual types cannot exceed 255 bytes.
Parameters
[in]dataNew data to be added.
[in]completeTrue if this is a complete list.
Returns
A reference to this object.

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.

Note
Data size for individual types cannot exceed 255 bytes.
Parameters
[in]dataNew data to be added.
[in]completeTrue if this is a complete list.
Returns
A reference to this object.

Definition at line 240 of file AdvertisingDataSimpleBuilder.h.

AdvertisingDataSimpleBuilder& setManufacturerSpecificData ( mbed::Span< const uint8_t >  data)

Add manufacturer specific data to the advertising payload.

Note
Data size for individual types cannot exceed 255 bytes.
Parameters
[in]dataNew data to be added.
Returns
a reference to this object.

Definition at line 149 of file AdvertisingDataSimpleBuilder.h.

AdvertisingDataSimpleBuilder& setName ( const char *  name,
bool  complete = true 
)

Add device name to the advertising payload.

Note
Data size for individual types cannot exceed 255 bytes.
Parameters
[in]nameNull terminated string containing the name.
[in]completeComplete local name if true, otherwise
Returns
A reference to this object.
Note
If the field is already present in the payload, it is replaced.

Definition at line 133 of file AdvertisingDataSimpleBuilder.h.

AdvertisingDataSimpleBuilder& setRequestedService ( const UUID data)

Add a UUID of a solicited service.

Note
Data size for individual types cannot exceed 255 bytes.
Parameters
[in]dataList of 128 or 16 bit service UUIDs.
Returns
A reference to this object.

Definition at line 259 of file AdvertisingDataSimpleBuilder.h.

AdvertisingDataSimpleBuilder& setRequestedServiceList ( mbed::Span< const UUID data)

Add a list of UUIDs of solicited services.

Note
Data size for individual types cannot exceed 255 bytes.
Parameters
[in]dataList of 128 or 16 bit service UUIDs.
Returns
A reference to this object.

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.

Note
Data size for individual types cannot exceed 255 bytes.
Parameters
[in]serviceUUID of the service.
[in]dataNew data to be added.
Returns
A reference to this object.

Definition at line 198 of file AdvertisingDataSimpleBuilder.h.

AdvertisingDataSimpleBuilder& setTxPowerAdvertised ( advertising_power_t  txPower)

Add the advertising TX in the advertising payload.

Parameters
[in]txPowerTransmission power level in dB.
Returns
A reference to this object.
Note
If the field is already present in the payload, it is replaced.

Definition at line 114 of file AdvertisingDataSimpleBuilder.h.

Important Information for this Arm website

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies. If you are not happy with the use of these cookies, please review our Cookie Policy to learn how they can be disabled. By disabling cookies, some features of the site will not work.