Periodic Advertiser

Periodic Advertiser.

Modules

Periodic Advertising Configuration Flags
 

Functions

sl_status_t sl_bt_periodic_advertiser_set_data (uint8_t advertising_set, size_t data_len, const uint8_t *data)
 
sl_status_t sl_bt_periodic_advertiser_set_long_data (uint8_t advertising_set)
 
sl_status_t sl_bt_periodic_advertiser_start (uint8_t advertising_set, uint16_t interval_min, uint16_t interval_max, uint32_t flags)
 
sl_status_t sl_bt_periodic_advertiser_stop (uint8_t advertising_set)
 

Detailed Description

Periodic Advertiser.

Provides the periodic advertising feature.

Function Documentation

◆ sl_bt_periodic_advertiser_set_data()

sl_status_t sl_bt_periodic_advertiser_set_data ( uint8_t  advertising_set,
size_t  data_len,
const uint8_t *  data 
)

Set the data for periodic advertising on an advertising set. Maximum 254 bytes of data can be set with this command. For setting longer advertising data, use command sl_bt_periodic_advertiser_set_long_data.

If the periodic advertising is currently enabled, the new advertising data will be used immediately. Periodic advertising can be enabled using the command sl_bt_periodic_advertiser_start.

The invalid parameter error will be returned if the data is too long to fit into the advertisement.

Parameters
[in]advertising_setAdvertising set handle
[in]data_lenLength of data in data
[in]dataData to be set
Returns
SL_STATUS_OK if successful. Error code otherwise.

◆ sl_bt_periodic_advertiser_set_long_data()

sl_status_t sl_bt_periodic_advertiser_set_long_data ( uint8_t  advertising_set)

Set data for periodic advertising on an advertising set. Data currently in the system data buffer will be extracted as the advertising data. The buffer will be emptied after this command regardless of the completion status.

Prior to calling this command, add data to the buffer with one or multiple calls to sl_bt_system_data_buffer_write.

Maximum 1650 bytes of data can be set for periodic advertising. Advertising parameters may limit the amount of data that can be sent.

See sl_bt_periodic_advertiser_set_data for more details.

Parameters
[in]advertising_setAdvertising set handle
Returns
SL_STATUS_OK if successful. Error code otherwise.

◆ sl_bt_periodic_advertiser_start()

sl_status_t sl_bt_periodic_advertiser_start ( uint8_t  advertising_set,
uint16_t  interval_min,
uint16_t  interval_max,
uint32_t  flags 
)

Start periodic advertising on an advertising set.

When the flag SL_BT_PERIODIC_ADVERTISER_AUTO_START_EXTENDED_ADVERTISING is set, the stack will start the extended advertising and will return the invalid parameter error if the extended advertising cannot be started for some reason.

Use sl_bt_periodic_advertiser_stop command to stop the periodic advertising.

Parameters
[in]advertising_setAdvertising set handle
[in]interval_min

Minimum periodic advertising interval. Value in units of 1.25 ms

  • Range: 0x06 to 0xFFFF
  • Time range: 7.5 ms to 81.92 s

Default value: 100 ms

[in]interval_max

Maximum periodic advertising interval. Value in units of 1.25 ms

  • Range: 0x06 to 0xFFFF
  • Time range: 7.5 ms to 81.92 s
  • Note: interval_max should be bigger than interval_min

Default value: 200 ms

[in]flagsAdditional periodic advertising options. Value: 0 or bitmask of Periodic Advertising Configuration Flags
Returns
SL_STATUS_OK if successful. Error code otherwise.

◆ sl_bt_periodic_advertiser_stop()

sl_status_t sl_bt_periodic_advertiser_stop ( uint8_t  advertising_set)

Stop the periodic advertising on an advertising set. Counterpart to sl_bt_periodic_advertiser_start.

This command does not affect the enable state of the legacy or extended advertising on the advertising set, i.e., the legacy or extended advertising is not stopped..

Parameters
[in]advertising_setAdvertising set handle
Returns
SL_STATUS_OK if successful. Error code otherwise.