|
1 /* |
|
2 * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 * |
|
16 */ |
|
17 #ifndef HSDEVICEINFOLISTENER_H |
|
18 #define HSDEVICEINFOLISTENER_H |
|
19 |
|
20 #include <QObject> |
|
21 //#include <QSystemDeviceInfo> |
|
22 //#include <QSystemNetworkInfo> |
|
23 #ifdef HSUTILS_TEST |
|
24 #include "mocksysteminfo.h" |
|
25 #else |
|
26 #include <QSystemInfo> |
|
27 QTM_USE_NAMESPACE |
|
28 #endif |
|
29 |
|
30 #include "hstest_global.h" |
|
31 HOMESCREEN_TEST_CLASS(t_hsUtils) |
|
32 |
|
33 class HsDeviceInfoListener : public QObject |
|
34 { |
|
35 Q_OBJECT |
|
36 |
|
37 Q_ENUMS(HsDeviceInfoStatus) |
|
38 |
|
39 public: |
|
40 enum HsDeviceInfoStatus { |
|
41 NoService = 0, // no sim or out of coverage |
|
42 OfflineProfile, |
|
43 ServiceAvailable |
|
44 }; |
|
45 |
|
46 public: |
|
47 HsDeviceInfoListener(QObject *parent = 0); |
|
48 ~HsDeviceInfoListener(); |
|
49 |
|
50 public: |
|
51 QString operatorName() const; |
|
52 HsDeviceInfoStatus status() const; |
|
53 |
|
54 signals: |
|
55 void networkNameChanged(const QString &name); |
|
56 void statusChanged(HsDeviceInfoListener::HsDeviceInfoStatus status); |
|
57 |
|
58 private slots: |
|
59 void onNetworkStatusChanged(QSystemNetworkInfo::NetworkMode networkMode, QSystemNetworkInfo::NetworkStatus networkStatus); |
|
60 void onNetworkNameChanged(QSystemNetworkInfo::NetworkMode networkMode,const QString &networkName); |
|
61 void onCurrentProfileChanged(QSystemDeviceInfo::Profile profile); |
|
62 |
|
63 private: |
|
64 QSystemNetworkInfo::NetworkStatus networkStatus(); |
|
65 void updateCurrentNetworkMode(); |
|
66 bool isConnected(QSystemNetworkInfo::NetworkMode mode); |
|
67 void updateStatus(); |
|
68 QSystemDeviceInfo::SimStatus simStatus() const; |
|
69 private: |
|
70 |
|
71 QSystemNetworkInfo *mNetworkInfo; |
|
72 QSystemDeviceInfo *mDeviceInfo; |
|
73 QSystemNetworkInfo::NetworkMode mCurrentNetworkMode; |
|
74 HsDeviceInfoStatus mStatus; |
|
75 HOMESCREEN_TEST_FRIEND_CLASS(t_hsUtils) |
|
76 }; |
|
77 |
|
78 #endif // |