esp-nimble-cpp 2.0.2
Loading...
Searching...
No Matches
NimBLEExtAdvertising Class Reference

Extended advertising class. More...

#include <NimBLEExtAdvertising.h>

Public Member Functions

 NimBLEExtAdvertising ()
 Constructor.
 
 ~NimBLEExtAdvertising ()
 Destructor: deletes callback instances if requested.
 
bool start (uint8_t instId, int duration=0, int maxEvents=0)
 Start extended advertising.
 
bool setInstanceData (uint8_t instId, NimBLEExtAdvertisement &adv)
 Register the extended advertisement data.
 
bool setScanResponseData (uint8_t instId, NimBLEExtAdvertisement &data)
 Set the scan response data for a legacy advertisement.
 
bool removeInstance (uint8_t instId)
 Stop and remove this instance data from the advertisement set.
 
bool removeAll ()
 Stop and remove all advertising instance data.
 
bool stop (uint8_t instId)
 Stop advertising this instance data.
 
bool stop ()
 Stop all advertisements.
 
bool isActive (uint8_t instId)
 Check if currently advertising.
 
bool isAdvertising ()
 Check if any instances are currently advertising.
 
void setCallbacks (NimBLEExtAdvertisingCallbacks *callbacks, bool deleteCallbacks=true)
 Set a callback to call when the advertisement stops.
 

Detailed Description

Extended advertising class.

Member Function Documentation

◆ isActive()

bool NimBLEExtAdvertising::isActive ( uint8_t  instId)

Check if currently advertising.

Parameters
[in]instIdThe instance ID of the advertised data to get the status of.
Returns
True if advertising is active.

◆ isAdvertising()

bool NimBLEExtAdvertising::isAdvertising ( )

Check if any instances are currently advertising.

Returns
True if any instance is active.

◆ removeAll()

bool NimBLEExtAdvertising::removeAll ( )

Stop and remove all advertising instance data.

Returns
True if successful.

◆ removeInstance()

bool NimBLEExtAdvertising::removeInstance ( uint8_t  instId)

Stop and remove this instance data from the advertisement set.

Parameters
[in]instIdThe extended advertisement instance to stop advertising.
Returns
True if successful.

◆ setCallbacks()

void NimBLEExtAdvertising::setCallbacks ( NimBLEExtAdvertisingCallbacks pCallbacks,
bool  deleteCallbacks = true 
)

Set a callback to call when the advertisement stops.

Parameters
[in]pCallbacksA pointer to a callback to be invoked when an advertisement stops.
[in]deleteCallbacksif true callback class will be deleted when advertising is destructed.

◆ setInstanceData()

bool NimBLEExtAdvertising::setInstanceData ( uint8_t  instId,
NimBLEExtAdvertisement adv 
)

Register the extended advertisement data.

Parameters
[in]instIdThe extended advertisement instance ID to assign to this data.
[in]advThe extended advertisement instance with the data to set.
Returns
True if advertising started successfully.

◆ setScanResponseData()

bool NimBLEExtAdvertising::setScanResponseData ( uint8_t  instId,
NimBLEExtAdvertisement data 
)

Set the scan response data for a legacy advertisement.

Parameters
[in]instIdThe extended advertisement instance ID to assign to this data.
[in]dataA reference to a NimBLEExtAdvertisement that contains the data.

◆ start()

bool NimBLEExtAdvertising::start ( uint8_t  instId,
int  duration = 0,
int  maxEvents = 0 
)

Start extended advertising.

Parameters
[in]instIdThe extended advertisement instance ID to start.
[in]durationHow long to advertise for in milliseconds, 0 = forever (default).
[in]maxEventsMaximum number of advertisement events to send, 0 = no limit (default).
Returns
True if advertising started successfully.

◆ stop() [1/2]

bool NimBLEExtAdvertising::stop ( )

Stop all advertisements.

Returns
True if successful.

◆ stop() [2/2]

bool NimBLEExtAdvertising::stop ( uint8_t  instId)

Stop advertising this instance data.

Parameters
[in]instIdThe extended advertisement instance to stop advertising.
Returns
True if successful.