Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
QLowEnergyConnectionParameters Class Reference

The QLowEnergyConnectionParameters class is used when requesting or reporting an update of the parameters of a Bluetooth LE connection. More...

#include <qlowenergyconnectionparameters.h>

+ Collaboration diagram for QLowEnergyConnectionParameters:

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.
 
QLowEnergyConnectionParametersoperator= (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.
 

Detailed Description

The QLowEnergyConnectionParameters class is used when requesting or reporting an update of the parameters of a Bluetooth LE connection.

Since
5.7

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

  • minimumInterval()
  • Android priority \row
  • interval < 30
  • CONNECTION_PRIORITY_HIGH \row
  • 30 <= interval <= 100
  • CONNECTION_PRIORITY_BALANCED \row
  • interval > 100
  • CONNECTION_PRIORITY_LOW_POWER \endtable

The \l supervisionTimeout() cannot be changed on Android and is therefore ignored.

\inmodule QtBluetooth

See also
QLowEnergyController::requestConnectionUpdate
QLowEnergyController::connectionUpdated

Definition at line 15 of file qlowenergyconnectionparameters.h.

Constructor & Destructor Documentation

◆ QLowEnergyConnectionParameters() [1/2]

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() [2/2]

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::~QLowEnergyConnectionParameters ( )

Destroys this object.

Definition at line 86 of file qlowenergyconnectionparameters.cpp.

Member Function Documentation

◆ latency()

int QLowEnergyConnectionParameters::latency ( ) const

Returns the slave latency of the connection.

See also
setLatency()

Definition at line 149 of file qlowenergyconnectionparameters.cpp.

References QLowEnergyConnectionParametersPrivate::latency.

Referenced by setLatency().

+ Here is the caller graph for this function:

◆ maximumInterval()

double QLowEnergyConnectionParameters::maximumInterval ( ) const

Returns the maximum connection interval in milliseconds.

The default is 4000.

Note
If this object was emitted via \l QLowEnergyController::connectionUpdated(), then this value is the same as \l minimumInterval() and refers to the actual connection interval.
See also
setIntervalRange()

Definition at line 130 of file qlowenergyconnectionparameters.cpp.

References QLowEnergyConnectionParametersPrivate::maxInterval.

◆ minimumInterval()

double QLowEnergyConnectionParameters::minimumInterval ( ) const

Returns the minimum connection interval in milliseconds.

The default is 7.5.

Note
If this object was emitted via \l QLowEnergyController::connectionUpdated(), then this value is the same as \l maximumInterval() and refers to the actual connection interval.
See also
setIntervalRange()

Definition at line 118 of file qlowenergyconnectionparameters.cpp.

References QLowEnergyConnectionParametersPrivate::minInterval.

◆ operator=()

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().

+ Here is the call graph for this function:

◆ setIntervalRange()

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.

See also
minimumInterval(), maximumInterval()

Definition at line 105 of file qlowenergyconnectionparameters.cpp.

References QLowEnergyConnectionParametersPrivate::maxInterval, QLowEnergyConnectionParametersPrivate::minInterval, and qMax().

+ Here is the call graph for this function:

◆ setLatency()

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.

See also
latency()

Definition at line 140 of file qlowenergyconnectionparameters.cpp.

References QLowEnergyConnectionParametersPrivate::latency, and latency().

+ Here is the call graph for this function:

◆ setSupervisionTimeout()

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.

See also
supervisionTimeout()

Definition at line 163 of file qlowenergyconnectionparameters.cpp.

References QLowEnergyConnectionParametersPrivate::timeout.

◆ supervisionTimeout()

int QLowEnergyConnectionParameters::supervisionTimeout ( ) const

Returns the link supervision timeout of the connection in milliseconds.

See also
setSupervisionTimeout()

Definition at line 172 of file qlowenergyconnectionparameters.cpp.

References QLowEnergyConnectionParametersPrivate::timeout.

◆ swap()

void QLowEnergyConnectionParameters::swap ( QLowEnergyConnectionParameters & other)
inlinenoexcept

Swaps this object with other.

Definition at line 44 of file qlowenergyconnectionparameters.h.

References d, and other().

+ Here is the call graph for this function:

Friends And Related Symbol Documentation

◆ operator!=

bool QLowEnergyConnectionParameters::operator!= ( const QLowEnergyConnectionParameters & a,
const QLowEnergyConnectionParameters & b )
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.

◆ operator==

bool QLowEnergyConnectionParameters::operator== ( const QLowEnergyConnectionParameters & a,
const QLowEnergyConnectionParameters & b )
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.


The documentation for this class was generated from the following files: