Mbed OS Reference
Loading...
Searching...
No Matches
ScanParameters Class Reference

Parameters defining the scan process. More...

#include <ScanParameters.h>

Data Structures

struct  phy_configuration_t
 Scan configuration of a physical channel. More...
 

Public Member Functions

 ScanParameters (phy_t phy=phy_t::LE_1M, scan_interval_t scan_interval=scan_interval_t::min(), scan_window_t scan_window=scan_window_t::min(), bool active_scanning=false, own_address_type_t own_address_type=own_address_type_t::RANDOM, scanning_filter_policy_t scanning_filter_policy=scanning_filter_policy_t::NO_FILTER)
 Construct a ScanParameters object that operates on a selected PHY. More...
 
ScanParameterssetOwnAddressType (own_address_type_t address)
 Set the address type used for scan requests. More...
 
own_address_type_t getOwnAddressType () const
 Get the address type used during scan requests. More...
 
ScanParameterssetFilter (scanning_filter_policy_t filter_policy)
 Set the filter to apply during scanning. More...
 
scanning_filter_policy_t getFilter () const
 Get the filter to use during scanning. More...
 
ScanParameterssetPhys (bool enable_1m, bool enable_coded)
 Enable or disable PHYs that should be used during scanning. More...
 
phy_set_t getPhys () const
 Get the PHYs to use during scanning. More...
 
ScanParametersset1mPhyConfiguration (scan_interval_t interval, scan_window_t window, bool active_scanning)
 Set the 1M scan configuration. More...
 
phy_configuration_t get1mPhyConfiguration () const
 Get the 1M scan configuration. More...
 
ScanParameterssetCodedPhyConfiguration (scan_interval_t interval, scan_window_t window, bool active_scanning)
 Set the coded PHY scan configuration. More...
 
phy_configuration_t getCodedPhyConfiguration () const
 Get the coded PHY scan configuration. More...
 

Detailed Description

Parameters defining the scan process.

The scan process is defined by two main parameters:

  • The scan window that defines how long the device should scan.
  • The scan window that defines how frequently the device should scan.

To scan continuously, the scan window and the scan interval should have the same value.

To get extra data from the advertising device, the scanner can send scan requests to the advertiser; the advertiser may respond with scan responses. It is possible to select what type of address is used to issue the scan request.

With Bluetooth 5, devices can advertise on more physical channels, and by extension, they can scan on more physical channels. It is possible to define independent scan parameters for every scannable physical channel.

Definition at line 54 of file ScanParameters.h.

Constructor & Destructor Documentation

◆ ScanParameters()

ScanParameters ( phy_t  phy = phy_t::LE_1M,
scan_interval_t  scan_interval = scan_interval_t::min(),
scan_window_t  scan_window = scan_window_t::min(),
bool  active_scanning = false,
own_address_type_t  own_address_type = own_address_type_t::RANDOM,
scanning_filter_policy_t  scanning_filter_policy = scanning_filter_policy_t::NO_FILTER 
)

Construct a ScanParameters object that operates on a selected PHY.

Parameters
phyThe phy to configure.
scan_intervalThe scan interval.
scan_windowThe scan window.
active_scanningactive scanning flag.
own_address_typeAddress type used in scan requests.
scanning_filter_policyFilter applied.

Definition at line 122 of file ScanParameters.h.

Member Function Documentation

◆ setOwnAddressType()

ScanParameters & setOwnAddressType ( own_address_type_t  address)

Set the address type used for scan requests.

Parameters
addressThe type of address to use during scan requests.
Returns
A reference to this object.

Definition at line 152 of file ScanParameters.h.

◆ getOwnAddressType()

own_address_type_t getOwnAddressType ( ) const

Get the address type used during scan requests.

Definition at line 161 of file ScanParameters.h.

◆ setFilter()

ScanParameters & setFilter ( scanning_filter_policy_t  filter_policy)

Set the filter to apply during scanning.

Parameters
filter_policyThe filter to apply during scanning.
Returns
A reference to this object.

Definition at line 171 of file ScanParameters.h.

◆ getFilter()

scanning_filter_policy_t getFilter ( ) const

Get the filter to use during scanning.

Definition at line 180 of file ScanParameters.h.

◆ setPhys()

ScanParameters & setPhys ( bool  enable_1m,
bool  enable_coded 
)

Enable or disable PHYs that should be used during scanning.

Parameters
enable_1mTrue to enable the 1M phy and false to disable it.
enable_codedTrue to enable the coded phy and false to disable it.
Returns
A reference to this object.

Definition at line 195 of file ScanParameters.h.

◆ getPhys()

phy_set_t getPhys ( ) const

Get the PHYs to use during scanning.

Definition at line 207 of file ScanParameters.h.

◆ set1mPhyConfiguration()

ScanParameters & set1mPhyConfiguration ( scan_interval_t  interval,
scan_window_t  window,
bool  active_scanning 
)

Set the 1M scan configuration.

Parameters
intervalThe scan interval to use.
windowThe scan window to use.
active_scanningThe active scanning flag.
Returns
A reference to this object.

Definition at line 219 of file ScanParameters.h.

◆ get1mPhyConfiguration()

phy_configuration_t get1mPhyConfiguration ( ) const

Get the 1M scan configuration.

Definition at line 235 of file ScanParameters.h.

◆ setCodedPhyConfiguration()

ScanParameters & setCodedPhyConfiguration ( scan_interval_t  interval,
scan_window_t  window,
bool  active_scanning 
)

Set the coded PHY scan configuration.

Parameters
intervalThe scan interval to use.
windowThe scan window to use.
active_scanningThe active scanning flag.
Returns
A reference to this object.

Definition at line 247 of file ScanParameters.h.

◆ getCodedPhyConfiguration()

phy_configuration_t getCodedPhyConfiguration ( ) const

Get the coded PHY scan configuration.

Definition at line 265 of file ScanParameters.h.