|
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 |
|
42 #ifndef DEVICEINFO_H |
|
43 #define DEVICEINFO_H |
|
44 |
|
45 #include <e32base.h> |
|
46 #include <etel3rdparty.h> |
|
47 #include <QString> |
|
48 #include <QList> |
|
49 |
|
50 class CActiveSchedulerWait; |
|
51 |
|
52 class MTelephonyInfoObserver |
|
53 { |
|
54 public: |
|
55 virtual void batteryLevelChanged() = 0; |
|
56 |
|
57 virtual void countryCodeChanged() = 0; |
|
58 virtual void networkCodeChanged() = 0; |
|
59 virtual void networkNameChanged() = 0; |
|
60 virtual void networkModeChanged() = 0; |
|
61 |
|
62 virtual void cellNetworkSignalStrengthChanged() = 0; |
|
63 virtual void cellNetworkStatusChanged() = 0; |
|
64 }; |
|
65 |
|
66 class CTelephonyInfo : public CActive |
|
67 { |
|
68 public: |
|
69 CTelephonyInfo(CTelephony &telephony); |
|
70 ~CTelephonyInfo(); |
|
71 |
|
72 void addObserver(MTelephonyInfoObserver *observer); |
|
73 void removeObserver(MTelephonyInfoObserver *observer); |
|
74 |
|
75 protected: //from CActive |
|
76 void RunL(); |
|
77 |
|
78 protected: |
|
79 void makeRequest(); |
|
80 |
|
81 protected: |
|
82 CTelephony &m_telephony; |
|
83 QList<MTelephonyInfoObserver *> m_observers; |
|
84 CActiveSchedulerWait *m_wait; |
|
85 }; |
|
86 |
|
87 class CPhoneInfo : public CTelephonyInfo |
|
88 { |
|
89 public: |
|
90 CPhoneInfo(CTelephony &telephony); |
|
91 |
|
92 protected: |
|
93 void DoCancel(); |
|
94 |
|
95 public: |
|
96 QString imei() const; |
|
97 QString manufacturer() const; |
|
98 QString model() const; |
|
99 |
|
100 private: |
|
101 CTelephony::TPhoneIdV1 m_phoneIdV1; |
|
102 CTelephony::TPhoneIdV1Pckg m_phoneIdV1Pckg; |
|
103 |
|
104 QString m_imei; |
|
105 QString m_manufacturer; |
|
106 QString m_model; |
|
107 }; |
|
108 |
|
109 class CSubscriberInfo : public CTelephonyInfo |
|
110 { |
|
111 public: |
|
112 CSubscriberInfo(CTelephony &telephony); |
|
113 |
|
114 protected: |
|
115 void DoCancel(); |
|
116 |
|
117 public: |
|
118 QString imsi() const; |
|
119 |
|
120 private: |
|
121 CTelephony::TSubscriberIdV1 m_subscriberIdV1; |
|
122 CTelephony::TSubscriberIdV1Pckg m_subscriberIdV1Pckg; |
|
123 |
|
124 QString m_imsi; |
|
125 }; |
|
126 |
|
127 class CBatteryInfo : public CTelephonyInfo |
|
128 { |
|
129 public: |
|
130 CBatteryInfo(CTelephony &telephony); |
|
131 void startMonitoring(); |
|
132 |
|
133 protected: |
|
134 void RunL(); |
|
135 void DoCancel(); |
|
136 |
|
137 public: |
|
138 int batteryLevel() const; |
|
139 |
|
140 private: |
|
141 bool m_initializing; |
|
142 |
|
143 CTelephony::TBatteryInfoV1 m_batteryInfoV1; |
|
144 CTelephony::TBatteryInfoV1Pckg m_batteryInfoV1Pckg; |
|
145 |
|
146 int m_batteryLevel; |
|
147 int m_previousBatteryLevel; |
|
148 }; |
|
149 |
|
150 class CCellNetworkInfo : public CTelephonyInfo |
|
151 { |
|
152 public: |
|
153 CCellNetworkInfo(CTelephony &telephony); |
|
154 void startMonitoring(); |
|
155 |
|
156 protected: |
|
157 void RunL(); |
|
158 void DoCancel(); |
|
159 |
|
160 public: |
|
161 int cellId() const; |
|
162 int locationAreaCode() const; |
|
163 |
|
164 QString countryCode() const; |
|
165 QString networkCode() const; |
|
166 QString networkName() const; |
|
167 CTelephony::TNetworkMode networkMode() const; |
|
168 |
|
169 private: |
|
170 bool m_initializing; |
|
171 |
|
172 CTelephony::TNetworkInfoV1Pckg m_networkInfoV1Pckg; |
|
173 CTelephony::TNetworkInfoV1 m_networkInfoV1; |
|
174 |
|
175 int m_cellId; |
|
176 int m_locationAreaCode; |
|
177 |
|
178 QString m_networkId; |
|
179 QString m_previousNetworkId; |
|
180 |
|
181 QString m_countryCode; |
|
182 QString m_previousCountryCode; |
|
183 |
|
184 QString m_networkName; |
|
185 QString m_previousNetworkName; |
|
186 |
|
187 CTelephony::TNetworkMode m_networkMode; |
|
188 CTelephony::TNetworkMode m_previousNetworkMode; |
|
189 |
|
190 }; |
|
191 |
|
192 class CCellNetworkRegistrationInfo : public CTelephonyInfo |
|
193 { |
|
194 public: |
|
195 CCellNetworkRegistrationInfo(CTelephony &telephony); |
|
196 void startMonitoring(); |
|
197 |
|
198 protected: |
|
199 void RunL(); |
|
200 void DoCancel(); |
|
201 |
|
202 public: |
|
203 CTelephony::TRegistrationStatus cellNetworkStatus() const; |
|
204 |
|
205 private: |
|
206 bool m_initializing; |
|
207 |
|
208 CTelephony::TNetworkRegistrationV1Pckg m_networkRegistrationV1Pckg; |
|
209 CTelephony::TNetworkRegistrationV1 m_networkRegistrationV1; |
|
210 |
|
211 CTelephony::TRegistrationStatus m_networkStatus; |
|
212 CTelephony::TRegistrationStatus m_previousNetworkStatus; |
|
213 }; |
|
214 |
|
215 class CCellSignalStrengthInfo : public CTelephonyInfo |
|
216 { |
|
217 public: |
|
218 CCellSignalStrengthInfo(CTelephony &telephony); |
|
219 void startMonitoring(); |
|
220 |
|
221 protected: |
|
222 void RunL(); |
|
223 void DoCancel(); |
|
224 |
|
225 public: |
|
226 int cellNetworkSignalStrength() const; |
|
227 |
|
228 private: |
|
229 bool m_initializing; |
|
230 |
|
231 CTelephony::TSignalStrengthV1Pckg m_signalStrengthV1Pckg; |
|
232 CTelephony::TSignalStrengthV1 m_signalStrengthV1; |
|
233 |
|
234 int m_cellNetworkSignalStrength; |
|
235 int m_previousCellNetworkSignalStrength; |
|
236 |
|
237 int m_signalBar; |
|
238 int m_previousSignalBar; |
|
239 }; |
|
240 |
|
241 #endif //DEVICEINFO_H |