QLowEnergyAdvertisingParameters Class

The QLowEnergyAdvertisingParameters class represents the parameters used for Bluetooth Low Energy advertising. 更多...

头: #include <QLowEnergyAdvertisingParameters>
qmake: QT += bluetooth

公共类型

class AddressInfo
enum FilterPolicy { IgnoreWhiteList, UseWhiteListForScanning, UseWhiteListForConnecting, UseWhiteListForScanningAndConnecting }
enum Mode { AdvInd, AdvScanInd, AdvNonConnInd }

公共函数

QLowEnergyAdvertisingParameters ()
QLowEnergyAdvertisingParameters (const QLowEnergyAdvertisingParameters & other )
~QLowEnergyAdvertisingParameters ()
QLowEnergyAdvertisingParameters::FilterPolicy filterPolicy () const
int maximumInterval () const
int minimumInterval () const
QLowEnergyAdvertisingParameters::Mode mode () const
void setInterval (quint16 minimum , quint16 maximum )
void setMode (QLowEnergyAdvertisingParameters::Mode mode )
void setWhiteList (const QList<QLowEnergyAdvertisingParameters::AddressInfo> & whiteList , QLowEnergyAdvertisingParameters::FilterPolicy policy )
void swap (QLowEnergyAdvertisingParameters & other )
QList<QLowEnergyAdvertisingParameters::AddressInfo> whiteList () const
QLowEnergyAdvertisingParameters & operator= (const QLowEnergyAdvertisingParameters & other )
bool operator!= (const QLowEnergyAdvertisingParameters & a , const QLowEnergyAdvertisingParameters & b )
bool operator== (const QLowEnergyAdvertisingParameters & a , const QLowEnergyAdvertisingParameters & b )

详细描述

When running the advertising procedure, a number of parameters can be configured, such as how fast to advertise or which clients, if any, can connect to the advertising device. These parameters are set via this class, and their values will be used when advertising is started by calling QLowEnergyController::startAdvertising ().

另请参阅 QLowEnergyAdvertisingData and QLowEnergyController::startAdvertising ().

成员类型文档编制

enum QLowEnergyAdvertisingParameters:: FilterPolicy

Specifies the semantics of the white list.

常量 描述
QLowEnergyAdvertisingParameters::IgnoreWhiteList 0x00 The value of the white list is ignored, that is, no filtering takes place for either scan or connection requests when using undirected advertising.
QLowEnergyAdvertisingParameters::UseWhiteListForScanning 0x01 The white list is used when handling scan requests, but is ignored for connection requests.
QLowEnergyAdvertisingParameters::UseWhiteListForConnecting 0x02 The white list is used when handling connection requests, but is ignored for scan requests.
QLowEnergyAdvertisingParameters::UseWhiteListForScanningAndConnecting 0x03 The white list is used for both connection and scan requests.

另请参阅 QLowEnergyAdvertisingParameters::whiteList ().

enum QLowEnergyAdvertisingParameters:: Mode

Specifies in which way to advertise.

常量 描述
QLowEnergyAdvertisingParameters::AdvInd 0x0 For non-directed, connectable advertising. Advertising is not directed to one specific device and a device seeing the advertisement can connect to the advertising device or send scan requests.
QLowEnergyAdvertisingParameters::AdvScanInd 0x2 For non-directed, scannable advertising. Advertising is not directed to one specific device and a device seeing the advertisement can send a scan request to the advertising device, but cannot connect to it.
QLowEnergyAdvertisingParameters::AdvNonConnInd 0x3 For non-directed, non-connectable advertising. Advertising is not directed to one specific device. A device seeing the advertisement cannot connect to the advertising device, nor can it send a scan request. This mode thus implies pure broadcasting.

成员函数文档编制

QLowEnergyAdvertisingParameters:: QLowEnergyAdvertisingParameters ()

Constructs a new object of this class. All values are initialized to their defaults according to the Bluetooth Low Energy specification.

QLowEnergyAdvertisingParameters:: QLowEnergyAdvertisingParameters (const QLowEnergyAdvertisingParameters & other )

Constructs a new object of this class that is a copy of other .

QLowEnergyAdvertisingParameters:: ~QLowEnergyAdvertisingParameters ()

销毁此对象。

QLowEnergyAdvertisingParameters::FilterPolicy QLowEnergyAdvertisingParameters:: filterPolicy () const

Returns the filter policy that determines how the white list is used. The default is QLowEnergyAdvertisingParameters::IgnoreWhiteList .

int QLowEnergyAdvertisingParameters:: maximumInterval () const

Returns the maximum advertising interval in milliseconds. The default is 1280.

int QLowEnergyAdvertisingParameters:: minimumInterval () const

Returns the minimum advertising interval in milliseconds. The default is 1280.

QLowEnergyAdvertisingParameters::Mode QLowEnergyAdvertisingParameters:: mode () const

Returns the advertising mode. The default is QLowEnergyAdvertisingParameters::AdvInd .

另请参阅 setMode ().

void QLowEnergyAdvertisingParameters:: setInterval ( quint16 minimum , quint16 maximum )

Sets the advertising interval. This is a range that gives the controller an upper and a lower bound for how often to send the advertising data. Both minimum and maximum are given in milliseconds. If maximum 小于 minimum , it will be set to the value of minimum .

注意: There are limits for the minimum and maximum interval; the exact values depend on the mode. If they are exceeded, the lowest or highest possible value will be used, respectively.

Setting the advertising interval is supported on BlueZ DBus backend if its experimental status is changed in later versions of BlueZ (or run in experimental mode).

void QLowEnergyAdvertisingParameters:: setMode ( QLowEnergyAdvertisingParameters::Mode mode )

Sets the advertising mode to mode .

另请参阅 mode ().

void QLowEnergyAdvertisingParameters:: setWhiteList (const QList < QLowEnergyAdvertisingParameters::AddressInfo > & whiteList , QLowEnergyAdvertisingParameters::FilterPolicy policy )

Sets the white list that is potentially used for filtering scan and connection requests. The whiteList parameter is the list of addresses to use for filtering, and policy specifies how exactly to use whiteList .

Whitelists are not supported on the BlueZ DBus backend as they are not supported by BlueZ.

另请参阅 whiteList ().

void QLowEnergyAdvertisingParameters:: swap ( QLowEnergyAdvertisingParameters & other )

Swaps this object with other .

QList < QLowEnergyAdvertisingParameters::AddressInfo > QLowEnergyAdvertisingParameters:: whiteList () const

Returns the white list used for filtering scan and connection requests. By default, this list is empty.

另请参阅 setWhiteList ().

QLowEnergyAdvertisingParameters &QLowEnergyAdvertisingParameters:: operator= (const QLowEnergyAdvertisingParameters & other )

Makes this object a copy of other and returns the new value of this object.

相关非成员

bool operator!= (const QLowEnergyAdvertisingParameters & a , const QLowEnergyAdvertisingParameters & b )

返回 true if a and b are not equal with respect to their public state, otherwise returns false .

bool operator== (const QLowEnergyAdvertisingParameters & a , const QLowEnergyAdvertisingParameters & b )

返回 true if a and b are equal with respect to their public state, otherwise returns false .