|
1 /* |
|
2 * Copyright (c) 2002-2009 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: This file contains the header file of the CNWNetworkViagLcEngine class. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 #ifndef CNWNETWORKVIAGLCENGINE_H |
|
21 #define CNWNETWORKVIAGLCENGINE_H |
|
22 |
|
23 // INCLUDES |
|
24 #include "CNWNetworkViagBaseEngine.h" |
|
25 #include <f32file.h> |
|
26 |
|
27 |
|
28 // OLD INCLUDES |
|
29 #include "MNWNetworkTimer.h" |
|
30 #include "NWHandlingEngine.h" |
|
31 #include "CNWGsmMessageHandler.h" |
|
32 #include <MCbsMcnObserver.h> //For McbsMcnObserver |
|
33 #include <rmmcustomapi.h> |
|
34 #include <e32property.h> |
|
35 |
|
36 // CONSTANTS |
|
37 |
|
38 // FORWARD DECLARATIONS |
|
39 class CNWGsmSessionImplementation; |
|
40 class CNWNetworkViagTimer; |
|
41 class CMcn; |
|
42 class CNWGsmMessageHandler; |
|
43 |
|
44 // struct TViagElementReocord; |
|
45 // CLASS DECLARATION |
|
46 |
|
47 |
|
48 enum TNWRatType |
|
49 { |
|
50 ERatUtran = 0x00, |
|
51 ERatGsm = 0x40, // 1000000 |
|
52 ERatAny = 0x80, // 10000000 |
|
53 ERatUnvalid = 0xC0, // 11000000 |
|
54 }; |
|
55 |
|
56 enum TNWViagUnitType |
|
57 { |
|
58 EUnitCellId, |
|
59 EUnitLac, |
|
60 EUnitNone |
|
61 }; |
|
62 |
|
63 // Descripes the Prefix |
|
64 class TNWViagFieldContent |
|
65 { |
|
66 public: |
|
67 TNWViagFieldContent() |
|
68 { |
|
69 iWildCarded = EFalse; |
|
70 iFieldLAC = KErrNotFound; |
|
71 iUnitType = EUnitNone; |
|
72 iUnit.Zero(); |
|
73 }; |
|
74 |
|
75 TBool iWildCarded; // is wild card valid in current Field. |
|
76 TInt iFieldLAC; // If defined |
|
77 TNWViagUnitType iUnitType; |
|
78 TBuf<128> iUnit; // Max 128 units |
|
79 }; |
|
80 |
|
81 // Section descriptor |
|
82 class TNWViagSectionContent |
|
83 { |
|
84 public: |
|
85 TNWViagSectionContent() |
|
86 { |
|
87 iCodingScheme = KErrNotFound; |
|
88 iZoneId = KErrNotFound; |
|
89 iLastSection = ETrue; |
|
90 iField.Reset(); |
|
91 }; |
|
92 |
|
93 TInt iCodingScheme; //coding scheme. |
|
94 TInt iZoneId; // Current zone id |
|
95 TBool iLastSection; // Is the last section. |
|
96 RArray<TNWViagFieldContent> iField; |
|
97 }; |
|
98 |
|
99 // Network coding |
|
100 class TViagElementReocord |
|
101 { |
|
102 public: |
|
103 TViagElementReocord() |
|
104 { |
|
105 iRatType = ERatUnvalid; |
|
106 iMCC = KNullDesC; |
|
107 iMNC = KNullDesC; |
|
108 iCellSubscribed = EFalse; |
|
109 iCache.Reset(); |
|
110 }; |
|
111 |
|
112 TNWRatType iRatType; // Gsm, WCdma, Any ( GSM or WCDMA) |
|
113 TBuf<KNWCountryCodeLength> iMCC; // Country code. |
|
114 TBuf<KNWIdentityLength> iMNC; // Network code. |
|
115 TBool iCellSubscribed; // Informs is there any subscribed cells. |
|
116 RArray<TNWViagSectionContent> iCache; |
|
117 }; |
|
118 |
|
119 |
|
120 /** |
|
121 * Monitors current network change event from MMEtel. |
|
122 * |
|
123 * |
|
124 * @lib networkhandling.lib |
|
125 * @since Series 60_2.8 |
|
126 */ |
|
127 class CNWNetworkViagLcEngine : CBase |
|
128 { |
|
129 public: // Constructors and destructor |
|
130 |
|
131 /** |
|
132 * Two-phased constructor. |
|
133 */ |
|
134 static CNWNetworkViagLcEngine* NewL( |
|
135 CNWNetworkViagBaseEngine& aBase, |
|
136 TNWInfo& aNetworkInfo, |
|
137 RMmCustomAPI& aCustomAPI, |
|
138 TNWInterInfo& aInterNetworkInfo); |
|
139 |
|
140 /** |
|
141 * Destructor. |
|
142 */ |
|
143 virtual ~CNWNetworkViagLcEngine(); |
|
144 |
|
145 |
|
146 public: // Functions from MCbsMcnObserver |
|
147 |
|
148 /** |
|
149 * Is called by CNWNetworkCurrentNetworkMonitor in case of |
|
150 * cell re-selection. |
|
151 * @param |
|
152 * @return Error code. |
|
153 */ |
|
154 void CellReselection(); |
|
155 |
|
156 /** |
|
157 * Decides which parser is used. Desicion is made according to |
|
158 * Element file. |
|
159 * @param aResponse Struct containing all neccessary information |
|
160 * got from SIM. |
|
161 * @param aElementFile Used element file. |
|
162 * @return Error code. |
|
163 */ |
|
164 void ParseResult( TNWNetworkElementFile aElementFile, |
|
165 const TDesC8& aResponse ); |
|
166 |
|
167 /** |
|
168 * Parse setting value from aResponse parameter and update it if wanted. |
|
169 * |
|
170 * @param aResponse A reasponse data from SIM. |
|
171 * @return Error code. |
|
172 */ |
|
173 void ParseSettings( const TDesC8& aResponse ); |
|
174 |
|
175 /** |
|
176 * Checks if current LAC file contains any cubscribed cells. |
|
177 * |
|
178 * @param |
|
179 * @return Error code. |
|
180 */ |
|
181 void ParseSubscribed( TNWNetworkElementFile aElementFile, |
|
182 const TDesC8& aResponse ); |
|
183 |
|
184 /** |
|
185 * Parses zone tags from response and writes them to iZoneTags struct. |
|
186 * |
|
187 * @param aResponse A reasponse data from Sim including tag information. |
|
188 * @return Error code. |
|
189 */ |
|
190 void ParseTags( const TDesC8& aResponse ); |
|
191 |
|
192 /** |
|
193 * Finds a section information from given string and saves it to iCurrentCache struct. |
|
194 * |
|
195 * @param aParse String containging section information |
|
196 * @return Error code. |
|
197 */ |
|
198 TBool ParseSection( TLex8& aParse ); |
|
199 |
|
200 /** |
|
201 * Parses fields from given string to iField . |
|
202 * |
|
203 * @param aParse String containging field information |
|
204 * @return Error code. |
|
205 */ |
|
206 TBool ParseField( TLex8& aParse ); |
|
207 |
|
208 /** |
|
209 * Updates version number to SIM |
|
210 * |
|
211 * @param None. |
|
212 * @return Error code. |
|
213 */ |
|
214 void UpdateVersion( ); |
|
215 |
|
216 /** |
|
217 * Gets activation bits. |
|
218 * |
|
219 * @param aActivation General HomeZone activation. |
|
220 * @param aCbActivation Cell Broadcast activation bit. Tells wheter CB is active or not. |
|
221 * @return Error code. |
|
222 */ |
|
223 void GetActivation(TBool& aActivation, TBool& aCbActivation ); |
|
224 |
|
225 /** |
|
226 * Returns a boolean to indicate if there is at least one subscribed GSM cell. |
|
227 * |
|
228 * @param |
|
229 * @return subscribed A boolean, ETrue if there is at least one subscibed GSM Cell |
|
230 */ |
|
231 TBool IsGsmCellSubscribed(); |
|
232 |
|
233 private: |
|
234 |
|
235 /** |
|
236 * C++ default constructor. |
|
237 */ |
|
238 CNWNetworkViagLcEngine( CNWNetworkViagBaseEngine& aBase, |
|
239 TNWInfo& aNetworkInfo, |
|
240 RMmCustomAPI& aCustomAPI, |
|
241 TNWInterInfo& aInterNetworkInfo); |
|
242 |
|
243 |
|
244 /** |
|
245 * By default Symbian 2nd phase constructor is private. |
|
246 */ |
|
247 void ConstructL(); |
|
248 |
|
249 /* |
|
250 * Resets a given Lc cache struct. |
|
251 * |
|
252 * @param |
|
253 * @return None. |
|
254 */ |
|
255 void ResetLcCache( TViagElementReocord& aCurrentcache ); |
|
256 |
|
257 /* |
|
258 * Updates founded homezone values |
|
259 * |
|
260 * @param |
|
261 * @return None. |
|
262 */ |
|
263 void WriteViagValues( TInt aSectionIndex ); |
|
264 |
|
265 /* |
|
266 * Adds TUint in descriptor |
|
267 * |
|
268 * @param aBuffer destination buffer |
|
269 * @param aData data to be added |
|
270 * @return None. |
|
271 */ |
|
272 void AddInBufferAsTUint( TDes & aBuffer, const TUint aData ); |
|
273 |
|
274 /* |
|
275 * Extends TUint to descriptor |
|
276 * |
|
277 * @param aDestData destination buffer |
|
278 * @param aData source data |
|
279 * @return None. |
|
280 */ |
|
281 void ExtendTUintIntoBuffer( TDes & aDestData, const TUint aData ); |
|
282 |
|
283 private: |
|
284 /* |
|
285 * Handles network related matching stuff |
|
286 * |
|
287 * @param |
|
288 * @return TBool |
|
289 */ |
|
290 TBool HandleNetworkCheck(); |
|
291 |
|
292 /* |
|
293 * Makes the Cell id based matching |
|
294 * |
|
295 * @param aCell Cell Id from network |
|
296 * @param aLac Location Area code from Network |
|
297 * @param aSectionIndex index of used Cache |
|
298 * @param aIndex field index to search |
|
299 * @return TBool. ETrue if |
|
300 */ |
|
301 TBool HandleCellMatch( const TDesC & aCell, |
|
302 const TDesC & aLac, |
|
303 TInt aSectionIndex, |
|
304 TInt aIndex ); |
|
305 |
|
306 /* |
|
307 * Makes the LAC based matching |
|
308 * |
|
309 * @param aSectionIndex index of used Cache |
|
310 * @param aIndex field index to search |
|
311 * @param aLacBuf Location Area code from Network |
|
312 * @return None. |
|
313 */ |
|
314 void HandleLACMatch( TInt aSectionIndex, TInt aIndex, |
|
315 const TDesC& aLacBuf ); |
|
316 /* |
|
317 * converts cell id's to TInt and makes comprison |
|
318 * |
|
319 * @param aCell Cell Id from network |
|
320 * @param aCmpCell Cell Id from SIM file. |
|
321 * @return KErrNone if given values matches. |
|
322 */ |
|
323 TInt CompareTIntCellIdValues( const TDesC& aCell, |
|
324 const TDesC& aCmpCell ); |
|
325 |
|
326 private: // Data |
|
327 // owner.. |
|
328 CNWNetworkViagBaseEngine& iBase; |
|
329 // Reference to the network info structure. |
|
330 TNWInfo& iNWNetworkInfo; |
|
331 // Reference to the customAPI connection |
|
332 RMmCustomAPI& iCustomAPI; |
|
333 // Reference to the internal network info structure. |
|
334 TNWInterInfo& iInterNetworkInfo; |
|
335 // boolean to tell wheter section is last in curren file. |
|
336 TBool iLastSection; |
|
337 // Match is found. |
|
338 TBool iMatchFound; |
|
339 // General activation bit. |
|
340 TBool iActivation; |
|
341 // Cell Broadcast activation bit. |
|
342 TBool iCbActivation; |
|
343 // Current LC Cache |
|
344 TViagElementReocord* iCurrentLcCache; |
|
345 // version of HZ application in USIM card |
|
346 TInt iVersion; |
|
347 // Current coding scheme. |
|
348 TInt iCodingScheme; |
|
349 // Number of Lac/Ci field in section. |
|
350 TInt iNumberOfFields; |
|
351 // Number of Cell id's. |
|
352 TInt iNumberOfUnits; |
|
353 // Lc caches |
|
354 TViagElementReocord* iLcCacheOne; |
|
355 TViagElementReocord* iLcCacheTwo; |
|
356 TViagElementReocord* iLcCacheThree; |
|
357 TViagElementReocord* iLcCacheFour; |
|
358 }; |
|
359 |
|
360 #endif // CNWNetworkViagLcEngine_H |
|
361 |
|
362 |
|
363 |
|
364 // End of File |