QGroundControl
Ground Control Station for MAVLink Drones
Loading...
Searching...
No Matches
BluetoothConfiguration Class Reference

#include <BluetoothConfiguration.h>

+ Inheritance diagram for BluetoothConfiguration:
+ Collaboration diagram for BluetoothConfiguration:

Public Types

enum class  BluetoothMode { ModeClassic , ModeLowEnergy }
 
- Public Types inherited from LinkConfiguration
enum  LinkType {
  TypeSerial , TypeUdp , TypeTcp , TypeBluetooth ,
  TypeLogReplay , TypeLast
}
 

Signals

void modeChanged ()
 
void deviceChanged ()
 
void devicesModelChanged ()
 
void scanningChanged ()
 
void serviceUuidChanged ()
 
void readUuidChanged ()
 
void writeUuidChanged ()
 
void connectedRssiChanged ()
 
void selectedRssiChanged ()
 
void errorOccurred (const QString &errorString)
 
void adapterStateChanged ()
 
void pairingStatusChanged ()
 
- Signals inherited from LinkConfiguration
void nameChanged (const QString &name)
 
void linkChanged ()
 
void dynamicChanged ()
 
void autoConnectChanged ()
 
void highLatencyChanged ()
 

Public Member Functions

 BluetoothConfiguration (const QString &name, QObject *parent=nullptr)
 
 BluetoothConfiguration (const BluetoothConfiguration *copy, QObject *parent=nullptr)
 
 ~BluetoothConfiguration () override
 
Q_INVOKABLE void startScan ()
 
Q_INVOKABLE void stopScan ()
 
Q_INVOKABLE void setDevice (const QString &name)
 
Q_INVOKABLE void setDeviceByAddress (const QString &address)
 
Q_INVOKABLE void requestPairing (const QString &address)
 
Q_INVOKABLE void removePairing (const QString &address)
 
Q_INVOKABLE QString getPairingStatus (const QString &address) const
 
Q_INVOKABLE bool isPaired (const QString &address) const
 
Q_INVOKABLE bool isDiscoverable () const
 
Q_INVOKABLE bool isAdapterAvailable () const
 
Q_INVOKABLE QString getAdapterAddress () const
 
Q_INVOKABLE QString getAdapterName () const
 
Q_INVOKABLE bool isAdapterPoweredOn () const
 
Q_INVOKABLE QVariantList getAllPairedDevices () const
 
Q_INVOKABLE QVariantList getConnectedDevices () const
 
Q_INVOKABLE void powerOnAdapter ()
 
Q_INVOKABLE void powerOffAdapter ()
 
Q_INVOKABLE void setAdapterDiscoverable (bool discoverable)
 
Q_INVOKABLE QVariantList getAllAvailableAdapters ()
 
Q_INVOKABLE void selectAdapter (const QString &address)
 
Q_INVOKABLE QString getHostMode () const
 
LinkType type () const override
 
void copyFrom (const LinkConfiguration *source) override
 
void loadSettings (QSettings &settings, const QString &root) override
 
void saveSettings (QSettings &settings, const QString &root) const override
 
QString settingsURL () const override
 Settings URL, Pure virtual method providing the URL for the (QML) settings dialog.
 
QString settingsTitle () const override
 Settings Title, Pure virtual method providing the Title for the (QML) settings dialog.
 
BluetoothMode mode () const
 
void setMode (BluetoothMode mode)
 
const QBluetoothDeviceInfo & device () const
 
QString deviceName () const
 
QString address () const
 
QVariantList devicesModel () const
 
bool scanning () const
 
qint16 connectedRssi () const
 
void setConnectedRssi (qint16 rssi)
 
qint16 selectedRssi () const
 
QString serviceUuid () const
 
void setServiceUuid (const QString &uuid)
 
QString readUuid () const
 
void setReadUuid (const QString &uuid)
 
QString writeUuid () const
 
void setWriteUuid (const QString &uuid)
 
const QBluetoothUuid & readCharacteristicUuid () const
 
const QBluetoothUuid & writeCharacteristicUuid () const
 
- Public Member Functions inherited from LinkConfiguration
 LinkConfiguration (const QString &name, QObject *parent=nullptr)
 
 LinkConfiguration (const LinkConfiguration *copy, QObject *parent=nullptr)
 
virtual ~LinkConfiguration ()
 
QString name () const
 
void setName (const QString &name)
 
LinkInterfacelink () const
 
void setLink (const std::shared_ptr< LinkInterface > link)
 
bool isDynamic () const
 
void setDynamic (bool dynamic=true)
 Set if this is this a dynamic configuration. (decided at runtime)
 
bool isForwarding () const
 
void setForwarding (bool forwarding=true)
 Set if this is this a forwarding link configuration. (decided at runtime)
 
bool isAutoConnect () const
 
virtual void setAutoConnect (bool autoc=true)
 Set if this is this an Auto Connect configuration.
 
bool isHighLatency () const
 
void setHighLatency (bool hl=false)
 Set if this is this an High Latency configuration.
 

Static Public Member Functions

static bool isBluetoothAvailable ()
 
- Static Public Member Functions inherited from LinkConfiguration
static LinkConfigurationcreateSettings (int type, const QString &name)
 
static LinkConfigurationduplicateSettings (const LinkConfiguration *source)
 
static QString settingsRoot ()
 

Static Public Attributes

static const QBluetoothUuid NORDIC_UART_SERVICE {QStringLiteral("6e400001-b5a3-f393-e0a9-e50e24dcca9e")}
 
static const QBluetoothUuid NORDIC_UART_RX_CHAR {QStringLiteral("6e400003-b5a3-f393-e0a9-e50e24dcca9e")}
 
static const QBluetoothUuid NORDIC_UART_TX_CHAR {QStringLiteral("6e400002-b5a3-f393-e0a9-e50e24dcca9e")}
 
static const QBluetoothUuid TI_SENSORTAG_SERVICE {QStringLiteral("0000ffe0-0000-1000-8000-00805f9b34fb")}
 
static const QBluetoothUuid TI_SENSORTAG_CHAR {QStringLiteral("0000ffe1-0000-1000-8000-00805f9b34fb")}
 

Additional Inherited Members

- Protected Attributes inherited from LinkConfiguration
std::weak_ptr< LinkInterface_link
 Link currently using this configuration (if any)
 

Detailed Description

Definition at line 19 of file BluetoothConfiguration.h.

Member Enumeration Documentation

◆ BluetoothMode

Enumerator
ModeClassic 
ModeLowEnergy 

Definition at line 46 of file BluetoothConfiguration.h.

Constructor & Destructor Documentation

◆ BluetoothConfiguration() [1/2]

BluetoothConfiguration::BluetoothConfiguration ( const QString &  name,
QObject *  parent = nullptr 
)
explicit

Definition at line 19 of file BluetoothConfiguration.cc.

◆ BluetoothConfiguration() [2/2]

BluetoothConfiguration::BluetoothConfiguration ( const BluetoothConfiguration copy,
QObject *  parent = nullptr 
)
explicit

Definition at line 25 of file BluetoothConfiguration.cc.

◆ ~BluetoothConfiguration()

BluetoothConfiguration::~BluetoothConfiguration ( )
override

Definition at line 37 of file BluetoothConfiguration.cc.

References stopScan().

Member Function Documentation

◆ adapterStateChanged

void BluetoothConfiguration::adapterStateChanged ( )
signal

Referenced by powerOnAdapter(), and selectAdapter().

◆ address()

QString BluetoothConfiguration::address ( ) const
inline

◆ connectedRssi()

qint16 BluetoothConfiguration::connectedRssi ( ) const
inline

Definition at line 93 of file BluetoothConfiguration.h.

Referenced by copyFrom().

◆ connectedRssiChanged

void BluetoothConfiguration::connectedRssiChanged ( )
signal

Referenced by copyFrom(), and setConnectedRssi().

◆ copyFrom()

void BluetoothConfiguration::copyFrom ( const LinkConfiguration source)
overridevirtual

Copy instance data, When manipulating data, you create a copy of the configuration using the copy constructor, edit it and then transfer its content to the original using this method.

