|
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 CNWNetworkViagCbEngine class. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 #ifndef CNWNETWORKHZCACHEHANDLER_H |
|
21 #define CNWNETWORKHZCACHEHANDLER_H |
|
22 |
|
23 // INCLUDES |
|
24 #include <rmmcustomapi.h> |
|
25 #include <e32property.h> |
|
26 #include "CNWNetworkViagTimer.h" |
|
27 #include "MHZCachesInitialisationObserver.h" |
|
28 #include "MNWNetworkEFReaderObserver.h" |
|
29 #include "CNWNetworkEFReader.h" |
|
30 |
|
31 // CONSTANTS |
|
32 |
|
33 // DATA TYPES |
|
34 enum THomeZoneCacheId |
|
35 { |
|
36 EHZ_HomeZoneCache1 = 1, |
|
37 EHZ_HomeZoneCache2 = 2, |
|
38 EHZ_HomeZoneCache3 = 3, |
|
39 EHZ_CityZoneCache = 4, |
|
40 EHZ_AllCaches = 100 |
|
41 }; |
|
42 |
|
43 enum TInitializingStatus |
|
44 { |
|
45 ECBSHZCacheReader_NotInitialised = 0, |
|
46 ECBSHZCacheReader_Initialising_Cache_HZ1, |
|
47 ECBSHZCacheReader_Ready = 100 |
|
48 }; |
|
49 |
|
50 // FORWARD DECLARATIONS |
|
51 |
|
52 // CLASS DECLARATION |
|
53 class MNWNetworkEFReaderObserver; |
|
54 /** |
|
55 * Handles HomeZone cache reading, searching and updating |
|
56 * |
|
57 * |
|
58 * @lib networkhandling.lib |
|
59 * @since Series 60_3.0 |
|
60 */ |
|
61 NONSHARABLE_CLASS( CNWNetworkHZCbCacheHandler ) : public CBase, |
|
62 public MNWNetworkEFReaderObserver |
|
63 { |
|
64 public: // Constructors and destructor |
|
65 |
|
66 /** |
|
67 * Two-phased constructor. |
|
68 */ |
|
69 static CNWNetworkHZCbCacheHandler* NewL( RMmCustomAPI& aCustomAPI ); |
|
70 |
|
71 /** |
|
72 * Destructor. |
|
73 */ |
|
74 virtual ~CNWNetworkHZCbCacheHandler( ); |
|
75 |
|
76 public: |
|
77 |
|
78 /** |
|
79 * This function is called for finding an item from cache. |
|
80 * |
|
81 * @param aCacheId Source cache |
|
82 * @return Result code. Index inside the cache. |
|
83 * KErrNotFound if match didn't happen |
|
84 */ |
|
85 TInt Find( THomeZoneCacheId aCacheId, |
|
86 RMmCustomAPI::TViagCacheRecordContent aRecord ); |
|
87 |
|
88 /** |
|
89 * This function is called when adding an item in cache. |
|
90 * |
|
91 * @param aCache Target cache |
|
92 * @param aRecord A record to be added |
|
93 * @return Result code. |
|
94 */ |
|
95 TInt Insert( const THomeZoneCacheId aCacheId, |
|
96 const RMmCustomAPI::TViagCacheRecordContent aRecord ); |
|
97 |
|
98 /** |
|
99 * This function is called for removing an item from cache. |
|
100 * |
|
101 * @param aRecord Target cache |
|
102 * @param aCacheId A record to be removed |
|
103 * @return Result code. |
|
104 */ |
|
105 TInt Remove( const THomeZoneCacheId aCacheId, const TInt aIndex ); |
|
106 |
|
107 /** |
|
108 * This function is called for clearing a cache, |
|
109 * |
|
110 * @param aRecord Target cache |
|
111 * @return Result code. |
|
112 */ |
|
113 TInt Clear( const THomeZoneCacheId aCacheId ); |
|
114 |
|
115 /** |
|
116 * This function is called for refreshing local cache from SIM data |
|
117 * |
|
118 * @return None |
|
119 */ |
|
120 void InitialiseHomeZoneCachesAsync( |
|
121 MHZCachesInitialisationObserver * aObserver ); |
|
122 |
|
123 /** |
|
124 * This function is called for getting object internal status |
|
125 * |
|
126 * @param aStatus New status |
|
127 * @return Objects current status |
|
128 */ |
|
129 TInitializingStatus InitialisingStatus( ) const; |
|
130 |
|
131 |
|
132 private: |
|
133 |
|
134 /** |
|
135 * C++ default constructor. |
|
136 */ |
|
137 CNWNetworkHZCbCacheHandler( RMmCustomAPI& aCustomAPI ); |
|
138 |
|
139 /** |
|
140 * By default Symbian 2nd phase constructor is private. |
|
141 */ |
|
142 void ConstructL( ); |
|
143 |
|
144 /** |
|
145 * This function is called internally form reading HZ cache items |
|
146 * from SIM to an array. |
|
147 * |
|
148 * @param aDestArray Items to be insereted |
|
149 * @param aCacheId Source cache. |
|
150 * @param aNumberofItems The amount of items to be read. |
|
151 * @return Result code. |
|
152 */ |
|
153 TInt ReadCacheFromSIM( |
|
154 RArray<RMmCustomAPI::TViagCacheRecordContent> & aDestArray, |
|
155 const THomeZoneCacheId aCacheId, const TInt aNumberofItems ); |
|
156 |
|
157 /** |
|
158 * This function is called internally to get a pointer in local |
|
159 * caches. |
|
160 * |
|
161 * @param THomeZoneCacheId Souce cache. |
|
162 * @return Cache pointer. |
|
163 */ |
|
164 RArray<RMmCustomAPI::TViagCacheRecordContent> * Cache( |
|
165 const THomeZoneCacheId aCacheId ); |
|
166 |
|
167 /** |
|
168 * This function is called internally when adding a HomeZone |
|
169 * cache item in cache. |
|
170 * |
|
171 * @param aRecord A record to be added. |
|
172 * @param aCacheId Target cacge. |
|
173 * @return Result code. |
|
174 */ |
|
175 TInt DoInsertInHomeZoneCache( |
|
176 const RMmCustomAPI::TViagCacheRecordContent aRecord, |
|
177 const THomeZoneCacheId aCacheId ); |
|
178 |
|
179 /** |
|
180 * This function is called internally when adding a CityZone |
|
181 * cache item in cache. |
|
182 * |
|
183 * @param aRecord A Record to be added |
|
184 * @return Result code. |
|
185 */ |
|
186 TInt DoInsertInCityZoneCache( |
|
187 const RMmCustomAPI::TViagCacheRecordContent aRecord ); |
|
188 |
|
189 /** |
|
190 * This function is called internally for find empty slot |
|
191 * from a cache, |
|
192 * |
|
193 * @param aCacheId Source cache |
|
194 * @return Result code. |
|
195 */ |
|
196 TInt FindNullEntry( const THomeZoneCacheId aCacheId ); |
|
197 |
|
198 /** |
|
199 * This function is called for setting object internal status |
|
200 * |
|
201 * @param aStatus New status |
|
202 * @return None |
|
203 */ |
|
204 void SetInitialisingStatus( |
|
205 const TInitializingStatus aStatus ); |
|
206 |
|
207 |
|
208 public: // From MNWNetworkEFReaderObserver |
|
209 |
|
210 /** |
|
211 * This function is called when Cache is ready for reading. |
|
212 * |
|
213 * @return None |
|
214 * |
|
215 */ |
|
216 void ReadCbCacheSync( TInt aStatus ); |
|
217 |
|
218 |
|
219 private: |
|
220 // Custom API for SIM activities. |
|
221 RMmCustomAPI& iCustomAPI; // Uses only |
|
222 |
|
223 // Caches |
|
224 RArray<RMmCustomAPI::TViagCacheRecordContent> iSimCache1; |
|
225 RArray<RMmCustomAPI::TViagCacheRecordContent> iSimCache2; |
|
226 RArray<RMmCustomAPI::TViagCacheRecordContent> iSimCache3; |
|
227 RArray<RMmCustomAPI::TViagCacheRecordContent> iDynCache; |
|
228 // Internal status |
|
229 TInitializingStatus iInitialisingStatus; |
|
230 // Observer to notify |
|
231 MHZCachesInitialisationObserver * iObserver; |
|
232 // Cache Reader |
|
233 CNWNetworkEFReader * iSimCacheMonitor; |
|
234 }; |
|
235 |
|
236 #endif // CNWNETWORKHZCACHEHANDLER_H |
|
237 |
|
238 // End of File |