|
1 /* |
|
2 * Copyright (c) 2002-2005 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: Operation for initializing a landmark database. |
|
15 * |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 |
|
21 #ifndef CPOSLMLOCALINITIALIZEOP_H |
|
22 #define CPOSLMLOCALINITIALIZEOP_H |
|
23 |
|
24 #include <EPos_CPosLmOperation.h> |
|
25 #include <epos_poslmservercommon.h> |
|
26 #include "EPos_TPosOperationStatus.h" |
|
27 |
|
28 class CPosLmLocalDatabase; |
|
29 |
|
30 /** |
|
31 * Operation for initializing a landmark database. This operation can be |
|
32 * either synchronous or asynchronous. |
|
33 * |
|
34 * @lib eposlmlocalaccess.lib |
|
35 */ |
|
36 NONSHARABLE_CLASS(CPosLmLocalInitializeOp) : public CPosLmOperation |
|
37 { |
|
38 |
|
39 public: // Constructors and destructor |
|
40 |
|
41 /** |
|
42 * Two-phased constructor. |
|
43 * @param[in] aDb A landmark database. |
|
44 */ |
|
45 static CPosLmLocalInitializeOp* NewL( CPosLmLocalDatabase& aDb ); |
|
46 |
|
47 virtual ~CPosLmLocalInitializeOp(); |
|
48 |
|
49 public: // Data types |
|
50 |
|
51 /** |
|
52 * Specifies the type of the initialize operation. |
|
53 */ |
|
54 enum TInitializeType |
|
55 { |
|
56 EInitialize = 0, |
|
57 ELangSwitch = 1, |
|
58 EIndexBuild = 2, |
|
59 ERecover = 4 |
|
60 }; |
|
61 |
|
62 public: // From CPosLmOperation. |
|
63 |
|
64 /* |
|
65 * This function sends an asynchronous message to the Landmarks Server. |
|
66 * Upon the first call to this function, the server starts to initialize |
|
67 * the database. The server then continues to initialize the database |
|
68 * even if this function is never called again. Subsequent calls to this |
|
69 * function will report progress. |
|
70 * |
|
71 * @param[out] aStatus The request status. Will be completed when the step |
|
72 * has been performed. The request status will be @p KRequestPending |
|
73 * if the step has not completed. It will be |
|
74 * @p KPosLmOperationNotComplete if the step has completed but more |
|
75 * steps are needed before the operation has finished, The request |
|
76 * status will be @p KErrNone if the operation has finished |
|
77 * successfully. The status will be set to an error code if the |
|
78 * operation has failed. |
|
79 * @param[out] aProgress Will be set to he progress of the operation when the |
|
80 * step has finished. |
|
81 */ |
|
82 void NextStep( TRequestStatus& aStatus, TReal32& aProgress ); |
|
83 |
|
84 /** |
|
85 * Synchonous execution of the database initialization. |
|
86 * When this function returns, the operation has finished. |
|
87 */ |
|
88 void ExecuteL(); |
|
89 |
|
90 private: |
|
91 |
|
92 /** |
|
93 * C++ default constructor. |
|
94 * @param[in] aDb A landmark db. |
|
95 */ |
|
96 CPosLmLocalInitializeOp( CPosLmLocalDatabase& aDb ); |
|
97 |
|
98 void ConstructL(); |
|
99 |
|
100 void CompleteRequest(TRequestStatus& aStatus, TInt aReason); |
|
101 |
|
102 // Prohibit copy constructor if not deriving from CBase. |
|
103 CPosLmLocalInitializeOp(const CPosLmLocalInitializeOp&); |
|
104 // Prohibit assigment operator if not deriving from CBase. |
|
105 CPosLmLocalInitializeOp& operator=(const CPosLmLocalInitializeOp&); |
|
106 |
|
107 private: // Data |
|
108 |
|
109 // Landmark database (no ownership). |
|
110 CPosLmLocalDatabase* iDb; |
|
111 |
|
112 // Init type |
|
113 TInitializeType iInitType; |
|
114 |
|
115 TBool iInitNotNeeded; |
|
116 |
|
117 TPosOperationStatus iOperationStatus; |
|
118 |
|
119 // Receive package for the status |
|
120 TPckgBuf<TInt> iStatusPckg; |
|
121 |
|
122 // Receive package for the progress |
|
123 TPckg<TReal32>* iProgressPckg; |
|
124 |
|
125 TPckg<TUint>* iInitFlagPckg; |
|
126 TUint* iInitFlag; |
|
127 }; |
|
128 |
|
129 #endif // CPOSLMLOCALINITIALIZEOP_H |
|
130 |