|
1 /* |
|
2 * Copyright (c) 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: Content control server API definitions |
|
15 * |
|
16 */ |
|
17 |
|
18 #ifndef CCSRVAPI_H |
|
19 #define CCSRVAPI_H |
|
20 |
|
21 // System includes |
|
22 #include <e32base.h> |
|
23 |
|
24 // Forward declarations |
|
25 class RWriteStream; |
|
26 class RReadStream; |
|
27 |
|
28 // Constants |
|
29 |
|
30 // ---------------------------------------------------------------------------- |
|
31 // Content control server IPC functions |
|
32 // ---------------------------------------------------------------------------- |
|
33 enum TCcSrvIPCFunctions |
|
34 { |
|
35 ECcIPCFunctionBase = 0, |
|
36 // ---------------------------------------------------------------------------- |
|
37 // RegisterProvider |
|
38 // ---------------------------------------------------------------------------- |
|
39 // Purpose: |
|
40 // This request is used to register content control service provider |
|
41 // to content control server |
|
42 // |
|
43 // IPC parameters: |
|
44 // - Function: ECcReqisterProvider |
|
45 // - Arg[0]: Provider id (in), TInt |
|
46 // - Arg[1]: Registered provider address (out), TUint32 |
|
47 // - Arg[2]: Not used |
|
48 // - Arg[2]: Not used |
|
49 ECcReqisterProvider, |
|
50 // ---------------------------------------------------------------------------- |
|
51 // RegisterObserver |
|
52 // ---------------------------------------------------------------------------- |
|
53 // Purpose: |
|
54 // This request is used to register observer for content control service |
|
55 // provider |
|
56 // |
|
57 // IPC parameters: |
|
58 // - Function: ECcRegisterObserver |
|
59 // - Arg[0]: Provider id (in), TInt |
|
60 // - Arg[1]: Registered observer address (out), TUint32 |
|
61 // - Arg[2]: Not used |
|
62 // - Arg[2]: Not used |
|
63 ECcRegisterObserver, |
|
64 // ---------------------------------------------------------------------------- |
|
65 // WaitForApiReq |
|
66 // ---------------------------------------------------------------------------- |
|
67 // Purpose: |
|
68 // This request is used by content control service provider to receive |
|
69 // API requests |
|
70 // |
|
71 // IPC parameters: |
|
72 // - Function: ECcWaitForApiReq |
|
73 // - Arg[0]: Provider id (in), TInt |
|
74 // - Arg[1]: Provider address (in), TUint32 |
|
75 // - Arg[2]: API request sender address (out), TUint32 |
|
76 // - Arg[2]: API request header buffer (out), TPtr8 pointing to |
|
77 // HBufC8 descriptor |
|
78 ECcWaitForApiReq, |
|
79 // ---------------------------------------------------------------------------- |
|
80 // WaitForApiNtf |
|
81 // ---------------------------------------------------------------------------- |
|
82 // Purpose: |
|
83 // This request is used by observer of content control service provider to |
|
84 // receive content change notifications |
|
85 // |
|
86 // IPC parameters: |
|
87 // - Function: ECcWaitForApiNtf |
|
88 // - Arg[0]: Provider id (in), TInt |
|
89 // - Arg[1]: Observer address (out), TUint32 |
|
90 // - Arg[2]: Provider address (out), TUint32 |
|
91 // - Arg[2]: API notification header buffer (out), TPtr8 pointing to |
|
92 // HBufC8 descriptor |
|
93 ECcWaitForApiNtf, |
|
94 // ---------------------------------------------------------------------------- |
|
95 // ApiReq |
|
96 // ---------------------------------------------------------------------------- |
|
97 // Purpose: |
|
98 // This request is used to send a API request to the content control service |
|
99 // provider |
|
100 // |
|
101 // IPC parameters: |
|
102 // - Function: ECcApiReq |
|
103 // - Arg[0]: Provider id (in), TInt |
|
104 // - Arg[1]: API request sender address (out), TUint32 |
|
105 // - Arg[2]: Provider sender address (out), TUint32 |
|
106 // - Arg[2]: API request buffer (in)/API response header (out), |
|
107 // TPtr8 pointing to HBufC8 descriptor |
|
108 ECcApiReq, |
|
109 // ---------------------------------------------------------------------------- |
|
110 // ApiResp |
|
111 // ---------------------------------------------------------------------------- |
|
112 // Purpose: |
|
113 // This request is used to send a API response to the API request sender |
|
114 // |
|
115 // IPC parameters: |
|
116 // - Function: ECcApiResp |
|
117 // - Arg[0]: Provider id (in), TInt |
|
118 // - Arg[1]: Provider address (in), TUint32 |
|
119 // - Arg[2]: API response receiver address (in), TUint32 |
|
120 // - Arg[2]: API response buffer (in), TPtr8 pointing to HBufC8 descriptor |
|
121 ECcApiResp, |
|
122 // ---------------------------------------------------------------------------- |
|
123 // ApiNtf |
|
124 // ---------------------------------------------------------------------------- |
|
125 // Purpose: |
|
126 // This request is used to send a API notification |
|
127 // |
|
128 // IPC parameters: |
|
129 // - Function: ECcApiNtf |
|
130 // - Arg[0]: Provider id (in), TInt |
|
131 // - Arg[1]: Provider address (in), TUint32 |
|
132 // - Arg[2]: API notification receiver address (in), TUint32 |
|
133 // - Arg[2]: API notification buffer (in), |
|
134 // TPtr8 pointing to HBufC8 descriptor |
|
135 ECcApiNtf, |
|
136 // ---------------------------------------------------------------------------- |
|
137 // GetMsgData |
|
138 // ---------------------------------------------------------------------------- |
|
139 // Purpose: |
|
140 // This request is used to read message data |
|
141 // |
|
142 // IPC parameters: |
|
143 // - Function: ECcGetMsgData |
|
144 // - Arg[0]: Transaction id of a message which data is requested (in), TUint32 |
|
145 // - Arg[1]: Message data buffer (out), TPtr8 pointing to HBufC8 descriptor |
|
146 // - Arg[2]: None |
|
147 // - Arg[2]: None |
|
148 ECcGetMsgData, |
|
149 // ---------------------------------------------------------------------------- |
|
150 // Cancel |
|
151 // ---------------------------------------------------------------------------- |
|
152 // Purpose: |
|
153 // This request is used to cancel outstanding WaitForApiReq or |
|
154 // WaitForNotification request |
|
155 // |
|
156 // IPC parameters: |
|
157 // - Function: ECcCancel |
|
158 // - Arg[0]: Canceled IPC function (WaitForApiReq||WaitForNotification) |
|
159 // - Arg[1]: None |
|
160 // - Arg[2]: None |
|
161 // - Arg[2]: None |
|
162 ECcCancel, |
|
163 ECcNotSupported |
|
164 }; |
|
165 |
|
166 // ---------------------------------------------------------------------------- |
|
167 // Content control server message header |
|
168 // ---------------------------------------------------------------------------- |
|
169 // Items: |
|
170 // - Message id, TInt |
|
171 // - Transaction id, TInt |
|
172 // - Status, TInt |
|
173 // - Data size, TInt |
|
174 // Externalized message header size: |
|
175 const TInt KCcHeaderSize = 16; |
|
176 |
|
177 // ---------------------------------------------------------------------------- |
|
178 // Content control server messages |
|
179 // ---------------------------------------------------------------------------- |
|
180 enum TCcSrvMessages |
|
181 { |
|
182 ECcMessageBase, |
|
183 // ---------------------------------------------------------------------------- |
|
184 // RegisterObserverNtf |
|
185 // ---------------------------------------------------------------------------- |
|
186 // Purpose: |
|
187 // This notification is used to inform content provider of registerd observer |
|
188 // |
|
189 // Message parameters: |
|
190 // - Message id: EHsCcRegisterObserverNtf |
|
191 // - Transaction id: None |
|
192 // - Message data: None |
|
193 ECcRegisterObserverNtf, |
|
194 // ---------------------------------------------------------------------------- |
|
195 // UnregisterObserverNtf |
|
196 // ---------------------------------------------------------------------------- |
|
197 // Purpose: |
|
198 // This notification is used to inform content provider of unregisterd observer |
|
199 // |
|
200 // Message parameters: |
|
201 // - Message id: EHsCcUnregisterObserverNtf |
|
202 // - Transaction id: None |
|
203 // - Message data: None |
|
204 ECcUnregisterObserverNtf, |
|
205 // ---------------------------------------------------------------------------- |
|
206 // ProviderMessageBase |
|
207 // ---------------------------------------------------------------------------- |
|
208 // Purpose: |
|
209 // ProviderMessageBase is used to define the start of provider message ids |
|
210 // |
|
211 ECcProviderMessageBase |
|
212 }; |
|
213 |
|
214 /** |
|
215 * Content control server message |
|
216 * |
|
217 * |
|
218 * @code |
|
219 * |
|
220 * @endcode |
|
221 * |
|
222 * @lib ccsrvapi.lib |
|
223 * @since S60 v5.0 |
|
224 */ |
|
225 class CCcSrvMsg : public CBase |
|
226 { |
|
227 public: // Constructor and destructor |
|
228 /** |
|
229 * Two-phased constructor. |
|
230 */ |
|
231 IMPORT_C static CCcSrvMsg* NewL(); |
|
232 |
|
233 /** |
|
234 * Destructor. |
|
235 */ |
|
236 ~CCcSrvMsg(); |
|
237 |
|
238 private: // Constructors |
|
239 /** |
|
240 * Constructor |
|
241 */ |
|
242 CCcSrvMsg(); |
|
243 |
|
244 /** Second phase constructor */ |
|
245 void ConstructL(); |
|
246 |
|
247 |
|
248 public: // New functions |
|
249 /** |
|
250 * Returns pending request |
|
251 */ |
|
252 IMPORT_C RMessage2 Message(); |
|
253 |
|
254 /** |
|
255 * Stores pending request |
|
256 * @param aMessage Pending request |
|
257 */ |
|
258 IMPORT_C void SetMessage( RMessage2& aMessage ); |
|
259 |
|
260 /** |
|
261 * Returns IPC function |
|
262 */ |
|
263 IMPORT_C TInt Function(); |
|
264 |
|
265 /** |
|
266 * Stores IPC function |
|
267 * @param aFunction IPC function |
|
268 */ |
|
269 IMPORT_C void SetFunction( TInt aFunction ); |
|
270 |
|
271 /** |
|
272 * Returns sender of the message |
|
273 */ |
|
274 IMPORT_C TUint32 Sender(); |
|
275 |
|
276 /** |
|
277 * Stores sender of the message |
|
278 * @param aSender Message sender |
|
279 */ |
|
280 IMPORT_C void SetSender( TUint32 ); |
|
281 |
|
282 /** |
|
283 * Returns receiver of the message |
|
284 */ |
|
285 IMPORT_C TUint32 Receiver(); |
|
286 |
|
287 /** |
|
288 * Stores receiver of the message |
|
289 * @param aReceiver Message receiver |
|
290 */ |
|
291 IMPORT_C void SetReceiver( TUint32 ); |
|
292 |
|
293 /** |
|
294 * Returns message id |
|
295 */ |
|
296 IMPORT_C TUint32 MsgId(); |
|
297 |
|
298 /** |
|
299 * Stores message id |
|
300 * @param aMsgId Message id |
|
301 */ |
|
302 IMPORT_C void SetMsgId( TUint32 aMsgId ); |
|
303 |
|
304 /** |
|
305 * Returns transaction id |
|
306 */ |
|
307 IMPORT_C TUint32 TrId(); |
|
308 |
|
309 /** |
|
310 * Stores transaction id |
|
311 * @param aTrId Transaction id |
|
312 */ |
|
313 IMPORT_C void SetTrId( TUint32 aTrId ); |
|
314 |
|
315 /** |
|
316 * Returns message status |
|
317 */ |
|
318 IMPORT_C TInt Status(); |
|
319 |
|
320 /** |
|
321 * Stores message status |
|
322 * @param aStatus Transaction status |
|
323 */ |
|
324 IMPORT_C void SetStatus( TInt aStatus ); |
|
325 |
|
326 /** |
|
327 * Returns pointer to message data |
|
328 */ |
|
329 IMPORT_C TPtrC8 Data(); |
|
330 |
|
331 /** |
|
332 * Stores message data |
|
333 * @param aData Message data |
|
334 */ |
|
335 IMPORT_C void SetData( const TDesC8& aData ); |
|
336 |
|
337 /** |
|
338 * Returns message data size |
|
339 */ |
|
340 IMPORT_C TInt DataSize(); |
|
341 |
|
342 /** |
|
343 * Externalizes message (header and data) |
|
344 * @param aStream Write stream where message is externalized |
|
345 */ |
|
346 IMPORT_C void ExternalizeL( RWriteStream& aStream ); |
|
347 |
|
348 /** |
|
349 * Externalizes message header |
|
350 * @param aStream Write stream where message header is externalized |
|
351 */ |
|
352 IMPORT_C void ExternalizeHeaderL( RWriteStream& aStream ); |
|
353 |
|
354 /** |
|
355 * Internalizes message (header and data) |
|
356 * @param aStream Read stream where message is internalized |
|
357 */ |
|
358 IMPORT_C void InternalizeL( RReadStream& aStream ); |
|
359 |
|
360 /** |
|
361 * Internalizes message header |
|
362 * @param aStream Read stream where message header is internalized |
|
363 */ |
|
364 IMPORT_C void InternalizeHeaderL( RReadStream& aStream ); |
|
365 |
|
366 /** |
|
367 * Marshals message to a descrptor |
|
368 * @return Pointer to created descriptor |
|
369 */ |
|
370 IMPORT_C HBufC8* MarshalL(); |
|
371 |
|
372 private: // Data |
|
373 /** |
|
374 * Pending request |
|
375 */ |
|
376 RMessage2 iMessage; |
|
377 |
|
378 /** |
|
379 * IPC function |
|
380 */ |
|
381 TInt iFunction; |
|
382 |
|
383 /** |
|
384 * Sender |
|
385 */ |
|
386 TUint32 iSender; |
|
387 |
|
388 /** |
|
389 * Receiver |
|
390 */ |
|
391 TUint32 iReceiver; |
|
392 |
|
393 /** |
|
394 * Message id |
|
395 */ |
|
396 TUint32 iMsgId; |
|
397 |
|
398 /** |
|
399 * Transaction id |
|
400 */ |
|
401 TUint32 iTrId; |
|
402 |
|
403 /** |
|
404 * Operation status |
|
405 */ |
|
406 TInt iStatus; |
|
407 |
|
408 /** |
|
409 * Data size |
|
410 */ |
|
411 TInt iDataSize; |
|
412 |
|
413 /** |
|
414 * Data |
|
415 */ |
|
416 HBufC8* iData; |
|
417 |
|
418 }; |
|
419 |
|
420 |
|
421 #endif // CCSRVAPI_H |
|
422 |
|
423 // End of file |