blob: 15a426f84097987ac7503abf9fe423f6ba439267 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
|
// Copyright (C) 2017 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
#include "heartrate-global.h"
#include "deviceinfo.h"
#include <QBluetoothAddress>
#include <QBluetoothUuid>
DeviceInfo::DeviceInfo(const QBluetoothDeviceInfo &info):
m_device(info)
{
}
QBluetoothDeviceInfo DeviceInfo::getDevice() const
{
return m_device;
}
QString DeviceInfo::getName() const
{
#ifdef SIMULATOR
return "Demo device";
#else
return m_device.name();
#endif
}
QString DeviceInfo::getAddress() const
{
#ifdef SIMULATOR
return "00:11:22:33:44:55";
#elif defined Q_OS_DARWIN
// workaround for Core Bluetooth:
return m_device.deviceUuid().toString();
#else
return m_device.address().toString();
#endif
}
void DeviceInfo::setDevice(const QBluetoothDeviceInfo &device)
{
m_device = device;
emit deviceChanged();
}
|