added some documentation

This commit is contained in:
Dorian Zedler 2020-10-09 12:06:33 +02:00
parent 049951ebed
commit 7e7a8612c0
Signed by: dorian
GPG key ID: D3B255CB8BC7CD37
6 changed files with 2836 additions and 132 deletions

4
docs/.gitignore vendored Normal file
View file

@ -0,0 +1,4 @@
/html/
/latex/
/xml/
/m.css/

2494
docs/Doxyfile Normal file

File diff suppressed because it is too large Load diff

18
docs/Doxyfile-mcss Normal file
View file

@ -0,0 +1,18 @@
@INCLUDE = Doxyfile
GENERATE_HTML = NO
GENERATE_XML = YES
XML_PROGRAMLISTING = NO
SHOW_INCLUDE_FILES = YES
HTML_EXTRA_STYLESHEET = \
https://fonts.googleapis.com/css?family=Source+Sans+Pro:400,400i,600,600i%7CSource+Code+Pro:400,400i,600 \
../css/m-dark+documentation.compiled.css
M_THEME_COLOR = #0094ff
#M_FAVICON = favicon.png
# navbar
M_LINKS_NAVBAR1 =
M_LINKS_NAVBAR2 = "<a href=\"index.html\">Introduction</a>" \
annotated \
"<a href=\"ScStwSharedLibraries.pdf\">Download</a>"

View file

