1/****************************************************************************
2**
3** Copyright (C) 2015 The Qt Company Ltd and/or its subsidiary(-ies).
4** Contact: http://www.qt-project.org/legal
5**
6** This file is part of the QtSystems module of the Qt Toolkit.
7**
8** $QT_BEGIN_LICENSE:LGPL21$
9** Commercial License Usage
10** Licensees holding valid commercial Qt licenses may use this file in
11** accordance with the commercial license agreement provided with the
12** Software or, alternatively, in accordance with the terms contained in
13** a written agreement between you and The Qt Company. For licensing terms
14** and conditions see http://www.qt.io/terms-conditions. For further
15** information use the contact form at http://www.qt.io/contact-us.
16**
17** GNU Lesser General Public License Usage
18** Alternatively, this file may be used under the terms of the GNU Lesser
19** General Public License version 2.1 or version 3 as published by the Free
20** Software Foundation and appearing in the file LICENSE.LGPLv21 and
21** LICENSE.LGPLv3 included in the packaging of this file. Please review the
22** following information to ensure the GNU Lesser General Public License
23** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
24** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
25**
26** As a special exception, The Qt Company gives you certain additional
27** rights. These rights are described in The Qt Company LGPL Exception
28** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
29**
30** $QT_END_LICENSE$
31**
32****************************************************************************/
33
34#ifndef QDEVICEINFO_H
35#define QDEVICEINFO_H
36
37#include <QtSystemInfo/qsysteminfoglobal.h>
38#include <QtCore/qobject.h>
39
40QT_BEGIN_NAMESPACE
41
42#if !defined(QT_SIMULATOR)
43class QDeviceInfoPrivate;
44#else
45class QDeviceInfoSimulator;
46#endif // QT_SIMULATOR
47
48class Q_SYSTEMINFO_EXPORT QDeviceInfo : public QObject
49{
50 Q_OBJECT
51
52 Q_ENUMS(Feature)
53 Q_ENUMS(LockType)
54 Q_ENUMS(ThermalState)
55 Q_ENUMS(Version)
56
57 Q_FLAGS(LockType LockTypeFlags)
58
59 Q_PROPERTY(LockTypeFlags activatedLocks READ activatedLocks NOTIFY activatedLocksChanged)
60 Q_PROPERTY(LockTypeFlags enabledLocks READ enabledLocks NOTIFY enabledLocksChanged)
61 Q_PROPERTY(ThermalState thermalState READ thermalState NOTIFY thermalStateChanged)
62 Q_PROPERTY(bool currentBluetoothPowerState READ currentBluetoothPowerState NOTIFY bluetoothStateChanged)
63
64public:
65 enum Feature {
66 BluetoothFeature = 0,
67 CameraFeature,
68 FmRadioFeature,
69 FmTransmitterFeature,
70 InfraredFeature,
71 LedFeature,
72 MemoryCardFeature,
73 UsbFeature,
74 VibrationFeature,
75 WlanFeature,
76 SimFeature,
77 PositioningFeature,
78 VideoOutFeature,
79 HapticsFeature,
80 NfcFeature
81 };
82
83 enum LockType {
84 NoLock = 0,
85 PinLock = 0x0000001,
86 TouchOrKeyboardLock = 0x0000002,
87 UnknownLock = 0x0000004
88 };
89 Q_DECLARE_FLAGS(LockTypeFlags, LockType)
90
91 enum ThermalState {
92 UnknownThermal = 0,
93 NormalThermal,
94 WarningThermal,
95 AlertThermal,
96 ErrorThermal
97 };
98
99 enum Version {
100 Os = 0,
101 Firmware
102 };
103
104 explicit QDeviceInfo(QObject *parent = Q_NULLPTR);
105 virtual ~QDeviceInfo();
106
107 QDeviceInfo::LockTypeFlags activatedLocks() const;
108 QDeviceInfo::LockTypeFlags enabledLocks() const;
109 QDeviceInfo::ThermalState thermalState() const;
110
111 Q_INVOKABLE bool hasFeature(QDeviceInfo::Feature feature) const;
112 Q_INVOKABLE int imeiCount() const;
113 Q_INVOKABLE QString imei(int interfaceNumber) const;
114 Q_INVOKABLE QString manufacturer() const;
115 Q_INVOKABLE QString model() const;
116 Q_INVOKABLE QString productName() const;
117 Q_INVOKABLE QString uniqueDeviceID() const;
118 Q_INVOKABLE QString version(QDeviceInfo::Version type) const;
119 Q_INVOKABLE QString operatingSystemName() const;
120 Q_INVOKABLE QString boardName() const;
121
122 bool currentBluetoothPowerState();
123
124Q_SIGNALS:
125 void activatedLocksChanged(QDeviceInfo::LockTypeFlags types);
126 void enabledLocksChanged(QDeviceInfo::LockTypeFlags types);
127 void thermalStateChanged(QDeviceInfo::ThermalState state);
128 void bluetoothStateChanged(bool on);
129
130protected:
131 void connectNotify(const QMetaMethod &signal);
132 void disconnectNotify(const QMetaMethod &signal);
133
134private:
135 Q_DISABLE_COPY(QDeviceInfo)
136#if !defined(QT_SIMULATOR)
137 QDeviceInfoPrivate * const d_ptr;
138 Q_DECLARE_PRIVATE(QDeviceInfo)
139#else
140 QDeviceInfoSimulator * const d_ptr;
141#endif // QT_SIMULATOR
142};
143
144QT_END_NAMESPACE
145
146#endif // QDEVICEINFO_H
147

source code of qtsystems/src/systeminfo/qdeviceinfo.h