PebbleOS
Loading...
Searching...
No Matches
Functions
Advertising

LE advertising. More...

Functions

bool pbl_bt_advert_advertising_enable (uint32_t min_interval_ms, uint32_t max_interval_ms)
 Start advertising.
 
void pbl_bt_advert_advertising_disable (void)
 Stop advertising, if active.
 
bool pbl_bt_advert_client_get_tx_power (int8_t *tx_power)
 Get the advertising transmit power.
 
bool pbl_bt_advert_set_advertising_data (const struct pbl_bt_ad_data *ad_data)
 Set the advertising data and scan response data.
 

Detailed Description

LE advertising.

Advertising is connectable and general discoverable. Connections are only established through it, so the GAP events of a connection (see LE connections) are reported through the advertising event handler.

The advertising data must be set before enabling advertising, and again after the host re-synchronizes (see pbl_bt_handle_host_resynced()):

static const uint8_t flags[] = {
};
uint8_t buf[sizeof(struct pbl_bt_ad_data) + 2 * PBL_BT_AD_REPORT_DATA_MAX_LENGTH];
struct pbl_bt_ad_data *ad = (struct pbl_bt_ad_data *)buf;
ad->ad_data_length = sizeof(flags);
memcpy(ad->data, flags, sizeof(flags));
}
bool pbl_bt_advert_advertising_enable(uint32_t min_interval_ms, uint32_t max_interval_ms)
Start advertising.
bool pbl_bt_advert_set_advertising_data(const struct pbl_bt_ad_data *ad_data)
Set the advertising data and scan response data.
uint8_t ad_data_length
Length of the advertising data in bytes.
Definition types.h:383
uint8_t scan_resp_data_length
Length of the scan response data in bytes.
Definition types.h:386
uint8_t data[0]
The raw advertising data, followed by the raw scan response data.
Definition types.h:389
Advertising data and scan response data.
Definition types.h:381
#define PBL_BT_AD_FLAGS_BR_EDR_NOT_SUPPORTED_MASK
BR/EDR Not Supported.
Definition types.h:362
#define PBL_BT_AD_FLAGS_GEN_DISCOVERABLE_MASK
LE General Discoverable Mode.
Definition types.h:360
#define PBL_BT_AD_REPORT_DATA_MAX_LENGTH
Maximum size in bytes of advertising data or scan response data.
Definition types.h:350

Function Documentation

◆ pbl_bt_advert_advertising_disable()

void pbl_bt_advert_advertising_disable ( void  )

Stop advertising, if active.

◆ pbl_bt_advert_advertising_enable()

bool pbl_bt_advert_advertising_enable ( uint32_t  min_interval_ms,
uint32_t  max_interval_ms 
)

Start advertising.

Advertises until pbl_bt_advert_advertising_disable() is called or a connection is established.

Parameters
min_interval_msMinimum advertising interval in milliseconds.
max_interval_msMaximum advertising interval in milliseconds.
Returns
true if advertising started.

◆ pbl_bt_advert_client_get_tx_power()

bool pbl_bt_advert_client_get_tx_power ( int8_t *  tx_power)

Get the advertising transmit power.

Not supported by the NimBLE backend, which always returns false.

Parameters
[out]tx_powerTransmit power in dBm.
Returns
true if tx_power was set.

◆ pbl_bt_advert_set_advertising_data()

bool pbl_bt_advert_set_advertising_data ( const struct pbl_bt_ad_data *  ad_data)

Set the advertising data and scan response data.

Parameters
ad_dataAdvertising and scan response data, each at most PBL_BT_AD_REPORT_DATA_MAX_LENGTH bytes. Copied during the call.
Returns
true on success.