|
1 /* |
|
2 * Copyright (c) 2003-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: Declares common constants, types, classes etc. to be used both |
|
15 * consumer and provider side. |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 |
|
21 |
|
22 |
|
23 #ifndef AIW_COMMON_H |
|
24 #define AIW_COMMON_H |
|
25 |
|
26 // INCLUDES |
|
27 #include <AiwCommon.hrh> |
|
28 #include <barsread.h> |
|
29 #include <AiwGenericParam.h> |
|
30 |
|
31 // CONSTANTS |
|
32 |
|
33 // MACROS |
|
34 |
|
35 // FUNCTION PROTOTYPES |
|
36 |
|
37 // FORWARD DECLARATIONS |
|
38 class CEikMenuPane; |
|
39 class CAiwGenericParamList; |
|
40 |
|
41 // CLASS DECLARATION |
|
42 |
|
43 /** |
|
44 * Criteria item data. |
|
45 * This class encapsulates an AIW criteria item. Criteria items are building |
|
46 * blocks for AIW interests, i.e. an interest is a list of criteria items. |
|
47 * A criteria item can be defined dynamically (by using this class) or |
|
48 * in a resource file. |
|
49 * |
|
50 * @lib ServiceHandler.lib |
|
51 * @since Series 60 2.6 |
|
52 */ |
|
53 class CAiwCriteriaItem : public CBase |
|
54 { |
|
55 public: // Constructors and destructor |
|
56 /** |
|
57 * Constructs a criteria item instance with null items. |
|
58 * |
|
59 * @return A pointer to the new object. |
|
60 */ |
|
61 IMPORT_C static CAiwCriteriaItem* NewL(); |
|
62 |
|
63 /** |
|
64 * Constructs a criteria item instance with null items. Leaves the |
|
65 * pointer to the cleanup stack. |
|
66 * |
|
67 * @return A pointer to the new object. |
|
68 */ |
|
69 IMPORT_C static CAiwCriteriaItem* NewLC(); |
|
70 |
|
71 /** |
|
72 * Constructs a criteria item instance. |
|
73 * |
|
74 * @param aCriteriaId The criteria ID. |
|
75 * @param aServiceCmd The service command. |
|
76 * @param aContentType The content type. |
|
77 * @return A pointer to the new object. |
|
78 */ |
|
79 IMPORT_C static CAiwCriteriaItem* NewL( |
|
80 TInt aCriteriaId, |
|
81 TInt aServiceCmd, |
|
82 const TDesC8& aContentType); |
|
83 |
|
84 /** |
|
85 * Constructs a criteria item instance. Leaves the pointer to the |
|
86 * cleanup stack. |
|
87 * |
|
88 * @param aCriteriaId The criteria ID. |
|
89 * @param aServiceCmd The service command. |
|
90 * @param aContentType The content type. |
|
91 * @return A pointer to the new object. |
|
92 */ |
|
93 IMPORT_C static CAiwCriteriaItem* NewLC( |
|
94 TInt aCriteriaId, |
|
95 TInt aServiceCmd, |
|
96 const TDesC8& aContentType); |
|
97 |
|
98 /** |
|
99 * Destructor. |
|
100 */ |
|
101 IMPORT_C virtual ~CAiwCriteriaItem(); |
|
102 |
|
103 public: // New functions |
|
104 /** |
|
105 * Sets the criteria ID. |
|
106 * |
|
107 * @param aId The criteria ID. |
|
108 */ |
|
109 IMPORT_C void SetId(TInt aId); |
|
110 |
|
111 /** |
|
112 * Sets the service class. |
|
113 * |
|
114 * @param aServiceUid The service class, see TAiwServiceClass. |
|
115 */ |
|
116 IMPORT_C void SetServiceClass(const TUid& aServiceUid); |
|
117 |
|
118 /** |
|
119 * Sets the service command UID. |
|
120 * |
|
121 * @param aServiceCmd The AIW service command, see TAiwServiceCommands. |
|
122 */ |
|
123 IMPORT_C void SetServiceCmd(TInt aServiceCmd); |
|
124 |
|
125 /** |
|
126 * Sets the content type. Makes a copy of the string data. |
|
127 * |
|
128 * @param aContentType Content MIME type, event type or any agreed one. |
|
129 */ |
|
130 IMPORT_C void SetContentTypeL(const TDesC8& aContentType); |
|
131 |
|
132 /** |
|
133 * Gets the criteria ID, 0 if not defined. |
|
134 * |
|
135 * @return The criteria ID. |
|
136 */ |
|
137 IMPORT_C TInt Id() const; |
|
138 |
|
139 /** |
|
140 * Gets the service class UID. |
|
141 * |
|
142 * @return The service class UID, see TAiwServiceClass. |
|
143 */ |
|
144 IMPORT_C const TUid& ServiceClass() const; |
|
145 |
|
146 /** |
|
147 * Gets the service command UID. KNullUid, if not defined. |
|
148 * |
|
149 * @return The service command UID, see TAiwServiceCommands. |
|
150 */ |
|
151 IMPORT_C TInt ServiceCmd() const; |
|
152 |
|
153 /** |
|
154 * Gets the content type. |
|
155 * |
|
156 * @return The content type. |
|
157 */ |
|
158 IMPORT_C const TDesC8& ContentType() const; |
|
159 |
|
160 /** |
|
161 * Sets the options. |
|
162 * |
|
163 * @param aOptions Options. |
|
164 */ |
|
165 IMPORT_C void SetOptions(TUint aOptions); |
|
166 |
|
167 /** |
|
168 * Gets the options. |
|
169 * |
|
170 * @return Options. |
|
171 */ |
|
172 IMPORT_C TUint Options() const; |
|
173 |
|
174 /** |
|
175 * Maximum number of providers allowed for this criteria item. |
|
176 * |
|
177 * @return Maximum number of providers allowed for this criteria item. |
|
178 */ |
|
179 IMPORT_C TInt MaxProviders() const; |
|
180 |
|
181 /** |
|
182 * Reads a criteria item from a resource. |
|
183 * |
|
184 * @param aReader A resource reader pointing to a criteria item. |
|
185 */ |
|
186 IMPORT_C void ReadFromResoureL(TResourceReader& aReader); |
|
187 |
|
188 /** |
|
189 * Returns the default provider. |
|
190 * |
|
191 * @return The default provider UID. |
|
192 */ |
|
193 IMPORT_C TUid DefaultProvider() const; |
|
194 |
|
195 /** |
|
196 * Sets the default provider. |
|
197 * |
|
198 * @param aDefault The UID of a default provider. |
|
199 */ |
|
200 IMPORT_C void SetDefaultProvider(TInt aDefault); |
|
201 |
|
202 /** |
|
203 * Equality operator. Two criteria items are considered equal only if all |
|
204 * parameters match. The parameters are: criteria id, service command, |
|
205 * content type, service class, default provider, max providers and options). |
|
206 * |
|
207 * @param aItem Criteria item to compare. |
|
208 * @return ETrue if criteria items are equal, EFalse otherwise. |
|
209 */ |
|
210 IMPORT_C TBool operator==(const CAiwCriteriaItem& aItem); |
|
211 |
|
212 /** |
|
213 * Sets the maximum number of providers. |
|
214 * |
|
215 * @param aMaxProviders The maximum number of providers. |
|
216 */ |
|
217 IMPORT_C void SetMaxProviders(TInt aMaxProviders); |
|
218 |
|
219 public: |
|
220 /** |
|
221 * If set, only ROM based providers can be attached to this criteria. |
|
222 * |
|
223 * @return ETrue if AIW_OPTIONS_ROM_ONLY bit is set, EFalse otherwise. |
|
224 */ |
|
225 inline TBool RomOnly() const; |
|
226 |
|
227 private: |
|
228 /** |
|
229 * C++ default constructor. |
|
230 */ |
|
231 CAiwCriteriaItem(); |
|
232 |
|
233 /** |
|
234 * By default Symbian 2nd phase constructor is private. |
|
235 */ |
|
236 void ConstructL(); |
|
237 |
|
238 /** |
|
239 * By default Symbian 2nd phase constructor is private. |
|
240 */ |
|
241 void ConstructL( |
|
242 TInt aCriteriaId, |
|
243 TInt aServiceCmd, |
|
244 const TDesC8& aContentType); |
|
245 |
|
246 private: |
|
247 // Criteria ID. |
|
248 TInt iCriteriaId; |
|
249 // Service class UID |
|
250 TUid iServiceClass; |
|
251 // Service command UID |
|
252 TInt iServiceCmd; |
|
253 // Content type (MIME type). |
|
254 HBufC8* iContentType; |
|
255 // Additional options |
|
256 TAiwVariant iOptions; |
|
257 //Default provider implementation uid |
|
258 TUid iDefaultProvider; |
|
259 // Reserved member |
|
260 TAiwVariant iReserved; |
|
261 // Max providers |
|
262 TInt iMaxProviders; |
|
263 }; |
|
264 |
|
265 |
|
266 inline TBool CAiwCriteriaItem::RomOnly() const |
|
267 { |
|
268 return (Options() & AIW_OPTIONS_ROM_ONLY) != 0; |
|
269 } |
|
270 |
|
271 |
|
272 /** |
|
273 * Interest is an array of criteria items. |
|
274 */ |
|
275 typedef RPointerArray<CAiwCriteriaItem> RCriteriaArray; |
|
276 |
|
277 /** |
|
278 * Abstract callback interface to handle callbacks or events |
|
279 * from providers. This callback is needed when |
|
280 * - Consumer wants to pre-check output parameters before returning |
|
281 * synchronous Handle*Cmd. |
|
282 * - Asynchronous Handle*Cmd is used. |
|
283 * - An asynchronous event occurs in the system. |
|
284 * |
|
285 * @lib ServiceHandler.lib |
|
286 * @since Series 60 2.6 |
|
287 */ |
|
288 class MAiwNotifyCallback |
|
289 { |
|
290 public: |
|
291 /** |
|
292 * Handles notifications caused by an asynchronous Execute*CmdL call |
|
293 * or an event. |
|
294 * |
|
295 * @param aCmdId The service command associated to the event. |
|
296 * @param aEventId Occured event, see AiwCommon.hrh. |
|
297 * @param aEventParamList Event parameters, if any, as defined per |
|
298 * each event. |
|
299 * @param aInParamList Input parameters, if any, given in the |
|
300 * related HandleCommmandL. |
|
301 * @return Error code for the callback. |
|
302 */ |
|
303 virtual TInt HandleNotifyL( |
|
304 TInt aCmdId, |
|
305 TInt aEventId, |
|
306 CAiwGenericParamList& aEventParamList, |
|
307 const CAiwGenericParamList& aInParamList) = 0; |
|
308 }; |
|
309 |
|
310 #endif // AIW_COMMON_H |
|
311 |
|
312 // End of File |
|
313 |
|
314 |