5
|
1 |
/*
|
|
2 |
* Copyright (c) 2005-2006 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 the License "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: CLandmarkInterface class
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
|
|
19 |
#ifndef __LANDMARKINTERFACE_H__
|
|
20 |
#define __LANDMARKINTERFACE_H__
|
|
21 |
|
|
22 |
//INCLUDES
|
|
23 |
#include <e32def.h>
|
|
24 |
#include <e32base.h>
|
|
25 |
#include <liwvariant.h>
|
|
26 |
|
|
27 |
//FORWARD DECLARATION
|
|
28 |
class CLandmarkService;
|
|
29 |
class CLandmarkObserver;
|
|
30 |
class CLandmarkCallbackMap;
|
|
31 |
|
|
32 |
/**
|
|
33 |
* CLandmarkInterface
|
|
34 |
* This class inherits from MLiwInterface and implements the
|
|
35 |
* ExecuteCmdL( const TDesC8& aCmdName,
|
|
36 |
* const CLiwGenericParamList& aInParamList,
|
|
37 |
* CLiwGenericParamList& aOutParamList, TUint aCmdOptions = 0,
|
|
38 |
* MLiwNotifyCallback* aCallback = 0) and
|
|
39 |
* Close() functions. The member functions of this class parses the input parameters,
|
|
40 |
* constructs proper structures and calls the corresponding service class functions
|
|
41 |
* based on the input arguments.
|
|
42 |
*/
|
|
43 |
// CLASS DECLARATION
|
|
44 |
NONSHARABLE_CLASS(CLandmarkInterface): public CBase, public MLiwInterface
|
|
45 |
{
|
|
46 |
public:
|
|
47 |
/**
|
|
48 |
* TParamIndex
|
|
49 |
* Specifies whether the id passed is a landmark id or a category id.
|
|
50 |
*/
|
|
51 |
enum TParamIndex
|
|
52 |
{
|
|
53 |
EIndex0 = 0,
|
|
54 |
EIndex1,
|
|
55 |
EIndex2,
|
|
56 |
EIndex3
|
|
57 |
};
|
|
58 |
|
|
59 |
public://New Methods
|
|
60 |
|
|
61 |
/**
|
|
62 |
* NewL.
|
|
63 |
* Two-phased constructor.
|
|
64 |
* Create a CLandmarkInterface object.
|
|
65 |
* @return A pointer to the created instance of CLandmarkInterface.
|
|
66 |
*/
|
|
67 |
static CLandmarkInterface* NewL();
|
|
68 |
|
|
69 |
public: // from MLiwInterface
|
|
70 |
|
|
71 |
// The consumer application should call this method to execute a service
|
|
72 |
// command directly on the interface. The service provider should
|
|
73 |
// provide a concrete implementation for the supported service
|
|
74 |
// command aCmdName. The consumer application should fill in the necessary
|
|
75 |
// parameters in \em aInParamList.
|
|
76 |
|
|
77 |
void ExecuteCmdL( const TDesC8& aCmdName,
|
|
78 |
const CLiwGenericParamList& aInParamList,
|
|
79 |
CLiwGenericParamList& aOutParamList, TUint aCmdOptions = 0,
|
|
80 |
MLiwNotifyCallback* aCallback = 0);
|
|
81 |
|
|
82 |
// The service provider should provide a concrete implementation
|
|
83 |
// for this method. The internal state of the service provider
|
|
84 |
// implemeting \c MLiwInterface can be reset within this method.
|
|
85 |
// The consumer application should call this method if there
|
|
86 |
// are no more service commands to be executed on the interface.
|
|
87 |
void Close();
|
|
88 |
|
|
89 |
/**
|
|
90 |
* Callback
|
|
91 |
* This function returns the callback for the corresponding asynchronous request whose
|
|
92 |
* transaction id is passed.
|
|
93 |
*
|
|
94 |
* @param aTransactionId Transaction id of asynchronous request whose callback is required..
|
|
95 |
* @return The callback of the asynchronous request.
|
|
96 |
*/
|
|
97 |
MLiwNotifyCallback* Callback( TInt32 aTransactionId );
|
|
98 |
|
|
99 |
/**
|
|
100 |
* SetActiveL
|
|
101 |
* This function sets the requested database to active. The URI of the database should
|
|
102 |
* be passed in the input parameter list.
|
|
103 |
*
|
|
104 |
* @param aInParamList the input parameter list.
|
|
105 |
*/
|
|
106 |
void SetActiveL( const CLiwGenericParamList& aInParamList );
|
|
107 |
|
|
108 |
/**
|
|
109 |
* SapiError
|
|
110 |
* This function maps sapi error.
|
|
111 |
*
|
|
112 |
* @param aSymbianErr symbian error code.
|
|
113 |
*
|
|
114 |
*/
|
|
115 |
TInt SapiError ( TInt aSymbianErr );
|
|
116 |
|
|
117 |
private:
|
|
118 |
|
|
119 |
/**
|
|
120 |
* ConstructL
|
|
121 |
* 2nd phase constructor.
|
|
122 |
* Perform the second phase construction of CLandmarkInterface object.
|
|
123 |
*/
|
|
124 |
void ConstructL();
|
|
125 |
|
|
126 |
/**
|
|
127 |
* C++ default constructor.
|
|
128 |
* By default Symbian OS constructor is private.
|
|
129 |
*/
|
|
130 |
CLandmarkInterface();
|
|
131 |
|
|
132 |
/**
|
|
133 |
* ~CLandmarkInterface
|
|
134 |
* Destructor.
|
|
135 |
*/
|
|
136 |
~CLandmarkInterface();
|
|
137 |
|
|
138 |
private:// delegator functions
|
|
139 |
|
|
140 |
/**
|
|
141 |
* SwitchCmdL
|
|
142 |
* This function delegates the control to other functions based on the command.
|
|
143 |
*
|
|
144 |
* @param aCmdName the name of the service command which the consumer wants to invoke.
|
|
145 |
* @param aInParamList the input parameter list.
|
|
146 |
* @param [in,out] aOutParamList the output parameter list, can be empty list or may contain the errors.
|
|
147 |
* @param aCmdOptions Options for the command, see TLiwServiceCmdOptions in LiwCommon.hrh.
|
|
148 |
* @param aCallback callback to be registered by consumer application
|
|
149 |
*
|
|
150 |
*
|
|
151 |
*
|
|
152 |
* @see TLiwServiceCmdOptions
|
|
153 |
* @see CLiwGenericParamList
|
|
154 |
* @see MLiwNotifyCallback
|
|
155 |
*
|
|
156 |
*/
|
|
157 |
void SwitchCmdL( const TDesC8& aCmdName,
|
|
158 |
const CLiwGenericParamList& aInParamList,
|
|
159 |
CLiwGenericParamList& aOutParamList, TUint aCmdOptions,
|
|
160 |
MLiwNotifyCallback* aCallback );
|
|
161 |
|
|
162 |
/**
|
|
163 |
* GetListL
|
|
164 |
* This function delegates the control to other functions based on the
|
|
165 |
* content type of the object requested for retrieval.
|
|
166 |
*
|
|
167 |
* @param aInParamList the input parameter list. This is parsed and appropriate
|
|
168 |
* functions are called based on the type of item to be retrieved (KContentType).
|
|
169 |
* @param [in,out] aOutParamList the output parameter list, may contain an iterable instance, an error or be empty.
|
|
170 |
* @param aCmdOptions Options for the command, see TLiwServiceCmdOptions in LiwCommon.hrh.
|
|
171 |
* @param aCallback callback to be registered by consumer application
|
|
172 |
*
|
|
173 |
*
|
|
174 |
*
|
|
175 |
* @see TLiwServiceCmdOptions
|
|
176 |
* @see CLiwGenericParamList
|
|
177 |
* @see MLiwNotifyCallback
|
|
178 |
*
|
|
179 |
*/
|
|
180 |
void GetListL( const CLiwGenericParamList& aInParamList,
|
|
181 |
CLiwGenericParamList& aOutParamList, TUint aCmdOptions,
|
|
182 |
MLiwNotifyCallback* aCallback );
|
|
183 |
|
|
184 |
/**
|
|
185 |
* AddL
|
|
186 |
* This function delegates the control to other functions based on the
|
|
187 |
* content type of the object requested for addition to database.
|
|
188 |
*
|
|
189 |
* @param aInParamList the input parameter list. This is parsed and appropriate
|
|
190 |
* functions are called based on the type of item to be added (KContentType).
|
|
191 |
* @param [in,out] aOutParamList the output parameter list, may contain the iterable instance.
|
|
192 |
* @param aCmdOptions Options for the command, see TLiwServiceCmdOptions in LiwCommon.hrh.
|
|
193 |
* @param aCallback callback to be registered by consumer application
|
|
194 |
*
|
|
195 |
*
|
|
196 |
*
|
|
197 |
* @see TLiwServiceCmdOptions
|
|
198 |
* @see CLiwGenericParamList
|
|
199 |
* @see MLiwNotifyCallback
|
|
200 |
*
|
|
201 |
*/
|
|
202 |
void AddL( const CLiwGenericParamList& aInParamList,
|
|
203 |
CLiwGenericParamList& aOutParamList, TUint aCmdOptions,
|
|
204 |
MLiwNotifyCallback* aCallback );
|
|
205 |
|
|
206 |
/**
|
|
207 |
* RemoveL
|
|
208 |
* This function deletes an item from database based on the type of item.
|
|
209 |
*
|
|
210 |
* @param aInParamList the input parameter list. This contains the details about the item to be removed.
|
|
211 |
* @param [in,out] aOutParamList the output parameter list, is an empty list.
|
|
212 |
* @param aCmdOptions Options for the command, see TLiwServiceCmdOptions in LiwCommon.hrh.
|
|
213 |
* @param aCallback callback to be registered by consumer application
|
|
214 |
*
|
|
215 |
*
|
|
216 |
*
|
|
217 |
* @see TLiwServiceCmdOptions
|
|
218 |
* @see CLiwGenericParamList
|
|
219 |
* @see MLiwNotifyCallback
|
|
220 |
*
|
|
221 |
*/
|
|
222 |
void RemoveL( const CLiwGenericParamList& aInParamList,
|
|
223 |
CLiwGenericParamList& aOutParamList, TUint aCmdOptions,
|
|
224 |
MLiwNotifyCallback* aCallback );
|
|
225 |
|
|
226 |
/**
|
|
227 |
* ImportL
|
|
228 |
* This function imports landmarks from a file to the database.
|
|
229 |
*
|
|
230 |
* @param aInParamList the input parameter list.
|
|
231 |
* @param [in,out] aOutParamList the output parameter list, may contain the iterable instance.
|
|
232 |
* @param aCmdOptions Options for the command, see TLiwServiceCmdOptions in LiwCommon.hrh.
|
|
233 |
* @param aCallback callback to be registered by consumer application
|
|
234 |
*
|
|
235 |
*
|
|
236 |
*
|
|
237 |
* @see TLiwServiceCmdOptions
|
|
238 |
* @see CLiwGenericParamList
|
|
239 |
* @see MLiwNotifyCallback
|
|
240 |
*
|
|
241 |
*/
|
|
242 |
void ImportL( const CLiwGenericParamList& aInParamList,
|
|
243 |
CLiwGenericParamList& aOutParamList, TUint aCmdOptions,
|
|
244 |
MLiwNotifyCallback* aCallback );
|
|
245 |
|
|
246 |
/**
|
|
247 |
* ExportL
|
|
248 |
* This function exports a set of landmarks from database to a file.
|
|
249 |
*
|
|
250 |
* @param aInParamList the input parameter list.
|
|
251 |
* @param [in,out] aOutParamList the output parameter list, is an empty list.
|
|
252 |
* @param aCmdOptions Options for the command, see TLiwServiceCmdOptions in LiwCommon.hrh.
|
|
253 |
* @param aCallback callback to be registered by consumer application
|
|
254 |
*
|
|
255 |
*
|
|
256 |
*
|
|
257 |
* @see TLiwServiceCmdOptions
|
|
258 |
* @see CLiwGenericParamList
|
|
259 |
* @see MLiwNotifyCallback
|
|
260 |
*
|
|
261 |
*/
|
|
262 |
void ExportL( const CLiwGenericParamList& aInParamList,
|
|
263 |
CLiwGenericParamList& aOutParamList, TUint aCmdOptions,
|
|
264 |
MLiwNotifyCallback* aCallback );
|
|
265 |
|
|
266 |
/**
|
|
267 |
* OrganiseL
|
|
268 |
* This function links/unlinks a landmark category to a set of landmarks.
|
|
269 |
*
|
|
270 |
* @param aInParamList the input parameter list.
|
|
271 |
* @param [in,out] aOutParamList the output parameter list, is an empty list.
|
|
272 |
* @param aCmdOptions Options for the command, see TLiwServiceCmdOptions in LiwCommon.hrh.
|
|
273 |
* @param aCallback callback to be registered by consumer application
|
|
274 |
*
|
|
275 |
*
|
|
276 |
*
|
|
277 |
* @see TLiwServiceCmdOptions
|
|
278 |
* @see CLiwGenericParamList
|
|
279 |
* @see MLiwNotifyCallback
|
|
280 |
*
|
|
281 |
*/
|
|
282 |
void OrganiseL( const CLiwGenericParamList& aInParamList,
|
|
283 |
CLiwGenericParamList& aOutParamList, TUint aCmdOptions,
|
|
284 |
MLiwNotifyCallback* aCallback );
|
|
285 |
|
|
286 |
/**
|
|
287 |
* Cancel
|
|
288 |
* This function cancels a previously requested aynchronous request
|
|
289 |
* based on transaction id.
|
|
290 |
*
|
|
291 |
* @param aInParamList the input parameter list.
|
|
292 |
* @param [in,out] aOutParamList the output parameter list, is an empty list.
|
|
293 |
* @param aCmdOptions Options for the command, see TLiwServiceCmdOptions in LiwCommon.hrh.
|
|
294 |
* @param aCallback callback to be registered by consumer application
|
|
295 |
*
|
|
296 |
*
|
|
297 |
*
|
|
298 |
* @see TLiwServiceCmdOptions
|
|
299 |
* @see CLiwGenericParamList
|
|
300 |
* @see MLiwNotifyCallback
|
|
301 |
*
|
|
302 |
*/
|
|
303 |
void Cancel( const CLiwGenericParamList& aInParamList,
|
|
304 |
CLiwGenericParamList& aOutParamList, TUint aCmdOptions,
|
|
305 |
MLiwNotifyCallback* aCallback );
|
|
306 |
|
|
307 |
/**
|
|
308 |
* NewTemplateL
|
|
309 |
* This function returns a template of the requested type.
|
|
310 |
*
|
|
311 |
* @param aInParamList the input parameter list.
|
|
312 |
* @param [in,out] aOutParamList the output parameter list, contains the template and error code.
|
|
313 |
* @param aCmdOptions Options for the command, see TLiwServiceCmdOptions in LiwCommon.hrh.
|
|
314 |
* @param aCallback callback to be registered by consumer application
|
|
315 |
*
|
|
316 |
*
|
|
317 |
*
|
|
318 |
* @see TLiwServiceCmdOptions
|
|
319 |
* @see CLiwGenericParamList
|
|
320 |
* @see MLiwNotifyCallback
|
|
321 |
*
|
|
322 |
*/
|
|
323 |
void NewTemplateL( const CLiwGenericParamList& aInParamList,
|
|
324 |
CLiwGenericParamList& aOutParamList, TUint aCmdOptions,
|
|
325 |
MLiwNotifyCallback* aCallback );
|
|
326 |
|
|
327 |
private:// helper functions
|
|
328 |
|
|
329 |
/**
|
|
330 |
* GetLandmarksL
|
|
331 |
* This function retrieves a set of landmarks based on a filter.
|
|
332 |
*
|
|
333 |
* @param aInParamList the input parameter list.
|
|
334 |
* @param [in,out] aOutParamList the output parameter list, may contain the iterable instance.
|
|
335 |
* @param aCmdOptions Options for the command, see TLiwServiceCmdOptions in LiwCommon.hrh.
|
|
336 |
* @param aCallback callback to be registered by consumer application
|
|
337 |
*
|
|
338 |
*
|
|
339 |
*
|
|
340 |
* @see TLiwServiceCmdOptions
|
|
341 |
* @see CLiwGenericParamList
|
|
342 |
* @see MLiwNotifyCallback
|
|
343 |
*
|
|
344 |
*/
|
|
345 |
void GetLandmarksL( const CLiwGenericParamList& aInParamList,
|
|
346 |
CLiwGenericParamList& aOutParamList, TUint aCmdOptions,
|
|
347 |
MLiwNotifyCallback* aCallback );
|
|
348 |
|
|
349 |
/**
|
|
350 |
* GetCategoriesL
|
|
351 |
* This function retrieves a set of landmark categories based on a filter.
|
|
352 |
*
|
|
353 |
* @param aInParamList the input parameter list.
|
|
354 |
* @param [in,out] aOutParamList the output parameter list, may contain the iterable instance.
|
|
355 |
* @param aCmdOptions Options for the command, see TLiwServiceCmdOptions in LiwCommon.hrh.
|
|
356 |
* @param aCallback callback to be registered by consumer application
|
|
357 |
*
|
|
358 |
*
|
|
359 |
*
|
|
360 |
* @see TLiwServiceCmdOptions
|
|
361 |
* @see CLiwGenericParamList
|
|
362 |
* @see MLiwNotifyCallback
|
|
363 |
*
|
|
364 |
*/
|
|
365 |
void GetCategoriesL( const CLiwGenericParamList& aInParamList,
|
|
366 |
CLiwGenericParamList& aOutParamList, TUint aCmdOptions,
|
|
367 |
MLiwNotifyCallback* aCallback );
|
|
368 |
|
|
369 |
/**
|
|
370 |
* GetListDatabasesL
|
|
371 |
* This function retrieves a set of landmark databases based on a filter.
|
|
372 |
*
|
|
373 |
* @param aInParamList the input parameter list.
|
|
374 |
* @param [in,out] aOutParamList may contain the iterable instance.
|
|
375 |
*
|
|
376 |
* @see CLiwGenericParamList
|
|
377 |
*
|
|
378 |
*/
|
|
379 |
void GetListDatabasesL (const CLiwGenericParamList& aInParams,
|
|
380 |
CLiwGenericParamList& aOutParamList );
|
|
381 |
|
|
382 |
/**
|
|
383 |
* AddLandmarksL
|
|
384 |
* This function adds a landmark to a landmark database.
|
|
385 |
*
|
|
386 |
* @param aInParamList the input parameter list.
|
|
387 |
*
|
|
388 |
* @see CLiwGenericParamList
|
|
389 |
*
|
|
390 |
*/
|
|
391 |
void AddLandmarksL( const CLiwGenericParamList& aInParamList,
|
|
392 |
CLiwGenericParamList& aOutParamList );
|
|
393 |
|
|
394 |
/**
|
|
395 |
* AddCategoryL
|
|
396 |
* This function adds a landmark category to a landmark database.
|
|
397 |
*
|
|
398 |
* @param aInParamList the input parameter list.
|
|
399 |
*
|
|
400 |
* @see CLiwGenericParamList
|
|
401 |
*
|
|
402 |
*/
|
|
403 |
void AddCategoryL ( const CLiwGenericParamList& aInParamList,
|
|
404 |
CLiwGenericParamList& aOutParamList );
|
|
405 |
|
|
406 |
/**
|
|
407 |
* AddDatabaseL
|
|
408 |
* This function adds a landmark database.
|
|
409 |
*
|
|
410 |
* @param aInParamList the input parameter list.
|
|
411 |
*
|
|
412 |
* @see CLiwGenericParamList
|
|
413 |
*
|
|
414 |
*/
|
|
415 |
void AddDatabaseL ( const CLiwGenericParamList& aInParams );
|
|
416 |
|
|
417 |
void ErrorMessageL( const TDesC8& aServiceCmd, const TDesC8& aKey );
|
|
418 |
|
|
419 |
void ValidateParamL( const TDesC8& aServiceCmd,
|
|
420 |
const TDesC8& aKey,
|
|
421 |
const TLiwVariant& aVariant,
|
|
422 |
LIW::TVariantTypeId aType );
|
|
423 |
|
|
424 |
TBool ValidateParamL( const TDesC8& aServiceCmd,
|
|
425 |
const TDesC8& aKey,
|
|
426 |
const CLiwMap* aMap,
|
|
427 |
LIW::TVariantTypeId aType,
|
|
428 |
TBool isMandatory,
|
|
429 |
TLiwVariant& aOutVariant );
|
|
430 |
|
|
431 |
private:// Data
|
|
432 |
|
|
433 |
/**
|
|
434 |
* iService
|
|
435 |
* The handle to the CLandmarkService object.
|
|
436 |
*/
|
|
437 |
CLandmarkService* iService;
|
|
438 |
|
|
439 |
/**
|
|
440 |
* iObserver
|
|
441 |
* MLandmarkObserver instance.
|
|
442 |
*/
|
|
443 |
CLandmarkObserver* iObserver;
|
|
444 |
|
|
445 |
/**
|
|
446 |
* iCallbackMap
|
|
447 |
* Array of CLandmarkCallbackMap objects.
|
|
448 |
*/
|
|
449 |
RPointerArray<CLandmarkCallbackMap> iCallbackMap;
|
|
450 |
|
|
451 |
/**
|
|
452 |
* iErrMsg
|
|
453 |
* The pointer to the error message.
|
|
454 |
*/
|
|
455 |
HBufC* iErrMsg;
|
|
456 |
|
|
457 |
/**
|
|
458 |
* iId
|
|
459 |
* The id of the added/modified landmark/category.
|
|
460 |
*/
|
|
461 |
HBufC* iId;
|
|
462 |
};
|
|
463 |
|
|
464 |
#endif // __LANDMARKINTERFACE_H__
|