17 #ifndef MBED_ADVERTISING_PARAMETERS_H__ 18 #define MBED_ADVERTISING_PARAMETERS_H__ 23 #include "BLEProtocol.h" 24 #include "blecommon.h" 103 static const uint32_t DEFAULT_ADVERTISING_INTERVAL_MIN = 0x400;
108 static const uint32_t DEFAULT_ADVERTISING_INTERVAL_MAX = 0x800;
116 static const uint32_t GAP_ADV_PARAMS_INTERVAL_MIN_NONCON = 0x00A0;
139 bool useLegacyPDU =
true 142 _minInterval(minInterval),
143 _maxInterval(maxInterval),
147 _primaryPhy(
phy_t::LE_1M),
148 _secondaryPhy(
phy_t::LE_1M),
156 _notifyOnScan(false),
157 _legacyPDU(useLegacyPDU),
158 _includeHeaderTxPower(false)
184 _primaryPhy(
phy_t::LE_1M),
185 _secondaryPhy(
phy_t::LE_1M),
193 _notifyOnScan(false),
194 _legacyPDU(useLegacyPDU),
195 _includeHeaderTxPower(false)
220 _advType = newAdvType;
242 _advType = newAdvType;
301 bool channel37,
bool channel38,
bool channel39
304 if (!channel37 && !channel38 && !channel39) {
305 channel37 = channel38 = channel39 =
true;
307 _channel37 = channel37;
308 _channel38 = channel38;
309 _channel39 = channel39;
346 _ownAddressType = addressType;
356 return _ownAddressType;
371 _peerAddress = address;
372 _peerAddressType = addressType;
392 return _peerAddressType;
413 #if BLE_FEATURE_WHITELIST 417 #endif // BLE_FEATURE_WHITELIST 431 _primaryPhy = primaryPhy;
432 _secondaryPhy = secondaryPhy;
451 return _secondaryPhy;
483 _maxSkip = eventNumber;
506 _notifyOnScan = enable;
516 return _notifyOnScan;
557 _includeHeaderTxPower = enable;
567 return _includeHeaderTxPower;
601 _minInterval =
adv_interval_t(std::max(_minInterval.
value(), GAP_ADV_PARAMS_INTERVAL_MIN_NONCON));
602 _maxInterval =
adv_interval_t(std::max(_maxInterval.
value(), GAP_ADV_PARAMS_INTERVAL_MIN_NONCON));
629 bool _notifyOnScan:1;
631 bool _includeHeaderTxPower:1;
bool getChannel37() const
Check if channel 37 is used for primary advertising.
AdvertisingParameters & setType(advertising_type_t newAdvType)
Update the advertising type.
AdvertisingParameters & setType(advertising_type_t newAdvType, bool legacy)
Update the advertising type and whether to use legacy PDU.
advertising_filter_policy_t getFilter() const
Get the filter policy of whitelist use during advertising;.
Advertising policy filter modes.
AdvertisingParameters & setScanRequestNotification(bool enable=true)
Enabled or disable the callback that notifies the user about a scan request.
AdvertisingParameters & setPeer(const address_t &address, target_peer_address_type_t addressType)
Set peer address and type used during directed advertising.
own_address_type_t getOwnAddressType() const
Get what type of address is to be used as your own address during advertising.
Device is not connectable and not scannable.
Device is connectable, scannable and doesn't expect connection from a specific peer.
advertising_power_t getTxPower() const
Get the advertising TX power.
Rep value() const
Return the duration in TB units.
phy_t getSecondaryPhy() const
Get PHY used for secondary advertising.
AdvertisingParameters & setTxPower(advertising_power_t txPower)
Set the advertising TX power.
AdvertisingParameters(advertising_type_t advType, bool useLegacyPDU)
Construct an instance of GapAdvertisingParams.
const address_t & getPeerAddress() const
Get the peer address used during directed advertising.
Device is connectable and expects connection from a specific peer.
bool getChannel38() const
Check if channel 38 is used for primary advertising.
Process connection and scan requests from all devices.
target_peer_address_type_t getPeerAddressType() const
Get the peer address type used during directed advertising.
AdvertisingParameters & setOwnAddressType(own_address_type_t addressType)
Get what type of address is to be used as your own address during advertising.
Type of an address to connect to.
AdvertisingParameters & setPhy(phy_t primaryPhy, phy_t secondaryPhy)
Get PHYs used on primary and secondary advertising channels.
int8_t advertising_power_t
Describe the advertising power.
Type that describes a bluetooth PHY(sical) transport.
AdvertisingParameters & setPrimaryChannels(bool channel37, bool channel38, bool channel39)
Set which channels are to be used for primary advertising.
adv_interval_t getMaxPrimaryInterval() const
Get the maximum advertising intervals on the primary channels.
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.
AdvertisingParameters & setPrimaryInterval(adv_interval_t min, adv_interval_t max)
Set the advertising intervals on the primary channels.
advertising_type_t getType() const
Return the advertising type.
uint8_t getSecondaryMaxSkip() const
Return how many events can be skipped on the secondary channel.
phy_t getPrimaryPhy() const
Get PHY used for primary advertising.
bool getUseLegacyPDU() const
Check if legacy PDU is used during advertising.
adv_interval_t getMinPrimaryInterval() const
Get the minimum advertising intervals on the primary channels.
Duration< uint32_t, 625, Range< 0x20, 0xFFFFFF > > adv_interval_t
Time interval between two advertisements.
Parameters defining the advertising process.
AdvertisingParameters & includeTxPowerInHeader(bool enable=true)
Set if TX power should be included in the header.
AdvertisingParameters & setSecondaryMaxSkip(uint8_t eventNumber)
Set how many events can be skipped on the secondary channel.
AdvertisingParameters & setFilter(advertising_filter_policy_t mode)
Set the filter policy of whitelist use during advertising;.
AdvertisingParameters & setUseLegacyPDU(bool enable=true)
Use legacy PDU during advertising.
Encapsulates the peripheral advertising modes.
bool getTxPowerInHeader() const
Check if TX power should be included in the header.
Type used to model the own address used during the following GAP operations: advertising, scanning and initiating.
Entry namespace for all BLE API definitions.
AdvertisingParameters & setAnonymousAdvertising(bool enable)
Advertise without your own address.
bool getAnonymousAdvertising() const
Check if advertising is anonymous.
bool getScanRequestNotification() const
Return of the callback for scan request is enabled.
bool getChannel39() const
Check if channel 39 is used for primary advertising.