2020-10-08 20:01:21 +02:00
|
|
|
#include "qbluetoothleuartdevice.h"
|
|
|
|
|
|
|
|
QBluetoothLeUartDevice::QBluetoothLeUartDevice(QBluetoothDeviceInfo info, QObject *parent) : QObject(parent)
|
|
|
|
{
|
|
|
|
this->bluetoothDeviceInfo = info;
|
|
|
|
}
|
|
|
|
|
|
|
|
QString QBluetoothLeUartDevice::getName()
|
|
|
|
{
|
|
|
|
return bluetoothDeviceInfo.name();
|
|
|
|
}
|
|
|
|
|
|
|
|
QBluetoothDeviceInfo QBluetoothLeUartDevice::getDevice()
|
|
|
|
{
|
|
|
|
return bluetoothDeviceInfo;
|
|
|
|
}
|
|
|
|
|
|
|
|
QString QBluetoothLeUartDevice::getAddress()
|
|
|
|
{
|
|
|
|
#ifdef Q_OS_MAC
|
|
|
|
// workaround for Core Bluetooth:
|
2020-10-08 22:13:04 +02:00
|
|
|
return bluetoothDeviceInfo.deviceUuid().toString();
|
2020-10-08 20:01:21 +02:00
|
|
|
#else
|
|
|
|
return bluetoothDeviceInfo.address().toString();
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
void QBluetoothLeUartDevice::setDevice(QBluetoothDeviceInfo device)
|
|
|
|
{
|
|
|
|
if(device != this->bluetoothDeviceInfo) {
|
|
|
|
bluetoothDeviceInfo = device;
|
|
|
|
emit deviceChanged();
|
|
|
|
}
|
|
|
|
}
|