esp-nimble-cpp / NimBLE-Arduino  1.3.1
NimBLEAdvertisementData Class Reference

Advertisement data set by the programmer to be published by the BLE server. More...

Public Member Functions

void setAppearance (uint16_t appearance)
 Set the appearance. More...
 
void setCompleteServices (const NimBLEUUID &uuid)
 Set a single service to advertise as a complete list of services. More...
 
void setCompleteServices16 (const std::vector< NimBLEUUID > &v_uuid)
 Set the complete list of 16 bit services to advertise. More...
 
void setCompleteServices32 (const std::vector< NimBLEUUID > &v_uuid)
 Set the complete list of 32 bit services to advertise. More...
 
void setFlags (uint8_t)
 Set the advertisement flags. More...
 
void setManufacturerData (const std::string &data)
 Set manufacturer specific data. More...
 
void setURI (const std::string &uri)
 Set the URI to advertise. More...
 
void setName (const std::string &name)
 Set the complete name of this device. More...
 
void setPartialServices (const NimBLEUUID &uuid)
 Set a single service to advertise as a partial list of services. More...
 
void setPartialServices16 (const std::vector< NimBLEUUID > &v_uuid)
 Set the partial list of services to advertise. More...
 
void setPartialServices32 (const std::vector< NimBLEUUID > &v_uuid)
 Set the partial list of services to advertise. More...
 
void setServiceData (const NimBLEUUID &uuid, const std::string &data)
 Set the service data (UUID + data) More...
 
void setShortName (const std::string &name)
 Set the short name. More...
 
void addData (const std::string &data)
 Add data to the payload to be advertised. More...
 
void addData (char *data, size_t length)
 Add data to the payload to be advertised. More...
 
void addTxPower ()
 Adds Tx power level to the advertisement data.
 
void setPreferredParams (uint16_t min, uint16_t max)
 Set the preferred connection interval parameters. More...
 
std::string getPayload ()
 Retrieve the payload that is to be advertised. More...
 

Detailed Description

Advertisement data set by the programmer to be published by the BLE server.

Member Function Documentation

◆ addData() [1/2]

void NimBLEAdvertisementData::addData ( char *  data,
size_t  length 
)

Add data to the payload to be advertised.

Parameters
[in]dataThe data to be added to the payload.
[in]lengthThe size of data to be added to the payload.

◆ addData() [2/2]

void NimBLEAdvertisementData::addData ( const std::string &  data)

Add data to the payload to be advertised.

Parameters
[in]dataThe data to be added to the payload.

◆ getPayload()

std::string NimBLEAdvertisementData::getPayload ( )

Retrieve the payload that is to be advertised.

Returns
The payload that is to be advertised.

◆ setAppearance()

void NimBLEAdvertisementData::setAppearance ( uint16_t  appearance)

Set the appearance.

Parameters
[in]appearanceThe appearance code value.

See also: https://www.bluetooth.com/specifications/gatt/viewer?attributeXmlFile=org.bluetooth.characteristic.gap.appearance.xml

◆ setCompleteServices()

void NimBLEAdvertisementData::setCompleteServices ( const NimBLEUUID uuid)

Set a single service to advertise as a complete list of services.

Parameters
[in]uuidThe service to advertise.

◆ setCompleteServices16()

void NimBLEAdvertisementData::setCompleteServices16 ( const std::vector< NimBLEUUID > &  v_uuid)

Set the complete list of 16 bit services to advertise.

Parameters
[in]v_uuidA vector of 16 bit UUID's to advertise.

◆ setCompleteServices32()

void NimBLEAdvertisementData::setCompleteServices32 ( const std::vector< NimBLEUUID > &  v_uuid)

Set the complete list of 32 bit services to advertise.

Parameters
[in]v_uuidA vector of 32 bit UUID's to advertise.

◆ setFlags()

void NimBLEAdvertisementData::setFlags ( uint8_t  flag)

Set the advertisement flags.

Parameters
[in]flagThe flags to be set in the advertisement.
  • BLE_HS_ADV_F_DISC_LTD
  • BLE_HS_ADV_F_DISC_GEN
  • BLE_HS_ADV_F_BREDR_UNSUP - must always use with NimBLE

◆ setManufacturerData()

void NimBLEAdvertisementData::setManufacturerData ( const std::string &  data)

Set manufacturer specific data.

Parameters
[in]dataThe manufacturer data to advertise.

◆ setName()

void NimBLEAdvertisementData::setName ( const std::string &  name)

Set the complete name of this device.

Parameters
[in]nameThe name to advertise.

◆ setPartialServices()

void NimBLEAdvertisementData::setPartialServices ( const NimBLEUUID uuid)

Set a single service to advertise as a partial list of services.

Parameters
[in]uuidThe service to advertise.

◆ setPartialServices16()

void NimBLEAdvertisementData::setPartialServices16 ( const std::vector< NimBLEUUID > &  v_uuid)

Set the partial list of services to advertise.

Parameters
[in]v_uuidA vector of 16 bit UUID's to advertise.

◆ setPartialServices32()

void NimBLEAdvertisementData::setPartialServices32 ( const std::vector< NimBLEUUID > &  v_uuid)

Set the partial list of services to advertise.

Parameters
[in]v_uuidA vector of 32 bit UUID's to advertise.

◆ setPreferredParams()

void NimBLEAdvertisementData::setPreferredParams ( uint16_t  min,
uint16_t  max 
)

Set the preferred connection interval parameters.

Parameters
[in]minThe minimum interval desired.
[in]maxThe maximum interval desired.

◆ setServiceData()

void NimBLEAdvertisementData::setServiceData ( const NimBLEUUID uuid,
const std::string &  data 
)

Set the service data (UUID + data)

Parameters
[in]uuidThe UUID to set with the service data.
[in]dataThe data to be associated with the service data advertised.

◆ setShortName()

void NimBLEAdvertisementData::setShortName ( const std::string &  name)

Set the short name.

Parameters
[in]nameThe short name of the device.

◆ setURI()

void NimBLEAdvertisementData::setURI ( const std::string &  uri)

Set the URI to advertise.

Parameters
[in]uriThe uri to advertise.