NimBLE-Arduino 1.4.2
Loading...
Searching...
No Matches
NimBLEExtAdvertising Class Reference

Extended advertising class. More...

#include <NimBLEExtAdvertising.h>

Public Member Functions

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

Detailed Description

Extended advertising class.

Member Function Documentation

◆ isActive()

bool NimBLEExtAdvertising::isActive ( uint8_t  inst_id)

Check if currently advertising.

Parameters
[in]inst_idThe 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  inst_id)

Stop and remove this instance data from the advertisement set.

Parameters
[in]inst_idThe 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  inst_id,
NimBLEExtAdvertisement adv 
)

Register the extended advertisement data.

Parameters
[in]inst_idThe 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  inst_id,
NimBLEExtAdvertisement lsr 
)

Set the scan response data for a legacy advertisement.

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

◆ start()

bool NimBLEExtAdvertising::start ( uint8_t  inst_id,
int  duration = 0,
int  max_events = 0 
)

Start extended advertising.

Parameters
[in]inst_idThe extended advertisement instance ID to start.
[in]durationHow long to advertise for in milliseconds, 0 = forever (default).
[in]max_eventsMaximum 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  inst_id)

Stop advertising this instance data.

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