Parameters
[in]sourceThe source instance (the edited copy)

Reimplemented from LinkConfiguration.

Definition at line 281 of file BluetoothConfiguration.cc.

References connectedRssi(), connectedRssiChanged(), LinkConfiguration::copyFrom(), device(), deviceChanged(), mode(), modeChanged(), readCharacteristicUuid(), readUuidChanged(), serviceUuidChanged(), writeCharacteristicUuid(), and writeUuidChanged().

◆ device()

const QBluetoothDeviceInfo & BluetoothConfiguration::device ( ) const
inline

Definition at line 88 of file BluetoothConfiguration.h.

Referenced by copyFrom(), getAllPairedDevices(), and getConnectedDevices().

◆ deviceChanged

void BluetoothConfiguration::deviceChanged ( )
signal

Referenced by copyFrom().

◆ deviceName()

QString BluetoothConfiguration::deviceName ( ) const
inline

Definition at line 89 of file BluetoothConfiguration.h.

Referenced by getConnectedDevices(), and loadSettings().

◆ devicesModel()

QVariantList BluetoothConfiguration::devicesModel ( ) const

Definition at line 369 of file BluetoothConfiguration.cc.

◆ devicesModelChanged

void BluetoothConfiguration::devicesModelChanged ( )
signal

◆ errorOccurred

◆ getAdapterAddress()

QString BluetoothConfiguration::getAdapterAddress ( ) const

Definition at line 916 of file BluetoothConfiguration.cc.

◆ getAdapterName()

QString BluetoothConfiguration::getAdapterName ( ) const

Definition at line 924 of file BluetoothConfiguration.cc.

◆ getAllAvailableAdapters()

QVariantList BluetoothConfiguration::getAllAvailableAdapters ( )

Definition at line 1104 of file BluetoothConfiguration.cc.

◆ getAllPairedDevices()

QVariantList BluetoothConfiguration::getAllPairedDevices ( ) const

Definition at line 940 of file BluetoothConfiguration.cc.

References device().

◆ getConnectedDevices()

QVariantList BluetoothConfiguration::getConnectedDevices ( ) const

Definition at line 977 of file BluetoothConfiguration.cc.

References device(), and deviceName().

◆ getHostMode()

QString BluetoothConfiguration::getHostMode ( ) const

Definition at line 1175 of file BluetoothConfiguration.cc.

◆ getPairingStatus()

QString BluetoothConfiguration::getPairingStatus ( const QString &  address) const

Definition at line 858 of file BluetoothConfiguration.cc.

References address(), and ModeClassic.

◆ isAdapterAvailable()

bool BluetoothConfiguration::isAdapterAvailable ( ) const

Definition at line 911 of file BluetoothConfiguration.cc.

◆ isAdapterPoweredOn()

bool BluetoothConfiguration::isAdapterPoweredOn ( ) const

Definition at line 932 of file BluetoothConfiguration.cc.

◆ isBluetoothAvailable()

bool BluetoothConfiguration::isBluetoothAvailable ( )
static

Definition at line 364 of file BluetoothConfiguration.cc.

References QGCNetworkHelper::isBluetoothAvailable().

Referenced by settingsTitle().

◆ isDiscoverable()

bool BluetoothConfiguration::isDiscoverable ( ) const

Definition at line 901 of file BluetoothConfiguration.cc.

References mode().

◆ isPaired()

bool BluetoothConfiguration::isPaired ( const QString &  address) const

Definition at line 886 of file BluetoothConfiguration.cc.

References address(), and ModeClassic.

◆ loadSettings()

void BluetoothConfiguration::loadSettings ( QSettings &  settings,
const QString &  root 
)
overridevirtual

Load settings, Pure virtual method telling the instance to load its configuration.

Parameters
[in]settingsThe QSettings instance to use
[in]rootThe root path of the setting.

Implements LinkConfiguration.

Definition at line 322 of file BluetoothConfiguration.cc.

References address(), deviceName(), and ModeClassic.

◆ mode()

BluetoothMode BluetoothConfiguration::mode ( ) const
inline

