|
1 /* |
|
2 * Copyright (c) 2007-2008 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: |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef C_HNMDSERVICEHANDLER_H |
|
20 #define C_HNMDSERVICEHANDLER_H |
|
21 |
|
22 //#include <mnaiwservices.h> |
|
23 #include <liwcommon.h> |
|
24 #include <e32base.h> |
|
25 #include <xmlengelement.h> |
|
26 |
|
27 #include "hnglobals.h" |
|
28 |
|
29 class CLiwServiceHandler; |
|
30 class CHnMdQuery; |
|
31 class CLiwGenericParamList; |
|
32 class MLiwInterface; |
|
33 class CLiwDefaultMap; |
|
34 class CHnMdBaseKey; |
|
35 class CHnMdServiceCommand; |
|
36 class CHnServiceHandler; |
|
37 |
|
38 /** |
|
39 * Class represeting request to LIW service. |
|
40 * The request can be synchronous or asynchronous. |
|
41 * |
|
42 * @since S60 5.0 |
|
43 * @ingroup group_hnutilities |
|
44 */ |
|
45 NONSHARABLE_CLASS(CHnServiceHandler) : public CBase, public MLiwNotifyCallback |
|
46 { |
|
47 public: |
|
48 |
|
49 /** |
|
50 * Two-phase constructor. |
|
51 * |
|
52 * @since S60 5.0 |
|
53 * @param aService Service name. |
|
54 * @param aInterface Interface name. |
|
55 * @param aCommand Request to the Service. |
|
56 * @param aMode Asynchronous or Synchronous Request. |
|
57 * @param aConstructor Parameters used during Service construction. |
|
58 * @param aServiceCommand Additional Parameters for the Request. |
|
59 * @return Fully cosntructed object. |
|
60 */ |
|
61 IMPORT_C static CHnServiceHandler* NewL( |
|
62 const TDesC8& aService, const TDesC8& aInterface, |
|
63 const TDesC8& aCommand, TServiceMode aMode, |
|
64 CLiwGenericParamList* aConstructor, |
|
65 CLiwGenericParamList* aServiceCommand ); |
|
66 |
|
67 /** |
|
68 * Two-phase constructor. |
|
69 * |
|
70 * @since S60 5.0 |
|
71 * @param aService Service name. |
|
72 * @param aInterface Interface name. |
|
73 * @param aCommand Request to the Service. |
|
74 * @param aMode Asynchronous or Synchronous Request. |
|
75 * @param aConstructor Parameters used during Service construction. |
|
76 * @param aServiceCommand Additional Parameters for the Request. |
|
77 * @return Fully cosntructed object. |
|
78 */ |
|
79 IMPORT_C static CHnServiceHandler* NewLC( |
|
80 const TDesC8& aService, const TDesC8& aInterface, |
|
81 const TDesC8& aCommand, TServiceMode aMode, |
|
82 CLiwGenericParamList* aConstructor, |
|
83 CLiwGenericParamList* aServiceCommand ); |
|
84 |
|
85 /** |
|
86 * Standard C++ virtual destructor. |
|
87 * |
|
88 * @since S60 5.0 |
|
89 */ |
|
90 IMPORT_C virtual ~CHnServiceHandler(); |
|
91 |
|
92 /** |
|
93 * Executes the Request on the service. |
|
94 * |
|
95 * since S60 v5.0 |
|
96 * @param aOutParamList Request outcome. |
|
97 * @param aStatus Status for signalling when request completes. |
|
98 * @return Error code. |
|
99 */ |
|
100 IMPORT_C TInt ExecuteL( CLiwGenericParamList& aOutParamList, TRequestStatus& aStatus ); |
|
101 |
|
102 /** |
|
103 * Executes the query on the service, with external |
|
104 * notification callback. |
|
105 * |
|
106 * since S60 v5.0 |
|
107 * @param aCallback Notification callback. |
|
108 * @param aCmdOptions Additional options for the Request. |
|
109 * @return Error code. |
|
110 */ |
|
111 IMPORT_C TInt ExecuteL( MLiwNotifyCallback* aCallback, |
|
112 TInt aCmdOptions = 0 ); |
|
113 |
|
114 |
|
115 /** |
|
116 * Executes the query on the service. |
|
117 * Deprecated - Do not Use this method!!!! Will be removed asap. |
|
118 * |
|
119 * since S60 v5.0 |
|
120 * @return Error code. |
|
121 */ |
|
122 IMPORT_C TInt ExecuteL(); |
|
123 |
|
124 private: |
|
125 |
|
126 /** |
|
127 * Standard C++ constructor. |
|
128 * |
|
129 * @since S60 5.0 |
|
130 * @param aMode Synchronous or asynchronous. |
|
131 */ |
|
132 CHnServiceHandler( TServiceMode aMode ); |
|
133 |
|
134 |
|
135 /** |
|
136 * Standard symbian 2nd phase contructor. |
|
137 * |
|
138 * @since S60 5.0 |
|
139 * @param aService Service name. |
|
140 * @param aInterface Interface name. |
|
141 * @param aCommandName Request to the Service. |
|
142 * @param aConstructor Parameters used during Service construction. |
|
143 * @param aServiceCommand Additional Parameters for the Request. |
|
144 */ |
|
145 void ConstructL( |
|
146 const TDesC8& aService, const TDesC8& aInterface, |
|
147 const TDesC8& aCommandName, |
|
148 CLiwGenericParamList* aConstructor, |
|
149 CLiwGenericParamList* aServiceCommand ); |
|
150 |
|
151 |
|
152 /** |
|
153 * Handles notifications caused by an asynchronous Request. |
|
154 * |
|
155 * @param aCmdId The service command associated to the event. |
|
156 * @param aEventId Occured event, see LiwCommon.hrh. |
|
157 * @param aEventParamList Event parameters, if any, as defined per |
|
158 * each event. |
|
159 * @param aInParamList Input parameters, if any, given in the |
|
160 * related HandleCommmandL. |
|
161 * @return Error code for the callback. |
|
162 */ |
|
163 TInt HandleNotifyL( |
|
164 TInt aCmdId, |
|
165 TInt aEventId, |
|
166 CLiwGenericParamList& aEventParamList, |
|
167 const CLiwGenericParamList& aInParamList); |
|
168 |
|
169 /** |
|
170 * Creates interface. |
|
171 * |
|
172 * @param aConstructor constructor |
|
173 * @return Error code. |
|
174 */ |
|
175 TInt SetServiceInterfaceL( CLiwGenericParamList* aConstructor ); |
|
176 |
|
177 private: // data |
|
178 |
|
179 /** |
|
180 * Service name. |
|
181 * Own. |
|
182 */ |
|
183 RBuf8 iServiceName; |
|
184 |
|
185 /** |
|
186 * Interface name. |
|
187 * Own. |
|
188 */ |
|
189 RBuf8 iInterfaceName; |
|
190 |
|
191 /** |
|
192 * Command (Request) name. |
|
193 * Own. |
|
194 */ |
|
195 RBuf8 iCommandName; |
|
196 |
|
197 /** |
|
198 * Service mode. |
|
199 */ |
|
200 TServiceMode iMode; |
|
201 |
|
202 /** |
|
203 * Stores input parameters (not data) of the service search method\ |
|
204 * (ExecuteServiceCmdL). |
|
205 * Own. |
|
206 */ |
|
207 CLiwGenericParamList* iConstructor; |
|
208 |
|
209 /** |
|
210 * |
|
211 * Own. |
|
212 */ |
|
213 CLiwGenericParamList* iCommand; |
|
214 |
|
215 /** |
|
216 * Parameters for the Request. |
|
217 * Own. |
|
218 */ |
|
219 CLiwGenericParamList* iInput; |
|
220 |
|
221 /** |
|
222 * Request results from ExecuteL(); |
|
223 * Own. |
|
224 */ |
|
225 CLiwGenericParamList* iOutputForAS; |
|
226 |
|
227 /** |
|
228 * Request results from |
|
229 * ExecuteL( CLiwGenericParamList& aOutParamList, TRequestStatus& aStatus ). |
|
230 * Own. |
|
231 */ |
|
232 CLiwGenericParamList* iOutputForAO; |
|
233 |
|
234 /** |
|
235 * Service interface. |
|
236 */ |
|
237 MLiwInterface* iServiceInterface; |
|
238 |
|
239 /** |
|
240 * Service Handler. |
|
241 * Own. |
|
242 */ |
|
243 CLiwServiceHandler* iServiceHandler; |
|
244 |
|
245 /** |
|
246 * Client status. |
|
247 * Not Own. |
|
248 */ |
|
249 TRequestStatus* iClientStatus; |
|
250 |
|
251 /** |
|
252 * Waits for asynchronous queries. |
|
253 * Own. |
|
254 */ |
|
255 CActiveSchedulerWait* iWait; |
|
256 |
|
257 }; |
|
258 |
|
259 #endif // C_HNMDSERVICEHANDLER_H |