QBluetoothLeUart/qbluetoothleuartdevice.h

49 lines
1.1 KiB
C++

#ifndef DEVICEINFO_H
#define DEVICEINFO_H
#include <QString>
#include <QObject>
#include <qbluetoothdeviceinfo.h>
#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
Q_PROPERTY(QString name READ getName NOTIFY deviceChanged)
Q_PROPERTY(QString address READ getAddress NOTIFY deviceChanged)
public:
QBluetoothLeUartDevice(QBluetoothDeviceInfo device, QObject *parent = nullptr);
friend class QBluetoothLeUartClient;
/*!
* \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:
QBluetoothDeviceInfo getDevice();
private:
void setDevice(QBluetoothDeviceInfo device);
QBluetoothDeviceInfo bluetoothDeviceInfo;
signals:
void deviceChanged();
};
#endif // DEVICEINFO_H