◆ modeChanged

void BluetoothConfiguration::modeChanged ( )
signal

Referenced by copyFrom(), and setMode().

◆ pairingStatusChanged

void BluetoothConfiguration::pairingStatusChanged ( )
signal

◆ powerOffAdapter()

void BluetoothConfiguration::powerOffAdapter ( )

Definition at line 1063 of file BluetoothConfiguration.cc.

References errorOccurred(), scanning(), and stopScan().

◆ powerOnAdapter()

void BluetoothConfiguration::powerOnAdapter ( )

Definition at line 1010 of file BluetoothConfiguration.cc.

References adapterStateChanged(), and errorOccurred().

◆ readCharacteristicUuid()

const QBluetoothUuid & BluetoothConfiguration::readCharacteristicUuid ( ) const
inline

Definition at line 105 of file BluetoothConfiguration.h.

Referenced by copyFrom().

◆ readUuid()

QString BluetoothConfiguration::readUuid ( ) const
inline

Definition at line 100 of file BluetoothConfiguration.h.

◆ readUuidChanged

void BluetoothConfiguration::readUuidChanged ( )
signal

Referenced by copyFrom(), and setReadUuid().

◆ removePairing()

void BluetoothConfiguration::removePairing ( const QString &  address)

Definition at line 836 of file BluetoothConfiguration.cc.

References address(), errorOccurred(), and ModeClassic.

◆ requestPairing()

void BluetoothConfiguration::requestPairing ( const QString &  address)

Definition at line 814 of file BluetoothConfiguration.cc.

References address(), errorOccurred(), and ModeClassic.

◆ saveSettings()

void BluetoothConfiguration::saveSettings ( QSettings &  settings,
const QString &  root 
) const
overridevirtual

Save settings, Pure virtual method telling the instance to save its configuration.

Parameters
[in]settingsThe QSettings instance to use
[in]rootThe root path of the setting.

Implements LinkConfiguration.

Definition at line 342 of file BluetoothConfiguration.cc.

◆ scanning()

bool BluetoothConfiguration::scanning ( ) const

Definition at line 555 of file BluetoothConfiguration.cc.

Referenced by powerOffAdapter(), selectAdapter(), and stopScan().

◆ scanningChanged

void BluetoothConfiguration::scanningChanged ( )
signal

Referenced by startScan().

◆ selectAdapter()

void BluetoothConfiguration::selectAdapter ( const QString &  address)

◆ selectedRssi()

qint16 BluetoothConfiguration::selectedRssi ( ) const

Definition at line 383 of file BluetoothConfiguration.cc.

◆ selectedRssiChanged

void BluetoothConfiguration::selectedRssiChanged ( )
signal

Referenced by setConnectedRssi().

◆ serviceUuid()

QString BluetoothConfiguration::serviceUuid ( ) const
inline

Definition at line 98 of file BluetoothConfiguration.h.

◆ serviceUuidChanged

void BluetoothConfiguration::serviceUuidChanged ( )
signal

Referenced by copyFrom(), and setServiceUuid().

◆ setAdapterDiscoverable()

void BluetoothConfiguration::setAdapterDiscoverable ( bool  discoverable)

Definition at line 1082 of file BluetoothConfiguration.cc.

References errorOccurred().

◆ setConnectedRssi()

void BluetoothConfiguration::setConnectedRssi ( qint16  rssi)

Definition at line 374 of file BluetoothConfiguration.cc.

References connectedRssiChanged(), and selectedRssiChanged().

◆ setDevice()

void BluetoothConfiguration::setDevice ( const QString &  name)

Definition at line 485 of file BluetoothConfiguration.cc.

References LinkConfiguration::name(), and stopScan().

◆ setDeviceByAddress()

void BluetoothConfiguration::setDeviceByAddress ( const QString &  address)

Definition at line 496 of file BluetoothConfiguration.cc.

References address(), and stopScan().

◆ setMode()

void BluetoothConfiguration::setMode ( BluetoothMode  mode)

Definition at line 269 of file BluetoothConfiguration.cc.

