![]() |
Qt 6.x
The Qt SDK
|
The QLowEnergyConnectionParameters class is used when requesting or reporting an update of the parameters of a Bluetooth LE connection. More...
#include <qlowenergyconnectionparameters.h>
Public Member Functions | |
QLowEnergyConnectionParameters () | |
Constructs a new object of this class. | |
QLowEnergyConnectionParameters (const QLowEnergyConnectionParameters &other) | |
Constructs a new object of this class that is a copy of other. | |
~QLowEnergyConnectionParameters () | |
Destroys this object. | |
QLowEnergyConnectionParameters & | operator= (const QLowEnergyConnectionParameters &other) |
Makes this object a copy of other and returns the new value of this object. | |
void | setIntervalRange (double minimum, double maximum) |
Sets the range in which the connection interval should be. | |
double | minimumInterval () const |
Returns the minimum connection interval in milliseconds. | |
double | maximumInterval () const |
Returns the maximum connection interval in milliseconds. | |
void | setLatency (int latency) |
Sets the slave latency of the connection (that is, the number of connection events that a slave device is allowed to ignore) to latency. | |
int | latency () const |
Returns the slave latency of the connection. | |
void | setSupervisionTimeout (int timeout) |
Sets the link supervision timeout to timeout milliseconds. | |
int | supervisionTimeout () const |
Returns the link supervision timeout of the connection in milliseconds. | |
void | swap (QLowEnergyConnectionParameters &other) noexcept |
Swaps this object with other. | |
Friends | |
bool | operator== (const QLowEnergyConnectionParameters &a, const QLowEnergyConnectionParameters &b) |
Returns true if p1 and p2 are equal with respect to their public state, otherwise returns false . | |
bool | operator!= (const QLowEnergyConnectionParameters &a, const QLowEnergyConnectionParameters &b) |
Returns true if p1 and p2 are not equal with respect to their public state, otherwise returns false . | |
The QLowEnergyConnectionParameters class is used when requesting or reporting an update of the parameters of a Bluetooth LE connection.
The connection parameters influence how often a master and a slave device synchronize with each other. In general, a lower connection interval and latency means faster communication, but also higher power consumption. How these criteria should be weighed against each other is highly dependent on the concrete use case.
Android only indirectly permits the adjustment of this parameter set. The platform separates the connection parameters into three categories (hight, low & balanced priority). Each category implies a predefined set of values for \l minimumInterval(), \l maximumInterval() and \l latency(). Additionally, the value ranges of each category can vary from one Android device to the next. Qt uses the \l minimumInterval() to determine the target category as follows:
\table \header
The \l supervisionTimeout() cannot be changed on Android and is therefore ignored.
\inmodule QtBluetooth
Definition at line 15 of file qlowenergyconnectionparameters.h.
QLowEnergyConnectionParameters::QLowEnergyConnectionParameters | ( | ) |
Constructs a new object of this class.
All values are initialized to valid defaults.
Definition at line 74 of file qlowenergyconnectionparameters.cpp.
QLowEnergyConnectionParameters::QLowEnergyConnectionParameters | ( | const QLowEnergyConnectionParameters & | other | ) |
Constructs a new object of this class that is a copy of other.
Definition at line 80 of file qlowenergyconnectionparameters.cpp.
QLowEnergyConnectionParameters::~QLowEnergyConnectionParameters | ( | ) |
Destroys this object.
Definition at line 86 of file qlowenergyconnectionparameters.cpp.
int QLowEnergyConnectionParameters::latency | ( | ) | const |
Returns the slave latency of the connection.
Definition at line 149 of file qlowenergyconnectionparameters.cpp.
References QLowEnergyConnectionParametersPrivate::latency.
Referenced by setLatency().
double QLowEnergyConnectionParameters::maximumInterval | ( | ) | const |
Returns the maximum connection interval in milliseconds.
The default is 4000.
Definition at line 130 of file qlowenergyconnectionparameters.cpp.
References QLowEnergyConnectionParametersPrivate::maxInterval.
double QLowEnergyConnectionParameters::minimumInterval | ( | ) | const |
Returns the minimum connection interval in milliseconds.
The default is 7.5.
Definition at line 118 of file qlowenergyconnectionparameters.cpp.
References QLowEnergyConnectionParametersPrivate::minInterval.
QLowEnergyConnectionParameters & QLowEnergyConnectionParameters::operator= | ( | const QLowEnergyConnectionParameters & | other | ) |
Makes this object a copy of other and returns the new value of this object.
Definition at line 91 of file qlowenergyconnectionparameters.cpp.
References other().
void QLowEnergyConnectionParameters::setIntervalRange | ( | double | minimum, |
double | maximum | ||
) |
Sets the range in which the connection interval should be.
The actual value will be decided by the controller. Both minimum and maximum are given in milliseconds. If maximum is smaller than minimum, it will be set to the value of minimum. The smallest possible connection interval is 7.5 milliseconds, the largest one is 4000 milliseconds.
Definition at line 105 of file qlowenergyconnectionparameters.cpp.
References QLowEnergyConnectionParametersPrivate::maxInterval, QLowEnergyConnectionParametersPrivate::minInterval, and qMax().
void QLowEnergyConnectionParameters::setLatency | ( | int | latency | ) |
Sets the slave latency of the connection (that is, the number of connection events that a slave device is allowed to ignore) to latency.
The minimum value is 0, the maximum is 499.
Definition at line 140 of file qlowenergyconnectionparameters.cpp.
References QLowEnergyConnectionParametersPrivate::latency, and latency().
void QLowEnergyConnectionParameters::setSupervisionTimeout | ( | int | timeout | ) |
Sets the link supervision timeout to timeout milliseconds.
There are several constraints on this value: It must be in the range [100,32000] and it must be larger than (1 + \l latency()) * 2 * \l maximumInterval().
On Android, this timeout is not adjustable and therefore ignored.
Definition at line 163 of file qlowenergyconnectionparameters.cpp.
References QLowEnergyConnectionParametersPrivate::timeout.
int QLowEnergyConnectionParameters::supervisionTimeout | ( | ) | const |
Returns the link supervision timeout of the connection in milliseconds.
Definition at line 172 of file qlowenergyconnectionparameters.cpp.
References QLowEnergyConnectionParametersPrivate::timeout.
|
inlinenoexcept |
Swaps this object with other.
Definition at line 44 of file qlowenergyconnectionparameters.h.
|
friend |
Returns true
if p1 and p2 are not equal with respect to their public state, otherwise returns false
.
Definition at line 28 of file qlowenergyconnectionparameters.h.
|
friend |
Returns true
if p1 and p2 are equal with respect to their public state, otherwise returns false
.
Definition at line 23 of file qlowenergyconnectionparameters.h.