SDK  23.9.2
For IoT System Software Development
Public Member Functions | List of all members
BLEAdvertising Class Reference

Perform and manage BLE advertising. More...

#include <BLEAdvertising.hpp>

Public Member Functions

 BLEAdvertising ()
 Construct a default advertising object. More...
 
void addServiceUUID (BLEUUID serviceUUID)
 Add a service uuid to exposed list of services. More...
 
void addServiceUUID (const char *serviceUUID)
 Add a service uuid to exposed list of services. More...
 
void start ()
 Start advertising. Start advertising. More...
 
void stop ()
 Stop advertising. Stop advertising. More...
 
void setAppearance (uint16_t appearance)
 Set the device appearance in the advertising data. The appearance attribute is of type 0x19. The codes for distinct appearances can be found here: https://www.bluetooth.com/specifications/gatt/viewer?attributeXmlFile=org.bluetooth.characteristic.gap.appearance.xml. More...
 
void setMaxInterval (uint16_t maxinterval)
 Set the maximum interval. More...
 
void setMinInterval (uint16_t mininterval)
 Set the minimum interval. More...
 
uint32_t setMaxIntervalMicros (uint32_t usec)
 Set the maximum interval in unit of usec. More...
 
uint32_t setMinIntervalMicros (uint32_t usec)
 Set the minimum interval in unit of usec. More...
 
void setAdvertisementData (BLEAdvertisementData &advertisementData)
 Set the advertisement data that is to be published in a regular advertisement. More...
 
void setScanFilter (bool scanRequertWhitelistOnly, bool connectWhitelistOnly)
 Set the filtering for the scan filter. More...
 
void setScanResponseData (BLEAdvertisementData &advertisementData)
 Set the advertisement data that is to be published in a scan response. More...
 
void setMinPreferred (uint16_t)
 
void setMaxPreferred (uint16_t)
 
void setScanResponse (bool)
 

Detailed Description

Perform and manage BLE advertising.

A BLE server will want to perform advertising in order to make itself known to BLE clients.

Constructor & Destructor Documentation

◆ BLEAdvertising()

BLEAdvertising::BLEAdvertising ( )

Construct a default advertising object.

Member Function Documentation

◆ addServiceUUID() [1/2]

void BLEAdvertising::addServiceUUID ( BLEUUID  serviceUUID)

Add a service uuid to exposed list of services.

Parameters
[in]serviceUUIDThe UUID of the service to expose.
51  {
52  m_serviceUUIDs.push_back(serviceUUID);
53 } // addServiceUUID

◆ addServiceUUID() [2/2]

void BLEAdvertising::addServiceUUID ( const char *  serviceUUID)

Add a service uuid to exposed list of services.

Parameters
[in]serviceUUIDThe string representation of the service to expose.
60  {
61  addServiceUUID(BLEUUID(serviceUUID));
62 } // addServiceUUID

◆ setAdvertisementData()

void BLEAdvertising::setAdvertisementData ( BLEAdvertisementData advertisementData)

Set the advertisement data that is to be published in a regular advertisement.

Parameters
[in]advertisementDataThe data to be advertised.

◆ setAppearance()

void BLEAdvertising::setAppearance ( uint16_t  appearance)

Set the device appearance in the advertising data. The appearance attribute is of type 0x19. The codes for distinct appearances can be found here: https://www.bluetooth.com/specifications/gatt/viewer?attributeXmlFile=org.bluetooth.characteristic.gap.appearance.xml.

Parameters
[in]appearanceThe appearance of the device in the advertising data.
Returns
N/A.

◆ setMaxInterval()

void BLEAdvertising::setMaxInterval ( uint16_t  maxinterval)

Set the maximum interval.

The unit is hardware dependent.

Try setMaxIntervalMicros() to set the interval in unit of usec.

◆ setMaxIntervalMicros()

uint32_t BLEAdvertising::setMaxIntervalMicros ( uint32_t  usec)

Set the maximum interval in unit of usec.

Returns
The actual configured interval value.

◆ setMinInterval()

void BLEAdvertising::setMinInterval ( uint16_t  mininterval)

Set the minimum interval.

The unit is hardware dependent.

Try setMixIntervalMicros() to set the interval in unit of usec.

◆ setMinIntervalMicros()

uint32_t BLEAdvertising::setMinIntervalMicros ( uint32_t  usec)

Set the minimum interval in unit of usec.

Returns
The actual configured interval value.

◆ setScanFilter()

void BLEAdvertising::setScanFilter ( bool  scanRequertWhitelistOnly,
bool  connectWhitelistOnly 
)

Set the filtering for the scan filter.

Parameters
[in]scanRequestWhitelistOnlyIf true, only allow scan requests from those on the white list.
[in]connectWhitelistOnlyIf true, only allow connections from those on the white list.

◆ setScanResponseData()

void BLEAdvertising::setScanResponseData ( BLEAdvertisementData advertisementData)

Set the advertisement data that is to be published in a scan response.

Parameters
[in]advertisementDataThe data to be advertised.

◆ start()

void BLEAdvertising::start ( )

Start advertising. Start advertising.

Returns
N/A.

◆ stop()

void BLEAdvertising::stop ( )

Stop advertising. Stop advertising.

Returns
N/A.

The documentation for this class was generated from the following files:
BLEAdvertising::addServiceUUID
void addServiceUUID(BLEUUID serviceUUID)
Add a service uuid to exposed list of services.
Definition: BLEAdvertising.cpp:51
BLEUUID
A model of a BLE UUID.
Definition: BLEUUID.hpp:41