References mode(), modeChanged(), and stopScan().

◆ setReadUuid()

void BluetoothConfiguration::setReadUuid ( const QString &  uuid)

Definition at line 409 of file BluetoothConfiguration.cc.

References errorOccurred(), and readUuidChanged().

◆ setServiceUuid()

void BluetoothConfiguration::setServiceUuid ( const QString &  uuid)

Definition at line 396 of file BluetoothConfiguration.cc.

References errorOccurred(), and serviceUuidChanged().

◆ settingsTitle()

QString BluetoothConfiguration::settingsTitle ( ) const
overridevirtual

Settings Title, Pure virtual method providing the Title for the (QML) settings dialog.

Implements LinkConfiguration.

Definition at line 356 of file BluetoothConfiguration.cc.

References isBluetoothAvailable(), and ModeLowEnergy.

◆ settingsURL()

QString BluetoothConfiguration::settingsURL ( ) const
inlineoverridevirtual

Settings URL, Pure virtual method providing the URL for the (QML) settings dialog.

Implements LinkConfiguration.

Definition at line 82 of file BluetoothConfiguration.h.

◆ setWriteUuid()

void BluetoothConfiguration::setWriteUuid ( const QString &  uuid)

Definition at line 422 of file BluetoothConfiguration.cc.

References errorOccurred(), and writeUuidChanged().

◆ startScan()

void BluetoothConfiguration::startScan ( )

Definition at line 435 of file BluetoothConfiguration.cc.

References errorOccurred(), ModeLowEnergy, and scanningChanged().

◆ stopScan()

void BluetoothConfiguration::stopScan ( )

◆ type()

LinkType BluetoothConfiguration::type ( ) const
inlineoverridevirtual

Connection type, pure virtual method returning one of the -TypeXxx types above.

Returns
The type of links these settings belong to.

Implements LinkConfiguration.

Definition at line 78 of file BluetoothConfiguration.h.

References LinkConfiguration::TypeBluetooth.

◆ writeCharacteristicUuid()

const QBluetoothUuid & BluetoothConfiguration::writeCharacteristicUuid ( ) const
inline

Definition at line 106 of file BluetoothConfiguration.h.

Referenced by copyFrom().

◆ writeUuid()

QString BluetoothConfiguration::writeUuid ( ) const
inline

Definition at line 102 of file BluetoothConfiguration.h.

◆ writeUuidChanged

void BluetoothConfiguration::writeUuidChanged ( )
signal

Referenced by copyFrom(), and setWriteUuid().

Member Data Documentation

◆ NORDIC_UART_RX_CHAR

const QBluetoothUuid BluetoothConfiguration::NORDIC_UART_RX_CHAR {QStringLiteral("6e400003-b5a3-f393-e0a9-e50e24dcca9e")}
inlinestatic

Definition at line 112 of file BluetoothConfiguration.h.

◆ NORDIC_UART_SERVICE

const QBluetoothUuid BluetoothConfiguration::NORDIC_UART_SERVICE {QStringLiteral("6e400001-b5a3-f393-e0a9-e50e24dcca9e")}
inlinestatic

Definition at line 111 of file BluetoothConfiguration.h.

◆ NORDIC_UART_TX_CHAR

const QBluetoothUuid BluetoothConfiguration::NORDIC_UART_TX_CHAR {QStringLiteral("6e400002-b5a3-f393-e0a9-e50e24dcca9e")}
inlinestatic

Definition at line 113 of file BluetoothConfiguration.h.

◆ TI_SENSORTAG_CHAR

const QBluetoothUuid BluetoothConfiguration::TI_SENSORTAG_CHAR {QStringLiteral("0000ffe1-0000-1000-8000-00805f9b34fb")}
inlinestatic

Definition at line 115 of file BluetoothConfiguration.h.

◆ TI_SENSORTAG_SERVICE

const QBluetoothUuid BluetoothConfiguration::TI_SENSORTAG_SERVICE {QStringLiteral("0000ffe0-0000-1000-8000-00805f9b34fb")}
inlinestatic

Definition at line 114 of file BluetoothConfiguration.h.


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