|
1 /* |
|
2 * Copyright (c) 2005-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: Asynchronous query active object |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef __MDEASYNCHRONOUSFINDAO_H__ |
|
20 #define __MDEASYNCHRONOUSFINDAO_H__ |
|
21 |
|
22 // INCLUDE FILES |
|
23 #include <e32base.h> |
|
24 #include <e32svr.h> |
|
25 #include <badesca.h> |
|
26 |
|
27 #include <mdccommon.h> |
|
28 |
|
29 // forward declarations |
|
30 class CMdEQuery; |
|
31 class CMdESessionImpl; |
|
32 class RMdEEngineSession; |
|
33 class CMdEInstanceItem; |
|
34 class CMdEQueryCriteriaSerialization; |
|
35 |
|
36 /** |
|
37 * MdESessionMonitorAO |
|
38 * An abstract active object that is used for multiple purposes in |
|
39 * MdE client side. |
|
40 */ |
|
41 NONSHARABLE_CLASS(CMdEAsynchronousFindAO) : public CActive |
|
42 { |
|
43 public: // Constructors and destructors |
|
44 |
|
45 /** |
|
46 * NewL. |
|
47 * Two-phased constructor. |
|
48 * Creates a CCSAsyncRequestHandler object using two phase construction, |
|
49 * and return a pointer to the created object. |
|
50 * @param aSession The engine session |
|
51 * @param aType the query type |
|
52 * @return A pointer to the created instance of CCSAsyncRequestHandler. |
|
53 */ |
|
54 static CMdEAsynchronousFindAO* NewL( CMdEQuery& aQuery, |
|
55 CMdESessionImpl& aSessionImpl, RMdEEngineSession& aSession ); |
|
56 |
|
57 /** |
|
58 * NewL. |
|
59 * Two-phased constructor. |
|
60 * Creates a CCSAsyncRequestHandler object using two phase construction, |
|
61 * and return a pointer to the created object. |
|
62 * @param aSession The engine session |
|
63 * @param aType the query type |
|
64 * @return A pointer to the created instance of CCSAsyncRequestHandler. |
|
65 */ |
|
66 static CMdEAsynchronousFindAO* NewLC( CMdEQuery& aQuery, |
|
67 CMdESessionImpl& aSessionImpl, RMdEEngineSession& aSession ); |
|
68 |
|
69 /** |
|
70 * ~CCSAsyncRequestHandler. |
|
71 * Destructor. |
|
72 * Destroys the object and release all memory objects. |
|
73 */ |
|
74 virtual ~CMdEAsynchronousFindAO(); |
|
75 |
|
76 public: // New functions |
|
77 |
|
78 /** |
|
79 * Starts find |
|
80 */ |
|
81 void DoFindL( TUint aMaxCount, TUint aNotifyCount ); |
|
82 |
|
83 protected: // Functions from base classes |
|
84 |
|
85 /** |
|
86 * Calls notify results on CMdEQuery class (one of its subclasses) |
|
87 * @param aStatus the asynchronous find status |
|
88 */ |
|
89 void DoNotifyResultsL( TInt aStatus ); |
|
90 |
|
91 /** |
|
92 * Calls notify on CMdEQuery class (one of its subclasses) |
|
93 * @param aStatus the asynchronous find status |
|
94 */ |
|
95 void DoNotifyL( TBool aNewResults, TInt aStatus ); |
|
96 |
|
97 /** |
|
98 * From CActive |
|
99 * Callback function. |
|
100 * Invoked to handle responses from the server. |
|
101 */ |
|
102 void RunL(); |
|
103 |
|
104 /** |
|
105 * From CActive |
|
106 */ |
|
107 TInt RunError(TInt aError); |
|
108 |
|
109 /** |
|
110 * From CActive |
|
111 * Cancels any outstanding operation. |
|
112 */ |
|
113 void DoCancel(); |
|
114 |
|
115 private: // Constructors and destructors |
|
116 |
|
117 /** |
|
118 * CCSAsyncRequestHandler. |
|
119 * Performs the first phase of two phase construction. |
|
120 * @param aSession The engine session |
|
121 * @param aType the query type |
|
122 */ |
|
123 CMdEAsynchronousFindAO( CMdEQuery& aQuery, |
|
124 CMdESessionImpl& aSessionImpl, RMdEEngineSession& aSession ); |
|
125 |
|
126 /** |
|
127 * ConstructL. |
|
128 * Performs the second phase construction of a |
|
129 * CCSAsyncRequestHandler object. |
|
130 */ |
|
131 void ConstructL(); |
|
132 |
|
133 |
|
134 private: // Data |
|
135 |
|
136 /** the query object */ |
|
137 CMdEQuery& iQuery; |
|
138 |
|
139 /** The session impl class */ |
|
140 CMdESessionImpl& iSessionImpl; |
|
141 |
|
142 /** The engine session */ |
|
143 RMdEEngineSession& iSession; |
|
144 |
|
145 /** package that will receive result hierarchy size */ |
|
146 TPckgBuf<TInt> iResultSize; |
|
147 |
|
148 /** query results (stored here only temporarily) */ |
|
149 RPointerArray<CMdEInstanceItem> iResultList; |
|
150 |
|
151 /** ID query results (stored here only temporarily) */ |
|
152 RArray<TItemId> iIdResultList; |
|
153 |
|
154 /** Count query result */ |
|
155 TUint32 iCountResult; |
|
156 |
|
157 CMdEQueryCriteriaSerialization* iConditionBuffer; |
|
158 |
|
159 /** distinct query results (stored here only temporarily) */ |
|
160 CDesCArray* iDistinctResults; |
|
161 }; |
|
162 |
|
163 |
|
164 #endif //__MDEASYNCHRONOUSFINDAO_H__ |