@ -10,11 +10,9 @@ QBluetoothLeUart::QBluetoothLeUart(QObject *parent) : QObject(parent)
this->setUUIDs("6e400001-b5a3-f393-e0a9-e50e24dcca9e", "6e400002-b5a3-f393-e0a9-e50e24dcca9e", "6e400003-b5a3-f393-e0a9-e50e24dcca9e");
/* 1 Step: Bluetooth LE Device Discovery */
// init device discovery agent for scanning
this->bluetoothDeviceDiscoveryAgent = new QBluetoothDeviceDiscoveryAgent(this);
/* Device Discovery Initialization */
connect(this->bluetoothDeviceDiscoveryAgent, &QBluetoothDeviceDiscoveryAgent::deviceDiscovered, this, &QBluetoothLeUart::handleDeviceDiscovered);
connect(bluetoothDeviceDiscoveryAgent, SIGNAL(error(QBluetoothDeviceDiscoveryAgent::Error)),
this, SLOT(handleDeviceScanError(QBluetoothDeviceDiscoveryAgent::Error)));
@ -25,60 +23,39 @@ QBluetoothLeUart::~QBluetoothLeUart(){
}
void QBluetoothLeUart::init() {
#ifdef QBluetoothLeUart_QML
qmlRegisterUncreatableType<QBluetoothLeUartDevice>("de.itsblue.bluetoothleuart", 1, 0, "QBluetoothDeviceInfo", "BluetoothDeviceInfo cannot be created");
qmlRegisterType<QBluetoothLeUart>("de.itsblue.bluetoothleuart", 1, 0, "QBluetoothLeUART");
qRegisterMetaType<QBluetoothLeUart::BluetoothLeUartState>("QBluetoothLeUart::BluetoothLeUartState");
qRegisterMetaType<QBluetoothLeUart::BluetoothScanError>("QBluetoothLeUart::BluetoothScanError");
#endif
}
// ------------------------------
// - Slots for QBluetoothLeUart -
// ------------------------------
void QBluetoothLeUart::startScanningForDevices(){
bool QBluetoothLeUart::startScanningForDevices(){
if(this->state != Idle)
return false;
foreach(QBluetoothLeUartDevice* oldDevice, this->availableDevices)
oldDevice->deleteLater();
this->availableDevices.clear();
setState(Scanning);
bluetoothDeviceDiscoveryAgent->start();
this->setState(Scanning);
this->bluetoothDeviceDiscoveryAgent->start();
qDebug()<< "Searching for low energy devices..." ;
return true;
}
void QBluetoothLeUart::stopScanningForDevices() {
bool QBluetoothLeUart::stopScanningForDevices() {
if(this->state != Scanning)
return false;
this->bluetoothDeviceDiscoveryAgent->stop();
this->setState(ScanFinished);
}
void QBluetoothLeUart::handleDeviceDiscovered(const QBluetoothDeviceInfo &device)
{
// Is it a BLE device?
if (device.coreConfigurations() & QBluetoothDeviceInfo::LowEnergyCoreConfiguration) {
//qWarning() << "Discovered BLE Device: name: " << device.name() << " Address: " << device.address().toString();
QBluetoothLeUartDevice *dev = new QBluetoothLeUartDevice(device, this);
availableDevices.append(dev);
emit this->foundNewDevice(dev);
emit this->avaliableDevicesChanged(this->availableDevices);
}
}
void QBluetoothLeUart::handleScanFinished()
{
if (availableDevices.size() == 0)
{
qWarning() << "No Low Energy devices found" << endl;
}
setState(ScanFinished);
return true;
}
QList<QBluetoothLeUartDevice*> QBluetoothLeUart::getAvailableDevices() {
return this->availableDevices;
}
QVariantList QBluetoothLeUart::getAvailableDevicesQML() {
QVariantList QBluetoothLeUart::getAvailableDevicesDetailList() {
QVariantList result;
for(int i=0; i < this->availableDevices.length(); i++) {
@ -97,28 +74,17 @@ QVariantList QBluetoothLeUart::getAvailableDevicesQML() {
return result;
}
void QBluetoothLeUart::handleDeviceScanError(QBluetoothDeviceDiscoveryAgent::Error error)
{
if (error == QBluetoothDeviceDiscoveryAgent::PoweredOffError)
emit this->scanningErrorOccured(AdapterTurnedOffError);
else if (error == QBluetoothDeviceDiscoveryAgent::InputOutputError)
emit this->scanningErrorOccured(InputOutputError);
else
emit this->scanningErrorOccured(UnknownError);
}
void QBluetoothLeUart::connectToDevice(int deviceId) {
bool QBluetoothLeUart::connectToDevice(int deviceId) {
if(deviceId < 0 || deviceId >= this->availableDevices.length())
return;
return false;
this->connectToDevice(this->availableDevices[deviceId]);
return true;
}
void QBluetoothLeUart::connectToDevice(QBluetoothLeUartDevice *device){
m_qvMeasurements.clear();
bool QBluetoothLeUart::connectToDevice(QBluetoothLeUartDevice *device){
if(!this->availableDevices.contains(device))
return false;
this->currentBluetoothDevice = device;
@ -128,7 +94,7 @@ void QBluetoothLeUart::connectToDevice(QBluetoothLeUartDevice *device){
bluetoothController = 0;
}
/* 2 Step: QLowEnergyController */
// initialize QLowEnergyController
bluetoothController = new QLowEnergyController(currentBluetoothDevice->getDevice(), this);
bluetoothController ->setRemoteAddressType(QLowEnergyController::RandomAddress);
@ -142,9 +108,14 @@ void QBluetoothLeUart::connectToDevice(QBluetoothLeUartDevice *device){
/* Start connecting to device */
bluetoothController->connectToDevice();
setState(Connecting);
return true;
}
void QBluetoothLeUart::disconnectFromDevice() {
bool QBluetoothLeUart::disconnectFromDevice() {
if(this->state < ScanningForService)
return false;
this->bluetoothController->disconnectFromDevice();
disconnect(this->bluetoothController, &QLowEnergyController::serviceDiscovered, this, &QBluetoothLeUart::handleServiceDiscovered);
@ -155,33 +126,74 @@ void QBluetoothLeUart::disconnectFromDevice() {
disconnect(this->bluetoothController, &QLowEnergyController::disconnected, this, &QBluetoothLeUart::handleDeviceDisconnected);
this->bluetoothController->deleteLater();
this->bluetoothController = nullptr;
this->bluetoothService->deleteLater();
this->bluetoothService = nullptr;
return true;
}
void QBluetoothLeUart::handleDeviceDisconnected()
bool QBluetoothLeUart::sendData(QString data){
if(this->state != Connected)
return false;
const QLowEnergyCharacteristic RxChar = bluetoothService->characteristic(QBluetoothUuid(QUuid(this->txUUID)));
QByteArray Data;
Data.append(data);
bluetoothService->writeCharacteristic(RxChar, Data,QLowEnergyService::WriteWithoutResponse);
return true;
}
// -------------------------------------------
// - Slots for QBluetothDeviceDiscoveryAgent -
// -------------------------------------------
void QBluetoothLeUart::handleDeviceDiscovered(const QBluetoothDeviceInfo &device)
{
this->setState(Idle);
qDebug() << "UART service disconnected";
qWarning() << "Remote device disconnected";
// Is it a BLE device?
if (device.coreConfigurations() & QBluetoothDeviceInfo::LowEnergyCoreConfiguration) {
//qWarning() << "Discovered BLE Device: name: " << device.name() << " Address: " << device.address().toString();
QBluetoothLeUartDevice *dev = new QBluetoothLeUartDevice(device, this);
availableDevices.append(dev);
emit this->foundNewDevice(dev);
emit this->avaliableDevicesChanged(this->availableDevices);
}
}
void QBluetoothLeUart::handleDeviceConnected()
void QBluetoothLeUart::handleScanFinished()
{
qDebug() << "Device connected";
bluetoothController->discoverServices();
setState(Connected);
}
void QBluetoothLeUart::handleControllerError(QLowEnergyController::Error error)
if (this->availableDevices.size() == 0)
{
qDebug() << "Cannot connect to remote device.";
qWarning() << "Controller Error:" << error;
qWarning() << "No Low Energy devices found" << endl;
}
void QBluetoothLeUart::handleServiceDiscovered(const QBluetoothUuid &gatt){
emit this->scanFinished(this->availableDevices);
qDebug() << "Found service with ID: " << gatt;
setState(ScanFinished);
}
if(gatt==QBluetoothUuid(QUuid(this->uartServiceUUID))){
void QBluetoothLeUart::handleDeviceScanError(QBluetoothDeviceDiscoveryAgent::Error error)
{
if (error == QBluetoothDeviceDiscoveryAgent::PoweredOffError)
emit this->scanningErrorOccured(AdapterTurnedOffError);
else if (error == QBluetoothDeviceDiscoveryAgent::InputOutputError)
emit this->scanningErrorOccured(InputOutputError);
else
emit this->scanningErrorOccured(UnknownError);
}
// ----------------------------------
// - Slots for QLowEnergyController -
// ----------------------------------
void QBluetoothLeUart::handleServiceDiscovered(const QBluetoothUuid &uuid){
qDebug() << "Found service with ID: " << uuid;
if(uuid == QBluetoothUuid(QUuid(this->uartServiceUUID))){
foundValidUARTService =true;
qDebug() << "UART service found!";
}
@ -212,7 +224,30 @@ void QBluetoothLeUart::handleServiceScanDone(){
setState(ServiceFound);
}
/* Slots for QLowEnergyService */
void QBluetoothLeUart::handleControllerError(QLowEnergyController::Error error)
{
qDebug() << "Cannot connect to remote device.";
qWarning() << "Controller Error:" << error;
}
void QBluetoothLeUart::handleDeviceConnected()
{
qDebug() << "Device connected";
bluetoothController->discoverServices();
setState(ScanningForService);
}
void QBluetoothLeUart::handleDeviceDisconnected()
{
this->setState(Idle);
qDebug() << "UART service disconnected";
qWarning() << "Remote device disconnected";
}
// -------------------------------
// - Slots for QLowEnergyService -
// -------------------------------
void QBluetoothLeUart::handleServiceStateChange(QLowEnergyService::ServiceState s)
{
@ -221,18 +256,18 @@ void QBluetoothLeUart::handleServiceStateChange(QLowEnergyService::ServiceState
case QLowEnergyService::ServiceDiscovered:
{
//looking for the TX characteristic
const QLowEnergyCharacteristic TxChar = bluetoothService->characteristic(QBluetoothUuid(QUuid(this->txUUID)));
//looking for the RX characteristic
const QLowEnergyCharacteristic TxChar = bluetoothService->characteristic(QBluetoothUuid(QUuid(this->rxUUID)));
if (!TxChar.isValid()){
qDebug() << "Tx characteristic not found";
qDebug() << "Rx characteristic not found";
this->disconnectFromDevice();
return;
}
//looking for the RX characteristic
const QLowEnergyCharacteristic RxChar = bluetoothService->characteristic(QBluetoothUuid(QUuid(this->rxUUID)));
//looking for the TX characteristic
const QLowEnergyCharacteristic RxChar = bluetoothService->characteristic(QBluetoothUuid(QUuid(this->txUUID)));
if (!RxChar.isValid()) {
qDebug() << "Rx characteristic not found";
qDebug() << "Tx characteristic not found";
this->disconnectFromDevice();
return;
}
@ -246,7 +281,7 @@ void QBluetoothLeUart::handleServiceStateChange(QLowEnergyService::ServiceState
if (m_notificationDescTx.isValid()) {
// enable notification
bluetoothService->writeDescriptor(m_notificationDescTx, QByteArray::fromHex("0100"));
setState(AcquireData);
setState(Connected);
emit this->connectedToDevice();
}
@ -261,7 +296,7 @@ void QBluetoothLeUart::handleServiceStateChange(QLowEnergyService::ServiceState
void QBluetoothLeUart::handleServiceCharacteristicChange(const QLowEnergyCharacteristic &c,const QByteArray &value)
{
// ignore any other characteristic change
if (c.uuid() != QBluetoothUuid(QUuid(this->txUUID)))
if (c.uuid() != QBluetoothUuid(QUuid(this->rxUUID)))
return;
emit dataReceived((QString) value);
@ -272,26 +307,23 @@ void QBluetoothLeUart::handleServiceDescriptorWritten(const QLowEnergyDescriptor
{
if (d.isValid() && d == bluetoothTransmissionDescriptor && value == QByteArray("0000")) {
//disabled notifications -> assume disconnect intent
bluetoothController->disconnectFromDevice();
delete bluetoothService;
bluetoothService = 0;
this->disconnectFromDevice();
}
}
// --------------------
// - Helper functions -
// --------------------
void QBluetoothLeUart::sendData(QString s){
const QLowEnergyCharacteristic RxChar = bluetoothService->characteristic(QBluetoothUuid(QUuid(this->rxUUID)));
qDebug()<< s;
QByteArray Data;
Data.append(s);
bluetoothService->writeCharacteristic(RxChar, Data,QLowEnergyService::WriteWithoutResponse);
void QBluetoothLeUart::init() {
#ifdef QBluetoothLeUart_QML
qmlRegisterUncreatableType<QBluetoothLeUartDevice>("de.itsblue.bluetoothleuart", 1, 0, "QBluetoothLeUartDevice", "BluetoothDeviceInfo cannot be created");
qmlRegisterType<QBluetoothLeUart>("de.itsblue.bluetoothleuart", 1, 0, "QBluetoothLeUart");
qRegisterMetaType<QBluetoothLeUart::BluetoothLeUartState>("QBluetoothLeUart::BluetoothLeUartState");
qRegisterMetaType<QBluetoothLeUart::BluetoothScanError>("QBluetoothLeUart::BluetoothScanError");
#endif
}
void QBluetoothLeUart::setState(QBluetoothLeUart::BluetoothLeUartState newState)
{
if (state == newState)
@ -305,8 +337,8 @@ QBluetoothLeUart::BluetoothLeUartState QBluetoothLeUart::getState() const {
return state;
}
void QBluetoothLeUart::setUUIDs(const char uartServiceUUID[36], const char rxUUID[36], const char txUUID[36]) {
void QBluetoothLeUart::setUUIDs(const char uartServiceUUID[36], const char txUUID[36], const char rxUUID[36]) {
this->uartServiceUUID = uartServiceUUID;
this->rxUUID = rxUUID;
this->txUUID = txUUID;
this->rxUUID = rxUUID;
}

View file

@ -12,21 +12,52 @@
#include <qbluetoothleuartdevice.h>
/*!
* \mainpage Qt BluetoothLE UART library
*
* \section intro_sec Introduction
*
* This library can be used to talk to BLE devices via UART in Qt.
* It was designed to make taklking to device like the ESP32 from Qt easier.
*
* \section section Installation
* \code{.sh}
* cd yourRepo
* git submodule add https://itsblue.dev/itsblue-development/QBluetoothLeUart.git
* git submodule update --init --recursive
* \endcode
*
* And in your MyProject.pro include the .pri file:
* \code{.pro}
* # Optional: enable QML stuff
* CONFIG += QBluetoothLeUart_QML
* # Include library
* include($$PWD/QBluetoothLeUart/QBluetoothLeUart.pri)
* \endcode
*/
/*!
* \brief The QBluetoothLeUart class can be used to talk to BluetoothLE devices via UART effordlessly.
* It can be used via C++ and QML.
*/
class QBluetoothLeUart : public QObject
{
Q_OBJECT
Q_PROPERTY(QVariantList avaliableDevices READ getAvailableDevicesQML NOTIFY avaliableDevicesChanged)
Q_PROPERTY(QVariantList avaliableDevices READ getAvailableDevicesDetailList NOTIFY avaliableDevicesChanged)
Q_PROPERTY(BluetoothLeUartState state READ getState NOTIFY stateChanged)
public:
/*!
* \brief The BluetoothLeUartState enum contains all state of the QBluetoothLeUart class.
*/
enum BluetoothLeUartState {
Idle = 0,
Scanning,
ScanFinished,
Connecting,
Connected,
ServiceFound,
AcquireData
Idle = 0, /*!< Waiting for instrucions */
Scanning, /*!< Scanning for devices */
ScanFinished, /*!< Scanning has finished, we are ready to connect */
Connecting, /*!< Trying to connect */
ScanningForService, /*!< Connection was successfull, now scanning for services */
ServiceFound, /*!< Services were found */
Connected /*!< Connected. We are now ready to send and receive */
};
Q_ENUM(BluetoothLeUartState)
@ -40,71 +71,183 @@ public:
QBluetoothLeUart(QObject *parent = nullptr);
~QBluetoothLeUart();
/*!
* \brief Function to register QMl types
*/
static void init();
void setUUIDs(const char uartServiceUUID[36], const char rxUUID[36], const char txUUID[36]);
/*!
* \brief Function to set the UUIDs of the bluetooth service
* \param uartServiceUUID Service UUID
* \param txUUID UUID of the characteristic used to send data
* \param rxUUID UUID of the characteristic used to receive data
*/
void setUUIDs(const char uartServiceUUID[36], const char txUUID[36], const char rxUUID[36]);
private:
QString uartServiceUUID;
QString rxUUID;
QString txUUID;
QBluetoothLeUartDevice *currentBluetoothDevice;
// The UUIDs
QString uartServiceUUID;
QString txUUID;
QString rxUUID;
// current state
QBluetoothLeUart::BluetoothLeUartState state;
// QBluetooth controllers
QBluetoothDeviceDiscoveryAgent *bluetoothDeviceDiscoveryAgent;
//QList<QObject*> m_qlDevices;
QList<QBluetoothLeUartDevice*> availableDevices;
//QList<QString> m_qlFoundDevices;
QVector<quint16> m_qvMeasurements;
QLowEnergyController *bluetoothController;
QLowEnergyService *bluetoothService;
// Bluetooth device
QBluetoothLeUartDevice *currentBluetoothDevice;
QList<QBluetoothLeUartDevice*> availableDevices;
QLowEnergyDescriptor bluetoothTransmissionDescriptor;
bool foundValidUARTService;
QBluetoothLeUart::BluetoothLeUartState state;
public slots:
/* Slots for user */
Q_INVOKABLE QBluetoothLeUart::BluetoothLeUartState getState() const;
/*!
* \brief Fuction to start scanning for devices
*
* This function will start the device scanning process and might emit
* the following signals during scanning:
* - foundNewDevice() when a new device is found
* - avaliableDevicesChanged() when a new device is found
* - scanFinished() when the scan has finished
* - scanningErrorOccured() when an error occured
*
* \see foundNewDevice()
* \see avaliableDevicesChanged()
* \see scanFinished()
* \see scanningErrorOccured()
*
* \return true if the scan started, false if the current state was not Idle
*/
Q_INVOKABLE bool startScanningForDevices();
Q_INVOKABLE void startScanningForDevices();
Q_INVOKABLE void stopScanningForDevices();
/*!
* \brief Function to stop scanning for devices
*
* \return true if the scan was stopped, false if the current state was not Scanning
*/
Q_INVOKABLE bool stopScanningForDevices();
/*!
* \brief Function to get all devices that were found during the last scan
*
* A QBluetoothLeUartDevice object can be used to connect to the specific device
*
* \see connectToDevice()
*
* \return List of all devices found during last scan
*/
Q_INVOKABLE QList<QBluetoothLeUartDevice*> getAvailableDevices();
Q_INVOKABLE QVariantList getAvailableDevicesQML();
Q_INVOKABLE void connectToDevice(QBluetoothLeUartDevice *device);
Q_INVOKABLE void connectToDevice(int deviceId);
Q_INVOKABLE void sendData(QString s);
Q_INVOKABLE void disconnectFromDevice();
/*!
* \brief Function to get a variant list of all devices that were found during the last scan
*
* This will return a QVariantList that contains QVariantMaps.
* The maps contain the following keys:
* - "id" (int): the internal id of the device (used to connect to it)
* - "name" (QString): the name of the device
* - "address" (QString): the bluetooth address of the device
*
* \see connectToDevice()
*
* \return Variant list of all devices found during last scan
*/
Q_INVOKABLE QVariantList getAvailableDevicesDetailList();
/*!
* \brief Function connect to a device using its internal id
*
* The id can be found using getAvailableDevicesDetailList()
* The connectedToDevice() signal will be emited as soon as the connection was successfull.
* As soon as that signal was emited, the sendData() slot can be used to send data and
* the dataReceived() signal will be emited whenever data is received.
*
* \param deviceId the internal id of the device
*
* \see getAvailableDevicesDetailList()
* \see connectedToDevice()
* \see dataReceived()
*
* \return false if the device was not found in the internal list of discovered devices, true otherwise
*/
Q_INVOKABLE bool connectToDevice(int deviceId);
/*!
* \brief Function connect to a device using a QBluetoothLeUartDevice object
*
* The QBluetoothLeUartDevice can be found using getAvailableDevices()
* The connectedToDevice() signal will be emited as soon as the connection was successfull.
* As soon as that signal was emited, the sendData() slot can be used to send data and
* the dataReceived() signal will be emited whenever data is received.
*
* \param device The device to connect to
*
* \see getAvailableDevices()
* \see connectedToDevice()
* \see dataReceived()
*
* \return false if the device was not found in the internal list of discovered devices, true otherwise
*/
Q_INVOKABLE bool connectToDevice(QBluetoothLeUartDevice *device);
/*!
* \brief Function to disconnect from the current device
*
* \return false if no device was connected, true otherwise
*/
Q_INVOKABLE bool disconnectFromDevice();
/*!
* \brief Function to send data to the connected device
* \param data The data to send
* \return false if there was not device connected, true otherwise
*/
Q_INVOKABLE bool sendData(QString data);
/*!
* \brief Function to get the current state of QBluetoothLeUart
* \see BluetoothLeUartState
* \return The current state
*/
Q_INVOKABLE QBluetoothLeUart::BluetoothLeUartState getState() const;
private slots:
void setState(QBluetoothLeUart::BluetoothLeUartState newState);
/* Slots for QBluetothDeviceDiscoveryAgent */
// Slots for QBluetothDeviceDiscoveryAgent
void handleDeviceDiscovered(const QBluetoothDeviceInfo&);
void handleScanFinished();
void handleDeviceScanError(QBluetoothDeviceDiscoveryAgent::Error);
/* Slots for QLowEnergyController */
void handleServiceDiscovered(const QBluetoothUuid &);
// Slots for QLowEnergyController
void handleServiceDiscovered(const QBluetoothUuid & uuid);
void handleServiceScanDone();
void handleControllerError(QLowEnergyController::Error);
void handleDeviceConnected();
void handleDeviceDisconnected();
/* Slotes for QLowEnergyService */
// Slots for QLowEnergyService
void handleServiceStateChange(QLowEnergyService::ServiceState s);
void handleServiceCharacteristicChange(const QLowEnergyCharacteristic &c, const QByteArray &value);
void handleServiceDescriptorWritten(const QLowEnergyDescriptor &d, const QByteArray &value);
signals:
/* Signals for user */
void stateChanged(QBluetoothLeUart::BluetoothLeUartState newState);
void avaliableDevicesChanged(QList<QBluetoothLeUartDevice*> avaliableDevices);
void foundNewDevice(QBluetoothLeUartDevice* device);
void avaliableDevicesChanged(QList<QBluetoothLeUartDevice*> avaliableDevices);
void scanFinished(QList<QBluetoothLeUartDevice*> availableDevices);
void scanningErrorOccured(QBluetoothLeUart::BluetoothScanError error);
void dataReceived(QString s);
void connectedToDevice();
void dataReceived(QString s);
};
#endif // BLUETOOTHLEUART_H

View file

@ -7,6 +7,10 @@
#include <qbluetoothaddress.h>
#include <qbluetoothuuid.h>
/*!
* \brief The QBluetoothLeUartDevice class is a helper class for use with QBluetoothLeUart.
* It is used to get device details and connect to devices
*/
class QBluetoothLeUartDevice: public QObject
{
Q_OBJECT
@ -18,7 +22,16 @@ public:
friend class QBluetoothLeUart;
/*!
* \brief Function to get the name of the device
* \return The name of the device
*/
Q_INVOKABLE QString getName();
/*!
* \brief Function to get the address of the device
* \return address of the device
*/
Q_INVOKABLE QString getAddress();
protected: