Mbed OS Reference
|
Parameters defining the advertising process. More...
#include <AdvertisingParameters.h>
Public Member Functions | |
AdvertisingParameters (advertising_type_t advType=advertising_type_t::CONNECTABLE_UNDIRECTED, adv_interval_t minInterval=adv_interval_t(DEFAULT_ADVERTISING_INTERVAL_MIN), adv_interval_t maxInterval=adv_interval_t(DEFAULT_ADVERTISING_INTERVAL_MAX), bool useLegacyPDU=true) | |
Construct an instance of GapAdvertisingParams. More... | |
AdvertisingParameters (advertising_type_t advType, bool useLegacyPDU) | |
Construct an instance of GapAdvertisingParams. More... | |
AdvertisingParameters & | setType (advertising_type_t newAdvType, bool legacy) |
Update the advertising type and whether to use legacy PDU. More... | |
AdvertisingParameters & | setType (advertising_type_t newAdvType) |
Update the advertising type. More... | |
advertising_type_t | getType () const |
Return the advertising type. More... | |
AdvertisingParameters & | setPrimaryInterval (adv_interval_t min, adv_interval_t max) |
Set the advertising intervals on the primary channels. More... | |
adv_interval_t | getMinPrimaryInterval () const |
Get the minimum advertising intervals on the primary channels. More... | |
adv_interval_t | getMaxPrimaryInterval () const |
Get the maximum advertising intervals on the primary channels. More... | |
AdvertisingParameters & | setPrimaryChannels (bool channel37, bool channel38, bool channel39) |
Set which channels are to be used for primary advertising. More... | |
bool | getChannel37 () const |
Check if channel 37 is used for primary advertising. More... | |
bool | getChannel38 () const |
Check if channel 38 is used for primary advertising. More... | |
bool | getChannel39 () const |
Check if channel 39 is used for primary advertising. More... | |
AdvertisingParameters & | setOwnAddressType (own_address_type_t addressType) |
Get what type of address is to be used as your own address during advertising. More... | |
own_address_type_t | getOwnAddressType () const |
Get what type of address is to be used as your own address during advertising. More... | |
AdvertisingParameters & | setPeer (const address_t &address, target_peer_address_type_t addressType) |
Set peer address and type used during directed advertising. More... | |
const address_t & | getPeerAddress () const |
Get the peer address used during directed advertising. More... | |
target_peer_address_type_t | getPeerAddressType () const |
Get the peer address type used during directed advertising. More... | |
AdvertisingParameters & | setFilter (advertising_filter_policy_t mode) |
Set the filter policy of whitelist use during advertising;. More... | |
advertising_filter_policy_t | getFilter () const |
Get the filter policy of whitelist use during advertising;. More... | |
AdvertisingParameters & | setPhy (phy_t primaryPhy, phy_t secondaryPhy) |
Get PHYs used on primary and secondary advertising channels. More... | |
phy_t | getPrimaryPhy () const |
Get PHY used for primary advertising. More... | |
phy_t | getSecondaryPhy () const |
Get PHY used for secondary advertising. More... | |
AdvertisingParameters & | setTxPower (advertising_power_t txPower) |
Set the advertising TX power. More... | |
advertising_power_t | getTxPower () const |
Get the advertising TX power. More... | |
AdvertisingParameters & | setSecondaryMaxSkip (uint8_t eventNumber) |
Set how many events can be skipped on the secondary channel. More... | |
uint8_t | getSecondaryMaxSkip () const |
Return how many events can be skipped on the secondary channel. More... | |
AdvertisingParameters & | setScanRequestNotification (bool enable=true) |
Enabled or disable the callback that notifies the user about a scan request. More... | |
bool | getScanRequestNotification () const |
Return of the callback for scan request is enabled. More... | |
AdvertisingParameters & | setUseLegacyPDU (bool enable=true) |
Use legacy PDU during advertising. More... | |
bool | getUseLegacyPDU () const |
Check if legacy PDU is used during advertising. More... | |
AdvertisingParameters & | includeTxPowerInHeader (bool enable=true) |
Set if TX power should be included in the header. More... | |
bool | getTxPowerInHeader () const |
Check if TX power should be included in the header. More... | |
AdvertisingParameters & | setAnonymousAdvertising (bool enable) |
Advertise without your own address. More... | |
bool | getAnonymousAdvertising () const |
Check if advertising is anonymous. More... | |
Parameters defining the advertising process.
Advertising parameters for legacy advertising are a mainly defined by a pair of values:
In addition, it is possible to adjust other parameters:
For directed advertising, you can set the address of the target with the help of setPeer() and query it with getPeerAddress() and getPeerAddressType().
To use extended advertising features, first disable legacy advertising with setUseLegacyPDU().
Extended advertising adds new features to BLE advertising:
This API is designed for usability. You can construct it and pass it in place. To achieve this, the fluent interface pattern is used. Every setter returns a reference to the object modified and can be chained.
Definition at line 99 of file AdvertisingParameters.h.
AdvertisingParameters | ( | advertising_type_t | advType = advertising_type_t::CONNECTABLE_UNDIRECTED , |
adv_interval_t | minInterval = adv_interval_t(DEFAULT_ADVERTISING_INTERVAL_MIN) , |
||
adv_interval_t | maxInterval = adv_interval_t(DEFAULT_ADVERTISING_INTERVAL_MAX) , |
||
bool | useLegacyPDU = true |
||
) |
Construct an instance of GapAdvertisingParams.
[in] | advType | Type of advertising. |
[in] | minInterval,maxInterval | Time interval between two advertisement. A range is provided to the LE subsystem, so it can adjust the advertising interval with other transmission happening on the BLE radio. |
[in] | useLegacyPDU | If true legacy PDU shall be used for advertising. |
Definition at line 136 of file AdvertisingParameters.h.
AdvertisingParameters | ( | advertising_type_t | advType, |
bool | useLegacyPDU | ||
) |
Construct an instance of GapAdvertisingParams.
[in] | advType | Type of advertising. |
[in] | useLegacyPDU | If true legacy PDU shall be used for advertising. |
Definition at line 175 of file AdvertisingParameters.h.
AdvertisingParameters & setType | ( | advertising_type_t | newAdvType, |
bool | legacy | ||
) |
Update the advertising type and whether to use legacy PDU.
[in] | newAdvType | The new advertising type. |
[in] | legacy | If true, legacy PDU will be used. |
Definition at line 214 of file AdvertisingParameters.h.
AdvertisingParameters & setType | ( | advertising_type_t | newAdvType | ) |
Update the advertising type.
[in] | newAdvType | The new advertising type. |
Definition at line 236 of file AdvertisingParameters.h.
advertising_type_t getType | ( | ) | const |
Return the advertising type.
Definition at line 252 of file AdvertisingParameters.h.
AdvertisingParameters & setPrimaryInterval | ( | adv_interval_t | min, |
adv_interval_t | max | ||
) |
Set the advertising intervals on the primary channels.
[in] | min,max | Time interval between two advertisements. A range is provided to the LE subsystem, so it can adjust the advertising interval with other transmission happening on the BLE radio. |
Definition at line 265 of file AdvertisingParameters.h.
adv_interval_t getMinPrimaryInterval | ( | ) | const |
Get the minimum advertising intervals on the primary channels.
Definition at line 278 of file AdvertisingParameters.h.
adv_interval_t getMaxPrimaryInterval | ( | ) | const |
Get the maximum advertising intervals on the primary channels.
Definition at line 287 of file AdvertisingParameters.h.
AdvertisingParameters & setPrimaryChannels | ( | bool | channel37, |
bool | channel38, | ||
bool | channel39 | ||
) |
Set which channels are to be used for primary advertising.
At least must be used. If all are set to disabled, all channels will be used.
channel37 | Use channel 37. |
channel38 | Use channel 38. |
channel39 | Use channel 39. |
Definition at line 301 of file AdvertisingParameters.h.
bool getChannel37 | ( | ) | const |
Check if channel 37 is used for primary advertising.
Definition at line 318 of file AdvertisingParameters.h.
bool getChannel38 | ( | ) | const |
Check if channel 38 is used for primary advertising.
Definition at line 327 of file AdvertisingParameters.h.
bool getChannel39 | ( | ) | const |
Check if channel 39 is used for primary advertising.
Definition at line 336 of file AdvertisingParameters.h.
AdvertisingParameters & setOwnAddressType | ( | own_address_type_t | addressType | ) |
Get what type of address is to be used as your own address during advertising.
Definition at line 345 of file AdvertisingParameters.h.
own_address_type_t getOwnAddressType | ( | ) | const |
Get what type of address is to be used as your own address during advertising.
Definition at line 355 of file AdvertisingParameters.h.
AdvertisingParameters & setPeer | ( | const address_t & | address, |
target_peer_address_type_t | addressType | ||
) |
Set peer address and type used during directed advertising.
address | Peer's address bytes. |
addressType | Peer's address type. |
Definition at line 367 of file AdvertisingParameters.h.
const address_t & getPeerAddress | ( | ) | const |
Get the peer address used during directed advertising.
Definition at line 381 of file AdvertisingParameters.h.
target_peer_address_type_t getPeerAddressType | ( | ) | const |
Get the peer address type used during directed advertising.
Definition at line 391 of file AdvertisingParameters.h.
AdvertisingParameters & setFilter | ( | advertising_filter_policy_t | mode | ) |
Set the filter policy of whitelist use during advertising;.
mode | Policy to use. |
Definition at line 402 of file AdvertisingParameters.h.
advertising_filter_policy_t getFilter | ( | ) | const |
Get the filter policy of whitelist use during advertising;.
Definition at line 412 of file AdvertisingParameters.h.
AdvertisingParameters & setPhy | ( | phy_t | primaryPhy, |
phy_t | secondaryPhy | ||
) |
Get PHYs used on primary and secondary advertising channels.
primaryPhy | Primary advertising channels PHY. |
secondaryPhy | Secondary advertising channels PHY. |
Definition at line 430 of file AdvertisingParameters.h.
phy_t getPrimaryPhy | ( | ) | const |
Get PHY used for primary advertising.
Definition at line 441 of file AdvertisingParameters.h.
phy_t getSecondaryPhy | ( | ) | const |
Get PHY used for secondary advertising.
Definition at line 450 of file AdvertisingParameters.h.
AdvertisingParameters & setTxPower | ( | advertising_power_t | txPower | ) |
Set the advertising TX power.
txPower | Advertising TX power. |
Definition at line 461 of file AdvertisingParameters.h.
advertising_power_t getTxPower | ( | ) | const |
Get the advertising TX power.
Definition at line 471 of file AdvertisingParameters.h.
AdvertisingParameters & setSecondaryMaxSkip | ( | uint8_t | eventNumber | ) |
Set how many events can be skipped on the secondary channel.
eventNumber | Number of events that can be skipped. |
Definition at line 482 of file AdvertisingParameters.h.
uint8_t getSecondaryMaxSkip | ( | ) | const |
Return how many events can be skipped on the secondary channel.
Definition at line 492 of file AdvertisingParameters.h.
AdvertisingParameters & setScanRequestNotification | ( | bool | enable = true | ) |
Enabled or disable the callback that notifies the user about a scan request.
enable | Enable callback if true. |
Definition at line 505 of file AdvertisingParameters.h.
bool getScanRequestNotification | ( | ) | const |
Return of the callback for scan request is enabled.
Definition at line 515 of file AdvertisingParameters.h.
AdvertisingParameters & setUseLegacyPDU | ( | bool | enable = true | ) |
Use legacy PDU during advertising.
enable | If true, legacy PDU will be used. |
Definition at line 529 of file AdvertisingParameters.h.
bool getUseLegacyPDU | ( | ) | const |
Check if legacy PDU is used during advertising.
Definition at line 545 of file AdvertisingParameters.h.
AdvertisingParameters & includeTxPowerInHeader | ( | bool | enable = true | ) |
Set if TX power should be included in the header.
enable | If true, include the TX power in the header. |
Definition at line 556 of file AdvertisingParameters.h.
bool getTxPowerInHeader | ( | ) | const |
Check if TX power should be included in the header.
Definition at line 566 of file AdvertisingParameters.h.
AdvertisingParameters & setAnonymousAdvertising | ( | bool | enable | ) |
Advertise without your own address.
enable | Advertising anonymous if true. |
Definition at line 579 of file AdvertisingParameters.h.
bool getAnonymousAdvertising | ( | ) | const |
Check if advertising is anonymous.
Definition at line 589 of file AdvertisingParameters.h.