|
1 /**************************************************************************** |
|
2 ** |
|
3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). |
|
4 ** All rights reserved. |
|
5 ** Contact: Nokia Corporation (qt-info@nokia.com) |
|
6 ** |
|
7 ** This file is part of the Qt Mobility Components. |
|
8 ** |
|
9 ** $QT_BEGIN_LICENSE:LGPL$ |
|
10 ** No Commercial Usage |
|
11 ** This file contains pre-release code and may not be distributed. |
|
12 ** You may use this file in accordance with the terms and conditions |
|
13 ** contained in the Technology Preview License Agreement accompanying |
|
14 ** this package. |
|
15 ** |
|
16 ** GNU Lesser General Public License Usage |
|
17 ** Alternatively, this file may be used under the terms of the GNU Lesser |
|
18 ** General Public License version 2.1 as published by the Free Software |
|
19 ** Foundation and appearing in the file LICENSE.LGPL included in the |
|
20 ** packaging of this file. Please review the following information to |
|
21 ** ensure the GNU Lesser General Public License version 2.1 requirements |
|
22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. |
|
23 ** |
|
24 ** In addition, as a special exception, Nokia gives you certain additional |
|
25 ** rights. These rights are described in the Nokia Qt LGPL Exception |
|
26 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. |
|
27 ** |
|
28 ** If you have questions regarding the use of this file, please contact |
|
29 ** Nokia at qt-info@nokia.com. |
|
30 ** |
|
31 ** |
|
32 ** |
|
33 ** |
|
34 ** |
|
35 ** |
|
36 ** |
|
37 ** |
|
38 ** $QT_END_LICENSE$ |
|
39 ** |
|
40 ****************************************************************************/ |
|
41 #ifndef QSYSTEMINFO_S60_H |
|
42 #define QSYSTEMINFO_S60_H |
|
43 |
|
44 |
|
45 // |
|
46 // W A R N I N G |
|
47 // ------------- |
|
48 // |
|
49 // This file is not part of the Qt API. It exists purely as an |
|
50 // implementation detail. This header file may change from version to |
|
51 // version without notice, or even be removed. |
|
52 // |
|
53 // We mean it. |
|
54 // |
|
55 |
|
56 |
|
57 #include <QObject> |
|
58 #include <QStringList> |
|
59 |
|
60 #include "qmobilityglobal.h" |
|
61 #include "qsysteminfo.h" |
|
62 |
|
63 #include <f32file.h> |
|
64 #include "telephonyinfo_s60.h" |
|
65 #include "chargingstatus_s60.h" |
|
66 #include "wlaninfo_s60.h" |
|
67 |
|
68 QT_BEGIN_HEADER |
|
69 |
|
70 QTM_BEGIN_NAMESPACE |
|
71 |
|
72 |
|
73 //////// QSystemInfo |
|
74 class QSystemInfoPrivate : public QObject |
|
75 { |
|
76 Q_OBJECT |
|
77 |
|
78 public: |
|
79 QSystemInfoPrivate(QObject *parent = 0); |
|
80 virtual ~QSystemInfoPrivate(); |
|
81 |
|
82 QString currentLanguage() const; |
|
83 QStringList availableLanguages() const; |
|
84 QString currentCountryCode() const; |
|
85 |
|
86 QString version(QSystemInfo::Version type, const QString ¶meter = QString()); |
|
87 bool hasFeatureSupported(QSystemInfo::Feature feature); |
|
88 |
|
89 Q_SIGNALS: |
|
90 void currentLanguageChanged(const QString &); |
|
91 |
|
92 private: |
|
93 QString QLocaleToISO639_1(QLocale::Language language) const; |
|
94 QString TLanguageToISO639_1(TLanguage language) const; |
|
95 QString S60Version() const; |
|
96 }; |
|
97 |
|
98 //////// QSystemNetworkInfo |
|
99 class QSystemNetworkInfoPrivate : public QObject, public MTelephonyInfoObserver |
|
100 { |
|
101 Q_OBJECT |
|
102 |
|
103 public: |
|
104 |
|
105 QSystemNetworkInfoPrivate(QObject *parent = 0); |
|
106 virtual ~QSystemNetworkInfoPrivate(); |
|
107 |
|
108 QSystemNetworkInfo::NetworkStatus networkStatus(QSystemNetworkInfo::NetworkMode mode); |
|
109 static int networkSignalStrength(QSystemNetworkInfo::NetworkMode mode); |
|
110 static int cellId(); |
|
111 static int locationAreaCode(); |
|
112 |
|
113 static QString currentMobileCountryCode(); |
|
114 static QString currentMobileNetworkCode(); |
|
115 |
|
116 static QString homeMobileCountryCode(); |
|
117 static QString homeMobileNetworkCode(); |
|
118 |
|
119 static QString networkName(QSystemNetworkInfo::NetworkMode mode); //signal |
|
120 QString macAddress(QSystemNetworkInfo::NetworkMode mode); |
|
121 |
|
122 QNetworkInterface interfaceForMode(QSystemNetworkInfo::NetworkMode mode); |
|
123 QSystemNetworkInfo::NetworkMode currentMode(); |
|
124 |
|
125 Q_SIGNALS: |
|
126 void networkStatusChanged(QSystemNetworkInfo::NetworkMode, QSystemNetworkInfo::NetworkStatus); |
|
127 void networkSignalStrengthChanged(QSystemNetworkInfo::NetworkMode, int); |
|
128 void currentMobileCountryCodeChanged(const QString &); |
|
129 void currentMobileNetworkCodeChanged(const QString &); |
|
130 void networkNameChanged(QSystemNetworkInfo::NetworkMode,const QString &); |
|
131 void networkModeChanged(QSystemNetworkInfo::NetworkMode); |
|
132 |
|
133 protected: //from MTelephonyInfoObserver |
|
134 void batteryLevelChanged(){}; |
|
135 |
|
136 void countryCodeChanged(); |
|
137 void networkCodeChanged(); |
|
138 void networkNameChanged(); |
|
139 void networkModeChanged(); |
|
140 |
|
141 void cellNetworkSignalStrengthChanged(); |
|
142 void cellNetworkStatusChanged(); |
|
143 |
|
144 public slots: |
|
145 void wlanNetworkNameChanged(); |
|
146 void wlanNetworkSignalStrengthChanged(); |
|
147 void wlanNetworkStatusChanged(); |
|
148 }; |
|
149 |
|
150 //////// QSystemDisplayInfo |
|
151 class QSystemDisplayInfoPrivate : public QObject |
|
152 { |
|
153 Q_OBJECT |
|
154 |
|
155 public: |
|
156 |
|
157 QSystemDisplayInfoPrivate(QObject *parent = 0); |
|
158 virtual ~QSystemDisplayInfoPrivate(); |
|
159 |
|
160 static int displayBrightness(int screen); |
|
161 static int colorDepth(int screen); |
|
162 }; |
|
163 |
|
164 |
|
165 //////// QSystemStorageInfo |
|
166 class QSystemStorageInfoPrivate : public QObject |
|
167 { |
|
168 Q_OBJECT |
|
169 |
|
170 public: |
|
171 QSystemStorageInfoPrivate(QObject *parent = 0); |
|
172 virtual ~QSystemStorageInfoPrivate(); |
|
173 qlonglong totalDiskSpace(const QString &driveVolume); |
|
174 qlonglong availableDiskSpace(const QString &driveVolume); |
|
175 static QStringList logicalDrives(); |
|
176 QSystemStorageInfo::DriveType typeForDrive(const QString &driveVolume); |
|
177 |
|
178 private: |
|
179 RFs iFs; |
|
180 }; |
|
181 |
|
182 //////// QSystemDeviceInfo |
|
183 |
|
184 |
|
185 class DeviceInfo; |
|
186 QTM_END_NAMESPACE |
|
187 |
|
188 #include <MProEngProfileActivationObserver.h> |
|
189 #include <cenrepnotifyhandler.h> |
|
190 |
|
191 class MProEngEngine; |
|
192 class MProEngNotifyHandler; |
|
193 |
|
194 QTM_BEGIN_NAMESPACE |
|
195 |
|
196 class QSystemDeviceInfoPrivate : public QObject, |
|
197 public MTelephonyInfoObserver, |
|
198 public MProEngProfileActivationObserver, |
|
199 public MCenRepNotifyHandlerCallback, |
|
200 public MChargingStatusObserver |
|
201 { |
|
202 Q_OBJECT |
|
203 |
|
204 public: |
|
205 |
|
206 QSystemDeviceInfoPrivate(QObject *parent = 0); |
|
207 virtual ~QSystemDeviceInfoPrivate(); |
|
208 |
|
209 QSystemDeviceInfo::InputMethodFlags inputMethodType(); |
|
210 |
|
211 // device |
|
212 static QString imei(); |
|
213 static QString imsi(); |
|
214 static QString manufacturer(); |
|
215 static QString model(); |
|
216 static QString productName(); |
|
217 |
|
218 int batteryLevel() const; |
|
219 QSystemDeviceInfo::BatteryStatus batteryStatus(); |
|
220 |
|
221 bool isDeviceLocked(); |
|
222 static QSystemDeviceInfo::SimStatus simStatus(); |
|
223 QSystemDeviceInfo::Profile currentProfile(); |
|
224 |
|
225 QSystemDeviceInfo::PowerState currentPowerState(); |
|
226 |
|
227 Q_SIGNALS: |
|
228 void batteryLevelChanged(int); |
|
229 void batteryStatusChanged(QSystemDeviceInfo::BatteryStatus); |
|
230 void bluetoothStateChanged(bool); |
|
231 void currentProfileChanged(QSystemDeviceInfo::Profile); |
|
232 void powerStateChanged(QSystemDeviceInfo::PowerState); |
|
233 |
|
234 protected: //From QObject |
|
235 void connectNotify(const char *signal); |
|
236 |
|
237 protected: //From MProEngProfileActivationObserver |
|
238 void HandleProfileActivatedL(TInt aProfileId); |
|
239 |
|
240 protected: //From MCenRepNotifyHandlerCallback |
|
241 void HandleNotifyInt(TUint32 aId, TInt aNewValue); |
|
242 |
|
243 private: |
|
244 QSystemDeviceInfo::Profile s60ProfileIdToProfile(TInt profileId) const; |
|
245 |
|
246 protected: //from MTelephonyInfoObserver |
|
247 void batteryLevelChanged(); |
|
248 |
|
249 void countryCodeChanged(){}; |
|
250 void networkCodeChanged(){}; |
|
251 void networkNameChanged(){}; |
|
252 void networkModeChanged(){}; |
|
253 |
|
254 void cellNetworkSignalStrengthChanged(){}; |
|
255 void cellNetworkStatusChanged(){}; |
|
256 |
|
257 protected: //from MChargingStatusObserver |
|
258 void chargingStatusChanged(); |
|
259 |
|
260 private: //data |
|
261 MProEngEngine *m_profileEngine; |
|
262 MProEngNotifyHandler* m_proEngNotifyHandler; |
|
263 |
|
264 CRepository *m_bluetoothRepository; |
|
265 CCenRepNotifyHandler *m_bluetoothNotifyHandler; |
|
266 }; |
|
267 |
|
268 //////// QSystemScreenSaver |
|
269 class QSystemScreenSaverPrivate : public QObject |
|
270 { |
|
271 Q_OBJECT |
|
272 |
|
273 public: |
|
274 QSystemScreenSaverPrivate(QObject *parent = 0); |
|
275 |
|
276 bool screenSaverInhibited(); |
|
277 bool setScreenSaverInhibit(); |
|
278 |
|
279 private Q_SLOTS: |
|
280 void resetInactivityTime(); |
|
281 |
|
282 private: //data |
|
283 bool m_screenSaverInhibited; |
|
284 }; |
|
285 |
|
286 //////// DeviceInfo (singleton) |
|
287 class DeviceInfo |
|
288 { |
|
289 public: |
|
290 static DeviceInfo *instance() |
|
291 { |
|
292 if (!m_instance) |
|
293 { |
|
294 m_instance = new DeviceInfo; |
|
295 } |
|
296 return m_instance; |
|
297 } |
|
298 |
|
299 CPhoneInfo *phoneInfo() |
|
300 { |
|
301 if (!m_phoneInfo) { |
|
302 m_phoneInfo = new CPhoneInfo(*m_telephony); |
|
303 } |
|
304 return m_phoneInfo; |
|
305 } |
|
306 |
|
307 CSubscriberInfo *subscriberInfo() |
|
308 { |
|
309 if (!m_subscriberInfo) { |
|
310 m_subscriberInfo = new CSubscriberInfo(*m_telephony); |
|
311 } |
|
312 return m_subscriberInfo; |
|
313 } |
|
314 |
|
315 CChargingStatus *chargingStatus() |
|
316 { |
|
317 if (!m_chargingStatus) { |
|
318 m_chargingStatus = new CChargingStatus; |
|
319 } |
|
320 return m_chargingStatus; |
|
321 } |
|
322 |
|
323 CBatteryInfo *batteryInfo() |
|
324 { |
|
325 if (!m_batteryInfo) { |
|
326 m_batteryInfo = new CBatteryInfo(*m_telephony); |
|
327 } |
|
328 return m_batteryInfo; |
|
329 } |
|
330 |
|
331 CCellNetworkInfo *cellNetworkInfo() |
|
332 { |
|
333 if (!m_cellNetworkInfo) { |
|
334 m_cellNetworkInfo = new CCellNetworkInfo(*m_telephony); |
|
335 } |
|
336 return m_cellNetworkInfo; |
|
337 } |
|
338 |
|
339 CCellNetworkRegistrationInfo *cellNetworkRegistrationInfo() |
|
340 { |
|
341 if (!m_cellNetworkRegistrationInfo) { |
|
342 m_cellNetworkRegistrationInfo = new CCellNetworkRegistrationInfo(*m_telephony); |
|
343 } |
|
344 return m_cellNetworkRegistrationInfo; |
|
345 } |
|
346 |
|
347 CCellSignalStrengthInfo *cellSignalStrenghtInfo() |
|
348 { |
|
349 if (!m_cellSignalStrengthInfo) { |
|
350 m_cellSignalStrengthInfo = new CCellSignalStrengthInfo(*m_telephony); |
|
351 } |
|
352 return m_cellSignalStrengthInfo; |
|
353 } |
|
354 |
|
355 CWlanInfo *wlanInfo() |
|
356 { |
|
357 if (!m_wlanInfo) { |
|
358 m_wlanInfo = new CWlanInfo; |
|
359 } |
|
360 return m_wlanInfo; |
|
361 } |
|
362 |
|
363 private: |
|
364 DeviceInfo() : m_phoneInfo(NULL), m_subscriberInfo(NULL), m_chargingStatus(NULL), |
|
365 m_batteryInfo(NULL), m_cellNetworkInfo(NULL), m_cellNetworkRegistrationInfo(NULL), |
|
366 m_cellSignalStrengthInfo(NULL), m_wlanInfo(NULL) |
|
367 { |
|
368 m_telephony = CTelephony::NewL(); |
|
369 }; |
|
370 |
|
371 ~DeviceInfo() |
|
372 { |
|
373 delete m_cellSignalStrengthInfo; |
|
374 delete m_cellNetworkRegistrationInfo; |
|
375 delete m_cellNetworkInfo; |
|
376 delete m_batteryInfo; |
|
377 delete m_chargingStatus; |
|
378 delete m_subscriberInfo; |
|
379 delete m_phoneInfo; |
|
380 delete m_telephony; |
|
381 delete m_wlanInfo; |
|
382 } |
|
383 |
|
384 static DeviceInfo *m_instance; |
|
385 |
|
386 CTelephony *m_telephony; |
|
387 CPhoneInfo *m_phoneInfo; |
|
388 CSubscriberInfo *m_subscriberInfo; |
|
389 CChargingStatus *m_chargingStatus; |
|
390 CBatteryInfo *m_batteryInfo; |
|
391 CCellNetworkInfo *m_cellNetworkInfo; |
|
392 CCellNetworkRegistrationInfo *m_cellNetworkRegistrationInfo; |
|
393 CCellSignalStrengthInfo *m_cellSignalStrengthInfo; |
|
394 CWlanInfo* m_wlanInfo; |
|
395 }; |
|
396 |
|
397 QTM_END_NAMESPACE |
|
398 |
|
399 QT_END_HEADER |
|
400 |
|
401 #endif /*QSYSTEMSINFO_S60_H*/ |
|
402 |
|
403 // End of file |