1 /* |
|
2 * Copyright (c) 2007 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: Location Centre Server object. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef C_LCREGISTRY_H |
|
20 #define C_LCREGISTRY_H |
|
21 |
|
22 |
|
23 // SYSTEM INCLUDES |
|
24 #include <e32base.h> |
|
25 #include <f32file.h> |
|
26 |
|
27 //USER INCLUDE |
|
28 #include "lcregistrationupdatenotifier.h" |
|
29 #include "lcipcparams.h" |
|
30 |
|
31 // FORWARD DECLARATIONS |
|
32 class MLcRegistryObserver; |
|
33 class CLcRegistrationParser; |
|
34 class CLcRegistryUpdate; |
|
35 class CLcRegAppOrder; |
|
36 class CLcRegAppInfo; |
|
37 class CLcRegAppStore; |
|
38 class RApaLsSession; |
|
39 |
|
40 /** |
|
41 * Location Centre server's registration handler. |
|
42 * |
|
43 * This class is inherited from CActive and MLcRegistryUpdateNotifier. This |
|
44 * class handles all the basic logic(dynamic and static registration handling). |
|
45 * |
|
46 * @since S60 v5.0 |
|
47 */ |
|
48 class CLcRegistry : public CActive, |
|
49 public MLcRegistryUpdateNotifier |
|
50 { |
|
51 public: |
|
52 /** |
|
53 * Constructs a new instance of CLcRegistry. |
|
54 * |
|
55 * @return The new instance of CLcRegistry object. |
|
56 * @leave System wide error code if the object creation fails. |
|
57 */ |
|
58 static CLcRegistry* NewL( MLcRegistryObserver& aRegistryObserver ); |
|
59 |
|
60 /** |
|
61 * Constructs a new instance of CLcRegistry. |
|
62 * Leaves the created instance on the cleanup stack. |
|
63 * |
|
64 * @return The new instance of CLcRegistry object. |
|
65 * @leave System wide error code if the object creation fails. |
|
66 */ |
|
67 static CLcRegistry* NewLC( MLcRegistryObserver& aRegistryObserver ); |
|
68 |
|
69 /** |
|
70 * C++ Destructor. |
|
71 * Frees all the resources associated with this Location Centre |
|
72 * server registry handler |
|
73 */ |
|
74 virtual ~CLcRegistry(); |
|
75 |
|
76 |
|
77 public: //interface method from MLcRegistryUpdateNotifier |
|
78 /** |
|
79 * |
|
80 */ |
|
81 void HandleDynamicRegistrationL( ); |
|
82 |
|
83 |
|
84 public: //interface to be called by other class |
|
85 /** |
|
86 * This function retuns all the present registered service |
|
87 * like application/document/webservice to le server engine |
|
88 * |
|
89 * @since S60 v5.0 |
|
90 * @param appInfoArray[ out ] contains array of registration app info pointer |
|
91 * @return If no application is registered return KErrNotFound. |
|
92 */ |
|
93 TInt GetAllRegisteredAppsList( RPointerArray<CLcAppInfo>& appInfoArray); |
|
94 |
|
95 /** |
|
96 * This function find the corresponding app info |
|
97 * with respect to incomming application Uuid. |
|
98 * |
|
99 * @since S60 v5.0 |
|
100 * @param aAppSid[ in ] |
|
101 * @param aLcRegAppInfo[ out ] |
|
102 * @return If the app info related to this Uuid is not found return KErrNotFound |
|
103 */ |
|
104 TInt GetApplicationInfo( const TDesC& aAppUid, |
|
105 CLcBasicAppInfo*& aLcRegAppInfo ); |
|
106 |
|
107 |
|
108 private: |
|
109 /** |
|
110 * C++ Default constructor |
|
111 */ |
|
112 CLcRegistry( MLcRegistryObserver& aRegistryObserver ); |
|
113 |
|
114 /** |
|
115 * Second phase of the two phase constructor |
|
116 */ |
|
117 void ConstructL(); |
|
118 |
|
119 |
|
120 private: // From CActive |
|
121 /** |
|
122 * Inherited from CActive |
|
123 */ |
|
124 void RunL(); |
|
125 |
|
126 /** |
|
127 * Inherited from CActive |
|
128 */ |
|
129 void DoCancel(); |
|
130 |
|
131 /** |
|
132 * Inherited from CActive |
|
133 */ |
|
134 TInt RunError( TInt aError ); |
|
135 |
|
136 private: |
|
137 /** |
|
138 * This function checks wheather any update is needed |
|
139 * to already stored registered appinfo list.If it is then |
|
140 * start the system drive scan and update registered app info accordingly |
|
141 * |
|
142 * @since S60 v5.0 |
|
143 * @param None. |
|
144 * @return None. |
|
145 */ |
|
146 void CheckForUpdationL(); |
|
147 |
|
148 /** |
|
149 * This function scan all the system drives which are |
|
150 * mounted at present in the system and collects all |
|
151 * the registered file names present in the location centre's private |
|
152 * directory. |
|
153 * |
|
154 * @since S60 v5.0 |
|
155 * @param None. |
|
156 * @return None. |
|
157 */ |
|
158 void ScanDrivesAndGetFileNameL(); |
|
159 |
|
160 /** |
|
161 * Validate Application/Document through appshell/doc handler. |
|
162 * |
|
163 * @since S60 v5.0 |
|
164 * @param aLcRegAppInfo [ in ] Pointer to regappinfo. |
|
165 * @return None |
|
166 */ |
|
167 void ValidateRegisteredServiceL(CLcRegAppInfo& aApplicationInfo ); |
|
168 |
|
169 /** |
|
170 * This function notifies registration server engine that |
|
171 * processing of all the registration file has been done successfully. |
|
172 * |
|
173 * @since S60 v5.0 |
|
174 * @param None. |
|
175 * @return None. |
|
176 */ |
|
177 void FinalRegistrationUpdateL(); |
|
178 |
|
179 /** |
|
180 * Issue a request to Active scheduler. |
|
181 * |
|
182 * @since S60 v5.0 |
|
183 * @param None. |
|
184 * @return None. |
|
185 */ |
|
186 void IssueRequest(); |
|
187 |
|
188 /** |
|
189 * Get the current MMC Id for the device. |
|
190 * |
|
191 * @since S60 v5.0 |
|
192 * @param aUid [out] It holds current MMC id of the terminal. |
|
193 * @return Return system error if not executed successfully |
|
194 * else return KErrNone. |
|
195 */ |
|
196 TInt GetMmcId( TUint& aUid ); |
|
197 |
|
198 /** |
|
199 * This function parse a registration file and return the |
|
200 * CLcRegAppInfo* and then it validates the application |
|
201 * or document and fetch the order and finally append this |
|
202 * CLcRegAppInfo to appinfo array. |
|
203 * |
|
204 * @since S60 v5.0 |
|
205 * @param aLcRegAppInfo Pointer reference to regappinfo. |
|
206 * @return KErrBadName if the regappinfo file name is not correct one. |
|
207 */ |
|
208 CLcRegAppInfo* CreateAppRegInfoL( TFileName aFileName ); |
|
209 |
|
210 /** |
|
211 * This function insert single registration info into |
|
212 * app info array in specific order.Order is fetched for |
|
213 * preinstalled application from central repository and for |
|
214 * post installation as registration/deregistration order. |
|
215 * |
|
216 * @since S60 v5.0 |
|
217 * @param aLcRegAppInfo [ in ] Pointer to regappinfo. |
|
218 * @return None |
|
219 */ |
|
220 void InsertAppRegInfoL( CLcRegAppInfo* aAppInfo ); |
|
221 |
|
222 /** |
|
223 * This function checks wheather certain registration file |
|
224 * is present in the removable media like MMC. |
|
225 * |
|
226 * @since S60 v5.0 |
|
227 * @param aFileName[ in ] Name of the file to check if in MMC. |
|
228 * @return If file is in MMC then return ETrue else EFalse. |
|
229 */ |
|
230 TBool IsInMMc( TFileName aFileName ); |
|
231 |
|
232 /** |
|
233 * This function checks presence for a certain registration file |
|
234 * in the stored app info array and return the corresponding app info |
|
235 * |
|
236 * @since S60 v5.0 |
|
237 * @param aFileName[ in ] Name of the file to check if |
|
238 * present in old list. |
|
239 * @param alcRegAppInfoPtr[ out ] filled the appropriate reg app |
|
240 * info to this pointer. |
|
241 * @return On successfull |
|
242 * execution return ETrue else EFalse. |
|
243 */ |
|
244 TBool DoesApplicationExists( TFileName aFileName, |
|
245 CLcRegAppInfo*& alcRegAppInfoPtr ); |
|
246 |
|
247 /** |
|
248 * Find the content type from file useing content recognizer |
|
249 * |
|
250 * @since S60 v5.0 |
|
251 * @param aDownload[ in ] The actual download. |
|
252 * @param aContentType[ out ] The mime type |
|
253 * @param aApplicationInfo[ in ] The application info ptr. |
|
254 */ |
|
255 void FindContentTypeFromFileL( RApaLsSession apaSession, |
|
256 TUint8*& aContentTypeString, |
|
257 CLcRegAppInfo* aApplicationInfo ); |
|
258 |
|
259 /** |
|
260 * Checks wheather same UUID based service is already |
|
261 * present in the current registered app info array. |
|
262 * |
|
263 * @since S60 v5.0 |
|
264 * @param aLcRegAppInfo The application info ptr. |
|
265 */ |
|
266 TBool DoesSameUuidPresent( CLcRegAppInfo* aLcRegAppInfo ); |
|
267 |
|
268 /** |
|
269 * This function compare time stamp between two registration |
|
270 * info and return ETrue if same or EFalse. |
|
271 * |
|
272 * @since S60 v5.0 |
|
273 * @param aFileName[ in ] Name of the current file to compare. |
|
274 * @return ETrue else EFalse. |
|
275 */ |
|
276 TBool IsAppUpgraded( TFileName aFileName ); |
|
277 |
|
278 /** |
|
279 * This function sets name for certains application name |
|
280 * if it is not provided with the registration file |
|
281 * |
|
282 * @since S60 v5.0 |
|
283 * @param appInfo[ in ] Pointer to registration info |
|
284 * needs to fetch application caption name. |
|
285 */ |
|
286 void SetAbsentAppNameL( CLcRegAppInfo* aAppInfo ); |
|
287 |
|
288 /** |
|
289 * This function checks registered service type |
|
290 * like application/service/webservice.If it is an application |
|
291 * then the function fetches it's exe's full path and if it |
|
292 * is document takes it's application data and if it is weburl |
|
293 * then takes it's regiatration file and according to presence of |
|
294 * above mentioned fles presence in ROM or else where set the system |
|
295 * characteristics. |
|
296 * |
|
297 * @since S60 v5.0 |
|
298 * @param alsSession[ in ] Reference to RApaLsSession. |
|
299 * @param aAppInfo[ in ] Reference to application info. |
|
300 */ |
|
301 void SetAppSysCharacteristicsL( RApaLsSession& alsSession, |
|
302 CLcRegAppInfo& aAppInfo ); |
|
303 |
|
304 |
|
305 private: // Data members |
|
306 /** |
|
307 * Array of current Location Centre application information objects. |
|
308 * Owns |
|
309 */ |
|
310 RPointerArray<CLcRegAppInfo> iAppInfoArray; |
|
311 |
|
312 /** |
|
313 * Array of intermediate Location Centre application information objects. |
|
314 * Owns |
|
315 */ |
|
316 RPointerArray<CLcRegAppInfo> iAppInfoNewArray; |
|
317 |
|
318 //Own:File server reference. |
|
319 RFs iFs; |
|
320 |
|
321 //Reference to observer class. |
|
322 MLcRegistryObserver& iRegistryObserver; |
|
323 |
|
324 //contains the list of registered file names |
|
325 RArray<TFileName> iFileNameArry; |
|
326 |
|
327 //own:pointer to registry update |
|
328 CLcRegistryUpdate* iLcRegUpdate; |
|
329 |
|
330 //own:pointer to registry app order settings class |
|
331 CLcRegAppOrder* iLcRegAppOrder; |
|
332 |
|
333 // Private srorage pointer |
|
334 CLcRegAppStore* iRegAppStore; |
|
335 |
|
336 // mentain the number of file count |
|
337 TInt iregFileCount; |
|
338 |
|
339 // boolean variable to decide registry updation start. |
|
340 TBool iRegistryHasToUpdate; |
|
341 }; |
|
342 |
|
343 #endif // C_LCREGISTRY_H |
|
344 |
|