|
1 /**************************************************************************** |
|
2 ** |
|
3 ** Copyright (C) 2008-2010 Nokia Corporation and/or its subsidiary(-ies). |
|
4 ** All rights reserved. |
|
5 ** Contact: Nokia Corporation (developer.feedback@nokia.com) |
|
6 ** |
|
7 ** This file is part of the HbCore module of the UI Extensions for Mobile. |
|
8 ** |
|
9 ** GNU Lesser General Public License Usage |
|
10 ** This file may be used under the terms of the GNU Lesser General Public |
|
11 ** License version 2.1 as published by the Free Software Foundation and |
|
12 ** appearing in the file LICENSE.LGPL included in the packaging of this file. |
|
13 ** Please review the following information to ensure the GNU Lesser General |
|
14 ** Public License version 2.1 requirements will be met: |
|
15 ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. |
|
16 ** |
|
17 ** In addition, as a special exception, Nokia gives you certain additional |
|
18 ** rights. These rights are described in the Nokia Qt LGPL Exception |
|
19 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. |
|
20 ** |
|
21 ** If you have questions regarding the use of this file, please contact |
|
22 ** Nokia at developer.feedback@nokia.com. |
|
23 ** |
|
24 ****************************************************************************/ |
|
25 |
|
26 #ifndef HBSYSTEMINFO_H |
|
27 #define HBSYSTEMINFO_H |
|
28 |
|
29 #include <QObject> |
|
30 #include <QNetworkInterface> |
|
31 |
|
32 #include "hbglobal.h" |
|
33 #include "hbnamespace.h" |
|
34 |
|
35 class HbSystemNetworkInfoPrivate; |
|
36 class HbSystemDeviceInfoPrivate; |
|
37 |
|
38 class HB_CORE_PRIVATE_EXPORT HbSystemNetworkInfo : public QObject |
|
39 { |
|
40 Q_OBJECT |
|
41 Q_ENUMS(NetworkStatus) |
|
42 Q_ENUMS(NetworkMode) |
|
43 |
|
44 public: |
|
45 |
|
46 HbSystemNetworkInfo(QObject *parent = 0); |
|
47 virtual ~HbSystemNetworkInfo(); |
|
48 |
|
49 enum NetworkStatus { |
|
50 UndefinedStatus = 0, |
|
51 NoNetworkAvailable, |
|
52 EmergencyOnly, |
|
53 Searching, |
|
54 Busy, |
|
55 Connected, |
|
56 HomeNetwork, |
|
57 Denied, |
|
58 Roaming |
|
59 }; |
|
60 |
|
61 enum NetworkMode { |
|
62 UnknownMode=0, |
|
63 GsmMode, |
|
64 CdmaMode, |
|
65 WcdmaMode, |
|
66 WlanMode, |
|
67 EthernetMode, |
|
68 BluetoothMode, |
|
69 WimaxMode |
|
70 }; |
|
71 Q_DECLARE_FLAGS(NetworkModes, NetworkMode) |
|
72 |
|
73 HbSystemNetworkInfo::NetworkStatus networkStatus(HbSystemNetworkInfo::NetworkMode mode) const; |
|
74 int networkSignalStrength(HbSystemNetworkInfo::NetworkMode mode) const; |
|
75 QString macAddress(HbSystemNetworkInfo::NetworkMode mode) const; |
|
76 |
|
77 int cellId() const; |
|
78 int locationAreaCode() const; |
|
79 |
|
80 QString currentMobileCountryCode() const; |
|
81 QString currentMobileNetworkCode() const; |
|
82 QString homeMobileCountryCode() const; |
|
83 QString homeMobileNetworkCode() const; |
|
84 QString networkName(HbSystemNetworkInfo::NetworkMode mode) const; |
|
85 QNetworkInterface interfaceForMode(HbSystemNetworkInfo::NetworkMode mode) const; |
|
86 |
|
87 signals: |
|
88 void networkStatusChanged(HbSystemNetworkInfo::NetworkMode, HbSystemNetworkInfo::NetworkStatus); |
|
89 void networkSignalStrengthChanged(HbSystemNetworkInfo::NetworkMode, int); |
|
90 void currentMobileCountryCodeChanged(const QString &); |
|
91 void currentMobileNetworkCodeChanged(const QString &); |
|
92 void networkNameChanged(HbSystemNetworkInfo::NetworkMode,const QString &); |
|
93 void networkModeChanged(HbSystemNetworkInfo::NetworkMode); |
|
94 |
|
95 private: |
|
96 HbSystemNetworkInfoPrivate *d; |
|
97 }; |
|
98 |
|
99 class HB_CORE_PRIVATE_EXPORT HbSystemDeviceInfo : public QObject |
|
100 { |
|
101 Q_OBJECT |
|
102 Q_PROPERTY(Profile currentProfile READ currentProfile) |
|
103 Q_PROPERTY(PowerState currentPowerState READ currentPowerState) |
|
104 Q_PROPERTY(SimStatus simStatus READ simStatus) |
|
105 |
|
106 Q_ENUMS(BatteryLevel) |
|
107 Q_ENUMS(PowerState) |
|
108 Q_ENUMS(InputMethod) |
|
109 |
|
110 public: |
|
111 |
|
112 HbSystemDeviceInfo(QObject *parent = 0); |
|
113 virtual ~HbSystemDeviceInfo(); |
|
114 |
|
115 enum BatteryStatus { |
|
116 NoBatteryLevel = 0, |
|
117 BatteryCritical, |
|
118 BatteryVeryLow, |
|
119 BatteryLow, |
|
120 BatteryNormal |
|
121 }; |
|
122 |
|
123 enum PowerState { |
|
124 UnknownPower = 0, |
|
125 BatteryPower, |
|
126 WallPower, |
|
127 WallPowerChargingBattery |
|
128 }; |
|
129 |
|
130 enum InputMethod { |
|
131 Keys = 0x0000001, |
|
132 Keypad = 0x0000002, |
|
133 Keyboard = 0x0000004, |
|
134 SingleTouch = 0x0000008, |
|
135 MultiTouch = 0x0000010, |
|
136 Mouse = 0x0000020 |
|
137 }; |
|
138 Q_DECLARE_FLAGS(InputMethodFlags, InputMethod) |
|
139 |
|
140 HbSystemDeviceInfo::InputMethodFlags inputMethodType() const; |
|
141 |
|
142 QString imei() const; |
|
143 QString imsi() const; |
|
144 QString manufacturer() const; |
|
145 QString model() const; //external |
|
146 QString productName() const; //internal name |
|
147 |
|
148 int batteryLevel() const; //signal |
|
149 HbSystemDeviceInfo::BatteryStatus batteryStatus() const; |
|
150 |
|
151 enum Profile { |
|
152 UnknownProfile = 0, |
|
153 SilentProfile, |
|
154 NormalProfile, |
|
155 LoudProfile, |
|
156 VibProfile, |
|
157 OfflineProfile, |
|
158 PowersaveProfile, |
|
159 CustomProfile |
|
160 }; |
|
161 |
|
162 enum SimStatus { |
|
163 SimNotAvailable = 0, |
|
164 SingleSimAvailable, |
|
165 DualSimAvailable, |
|
166 SimLocked |
|
167 }; |
|
168 |
|
169 bool isDeviceLocked() const; |
|
170 HbSystemDeviceInfo::SimStatus simStatus() const; |
|
171 HbSystemDeviceInfo::Profile currentProfile() const; |
|
172 HbSystemDeviceInfo::PowerState currentPowerState() const; |
|
173 |
|
174 signals: |
|
175 void batteryLevelChanged(int); |
|
176 void batteryStatusChanged(HbSystemDeviceInfo::BatteryStatus ); |
|
177 void powerStateChanged(HbSystemDeviceInfo::PowerState); |
|
178 void currentProfileChanged(HbSystemDeviceInfo::Profile); |
|
179 void bluetoothStateChanged(bool); |
|
180 |
|
181 private: |
|
182 HbSystemDeviceInfoPrivate *d; |
|
183 }; |
|
184 |
|
185 #endif /*HBSYSTEMINFO_H*/ |