|
1 /* |
|
2 * Copyright (c) 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: Domain, category, event and command definitions |
|
15 * |
|
16 */ |
|
17 |
|
18 #ifndef MEDIATORSERVEROBJECTS_H |
|
19 #define MEDIATORSERVEROBJECTS_H |
|
20 |
|
21 |
|
22 // INCLUDES |
|
23 #include <e32base.h> |
|
24 |
|
25 #include "MediatorCommon.h" |
|
26 #include "MediatorServiceDefs.h" |
|
27 #include "MediatorCommandTimer.h" |
|
28 |
|
29 // NAMESPACE |
|
30 using namespace MediatorService; |
|
31 |
|
32 // CONSTANTS |
|
33 |
|
34 // FORWARD DECLARATIONS |
|
35 class CDomain; |
|
36 class CCategory; |
|
37 class CItem; |
|
38 class CEvent; |
|
39 class CCommand; |
|
40 class MMediatorServerEventObserver; |
|
41 |
|
42 // DATA TYPES |
|
43 |
|
44 typedef CArrayFixFlat<CDomain> CDomainList; |
|
45 typedef CArrayFixFlat<CCategory> CCategoryList; |
|
46 typedef CArrayFixFlat<CItem> CItemList; |
|
47 |
|
48 // CLASS DECLARATION |
|
49 |
|
50 /** |
|
51 * An observer interface for receiving Mediator Service events. |
|
52 * |
|
53 * @since S60 3.1 |
|
54 */ |
|
55 class MMediatorServerEventObserver |
|
56 { |
|
57 public: // Event receiving |
|
58 |
|
59 /** |
|
60 * A Mediator Service event. |
|
61 * |
|
62 * @since S60 3.1 |
|
63 * @param aDomain The identifier of the domain. |
|
64 * @param aCategory The identifier of the category. |
|
65 * @param aEventId The identifier of the event. |
|
66 * @param aData The parameters of the event. |
|
67 * @return None. |
|
68 */ |
|
69 virtual void MediatorEventL( TUid aDomain, |
|
70 TUid aCategory, |
|
71 TInt aEventId, |
|
72 const TDesC8& aData ) = 0; |
|
73 }; |
|
74 |
|
75 |
|
76 /** |
|
77 * An observer interface for receiving Mediator Service commands. |
|
78 * |
|
79 * @since S60 3.1 |
|
80 */ |
|
81 class MMediatorCommandObserver |
|
82 { |
|
83 public: // Command handling |
|
84 |
|
85 /** |
|
86 * A Mediator Service command. |
|
87 * |
|
88 * @since S60 3.1 |
|
89 * @param aDomain The identifier of the domain |
|
90 * @param aCategory The identifier of the category. |
|
91 * @param aCommandId The identifier of the command. |
|
92 * @param aVersion The version information of the command. |
|
93 * @param aData The parameters of the command. |
|
94 * @return None. |
|
95 */ |
|
96 virtual void MediatorCommandL( TUid aDomain, |
|
97 TUid aCategory, |
|
98 TInt aCommandId, |
|
99 TVersion aVersion, |
|
100 const TDesC8& aData ) = 0; |
|
101 |
|
102 /** |
|
103 * Cancel a Mediator Service command. |
|
104 * |
|
105 * @since S60 3.1 |
|
106 * @param aDomain The identifier of the domain |
|
107 * @param aCategory The identifier of the category. |
|
108 * @param aCommandId The identifier of the command. |
|
109 * @return None. |
|
110 */ |
|
111 virtual void CancelMediatorCommandL( TUid aDomain, |
|
112 TUid aCategory, |
|
113 TInt aCommandId ) = 0; |
|
114 |
|
115 /** |
|
116 * Mediator command timeout has occurred |
|
117 * |
|
118 * @since S60 3.1 |
|
119 * @param aDomain The identifier of the domain |
|
120 * @param aCategory The identifier of the category. |
|
121 * @param aCommandId The identifier of the command. |
|
122 * @return None. |
|
123 */ |
|
124 virtual void MediatorCommandTimeoutL( TUid aDomain, |
|
125 TUid aCategory, |
|
126 TInt aCommandId ) = 0; |
|
127 }; |
|
128 |
|
129 /** |
|
130 * An observer interface for receiving responses to Mediator Service commands. |
|
131 * |
|
132 * @since S60 3.1 |
|
133 */ |
|
134 class MMediatorCommandResponseObserver |
|
135 { |
|
136 public: // Receiving responses |
|
137 |
|
138 /** |
|
139 * A response to a Mediator Service command. |
|
140 * |
|
141 * @since S60 3.1 |
|
142 * @param aDomain The identifier of the domain |
|
143 * @param aCategory The identifier of the category. |
|
144 * @param aCommandId The identifier of the command. |
|
145 * @param aStatus Standard Symbian error code indicating the |
|
146 * success of the command. |
|
147 * @param aData The parameters of the response. |
|
148 * @return None. |
|
149 */ |
|
150 virtual void CommandResponseL( TUid aDomain, |
|
151 TUid aCategory, |
|
152 TInt aCommandId, |
|
153 TInt aStatus, |
|
154 const TDesC8& aData ) = 0; |
|
155 }; |
|
156 |
|
157 /** |
|
158 * Class to contain domain information |
|
159 * |
|
160 * @since S60 3.1 |
|
161 */ |
|
162 class CDomain : public CBase |
|
163 { |
|
164 public: // Constructors and destructor |
|
165 |
|
166 /** |
|
167 * Two-phased constructor. |
|
168 * |
|
169 * @param aDomain identifier of the domain |
|
170 * @return a new CDomain instance |
|
171 */ |
|
172 static CDomain* NewL( TUid aDomain ); |
|
173 |
|
174 /** |
|
175 * Destructor. |
|
176 */ |
|
177 virtual ~CDomain(); |
|
178 |
|
179 public: // New functions |
|
180 |
|
181 /** |
|
182 * Getter for Domain UId |
|
183 * @since S60 3.1 |
|
184 * @param void |
|
185 * @return TUid indicating the UID of the domain |
|
186 */ |
|
187 TUid DomainUid() const; |
|
188 |
|
189 /** |
|
190 * Setter for Domain UId |
|
191 * @since S60 3.1 |
|
192 * @param aDomain identifier of the domain |
|
193 * @return None. |
|
194 */ |
|
195 void SetDomainUid( TUid aDomain ); |
|
196 |
|
197 /** |
|
198 * Adds category to domain |
|
199 * @since S60 3.1 |
|
200 * @param aNewCategory pointer to new category |
|
201 * @return None. |
|
202 */ |
|
203 void AddCategoryL( const CCategory* aNewCategory ); |
|
204 |
|
205 /** |
|
206 * Creates category according to UID and adds it to domain. |
|
207 * @since S60 3.1 |
|
208 * @param aCategory UID for the new category |
|
209 * @return CCategory pointer to new category. |
|
210 */ |
|
211 CCategory* AddCategoryL( const TUid aCategory ); |
|
212 |
|
213 /** |
|
214 * Removes category specified by UID |
|
215 * |
|
216 * @since S60 3.1 |
|
217 * @param aCategory UID for the category to be removed. |
|
218 * @return TInt indicating the success of the call. |
|
219 */ |
|
220 TInt RemoveCategory( const TUid aCategory ); |
|
221 |
|
222 /** |
|
223 * Gets reference to category specified by UID |
|
224 * @since S60 3.1 |
|
225 * @param aCategory UID of the category |
|
226 * @return CCategory pointer to category. NULL if not found. |
|
227 */ |
|
228 const CCategory* GetCategory( const TUid aCategory ); |
|
229 |
|
230 /** |
|
231 * Gets pointer to category specified by index |
|
232 * @since S60 3.1 |
|
233 * @param aIndex index to category array |
|
234 * @return CCategory pointer to category. NULL if not existing. |
|
235 */ |
|
236 CCategory* GetCategory( TInt aIndex ); |
|
237 |
|
238 /** |
|
239 * Returns count of categories within the domain. |
|
240 * @since S60 3.1 |
|
241 * @param none |
|
242 * @return TInt category count |
|
243 */ |
|
244 TInt CategoryCount(); |
|
245 |
|
246 /** |
|
247 * Finds category from the category list |
|
248 * @since S60 3.1 |
|
249 * @param aCategory identifying the category |
|
250 * @param aIndex reference to TInt where index is updated. |
|
251 * @return CCategory pointer to found category. NULL if not found. |
|
252 */ |
|
253 CCategory* FindCategory( const CCategory* aCategory, TInt& aIndex ); |
|
254 |
|
255 /** |
|
256 * Finds categorty from the category list. |
|
257 * @since S60 3.1 |
|
258 * @param aCategory identifying the category |
|
259 * @param aIndex reference to TInt where index is updated. |
|
260 * @return CCategory pointer to found category. NULL if not found. |
|
261 */ |
|
262 CCategory* FindCategory( const TUid aCategory, TInt& aIndex ); |
|
263 |
|
264 /** |
|
265 * Gets all categories within domain |
|
266 * @since S60 3.1 |
|
267 * @param aCategories list to registered categories |
|
268 * @return none |
|
269 */ |
|
270 void GetCategoriesL( RCategoryList& aCategories ); |
|
271 |
|
272 private: // New functions |
|
273 /** |
|
274 * Compares two categories according to their UIDs. User in array finds. |
|
275 * @since S60 3.1 |
|
276 * @param aLeftCategory reference to left category |
|
277 * @param aRightCategory reference to right category |
|
278 * @return TBool indicating if items are same or not. |
|
279 */ |
|
280 static TBool CompareCategories( const CCategory& aLeftCategory, |
|
281 const CCategory& aRightCategory ); |
|
282 |
|
283 private: |
|
284 /** |
|
285 * C++ default constructor. |
|
286 */ |
|
287 CDomain(); |
|
288 |
|
289 /** |
|
290 * By default Symbian 2nd phase constructor is private. |
|
291 * |
|
292 * @param aDomain identifier of the domain |
|
293 */ |
|
294 void ConstructL( TUid aDomain ); |
|
295 |
|
296 private: |
|
297 |
|
298 /** |
|
299 * UID of the domain |
|
300 */ |
|
301 TUid iDomain; |
|
302 |
|
303 /** |
|
304 * List of categories |
|
305 */ |
|
306 RPointerArray<CCategory> iCategoryList; |
|
307 |
|
308 /** |
|
309 * A helper object for searches. |
|
310 * Own. |
|
311 */ |
|
312 CCategory* iSearchCategory; |
|
313 }; |
|
314 |
|
315 /** |
|
316 * Class to contain category information |
|
317 * |
|
318 * @since S60 3.1 |
|
319 */ |
|
320 class CCategory : public CBase |
|
321 { |
|
322 public: // Constructors and destructor |
|
323 |
|
324 /** |
|
325 * Two-phased constructor. |
|
326 * |
|
327 * @param aCategory identifier of the category |
|
328 * @return a new CCategory instance |
|
329 */ |
|
330 static CCategory* NewL( TUid aCategory ); |
|
331 |
|
332 /** |
|
333 * Destructor. |
|
334 */ |
|
335 virtual ~CCategory(); |
|
336 |
|
337 public: // New functions |
|
338 |
|
339 /** |
|
340 * Getter for Category UId |
|
341 * @since S60 3.1 |
|
342 * @param void |
|
343 * @return TUid indicating the UID of the category |
|
344 */ |
|
345 TUid CategoryUid() const; |
|
346 |
|
347 /** |
|
348 * Setter for Category UId |
|
349 * @since S60 3.1 |
|
350 * @param aCategory identifier of the category |
|
351 * @return None |
|
352 */ |
|
353 void SetCategoryUid( TUid aCategory ); |
|
354 |
|
355 /** |
|
356 * Add new item to category |
|
357 * @since S60 3.1 |
|
358 * @param aNewItem pointer to new item |
|
359 * @return TInt indicating the success of the operation |
|
360 */ |
|
361 TInt AddEvent( const CEvent* aNewEvent ); |
|
362 |
|
363 /** |
|
364 * Add new command to category |
|
365 * @since S60 3.1 |
|
366 * @param aNewCommand pointer to new item |
|
367 * @return TInt indicating the success of the operation |
|
368 */ |
|
369 TInt AddCommand( const CCommand* aNewCommand ); |
|
370 |
|
371 /** |
|
372 * Removes event from the category specified by index |
|
373 * @since S60 3.1 |
|
374 * @param aIndex specifying the index of event |
|
375 * @return none |
|
376 */ |
|
377 void RemoveEvent( TInt aIndex ); |
|
378 |
|
379 /** |
|
380 * Removes command from the category specified by index |
|
381 * @since S60 3.1 |
|
382 * @param aIndex specifying the index of command |
|
383 * @return none |
|
384 */ |
|
385 void RemoveCommand( TInt aIndex ); |
|
386 |
|
387 /** |
|
388 * Returns pointer to event specified by event id |
|
389 * @since S60 3.1 |
|
390 * @param aId identifying the event |
|
391 * @param aIndex index of the found item. |
|
392 * @return CEvent pointer to found event. NULL if not existing. |
|
393 */ |
|
394 CEvent* FindEvent( const TInt aId, TInt& aIndex ); |
|
395 |
|
396 /** |
|
397 * Returns pointer to command specified by command id |
|
398 * @since S60 3.1 |
|
399 * @param aId identifying the command |
|
400 * @param aIndex index of the found item. |
|
401 * @return CCommand pointer to found command. NULL if not existing. |
|
402 */ |
|
403 CCommand* FindCommand( const TInt aId, TInt& aIndex ); |
|
404 |
|
405 /** |
|
406 * Returns pointer to event specified by index |
|
407 * @since S60 3.1 |
|
408 * @param aIndex index of the event. |
|
409 * @return CEvent pointer to event. NULL if not existing. |
|
410 */ |
|
411 CEvent* GetEvent( TInt aIndex ); |
|
412 |
|
413 /** |
|
414 * Returns pointer to command specified by index |
|
415 * @since S60 3.1 |
|
416 * @param aIndex index of the command. |
|
417 * @return CCommand pointer to command. NULL if not existing. |
|
418 */ |
|
419 CCommand* GetCommand( TInt aIndex ); |
|
420 |
|
421 /** |
|
422 * Updates event list to array. |
|
423 * @since S60 3.1 |
|
424 * @param aEvents list to registered events |
|
425 * @return none |
|
426 */ |
|
427 void GetEventsL( REventList& aEvents ); |
|
428 |
|
429 /** |
|
430 * Updates command list to array. |
|
431 * @since S60 3.1 |
|
432 * @param aCommands list to registered commands |
|
433 * @return none |
|
434 */ |
|
435 void GetCommandsL( RCommandList& aCommands ); |
|
436 |
|
437 /** |
|
438 * Gets event count |
|
439 * @since S60 3.1 |
|
440 * @return TInt count of events |
|
441 */ |
|
442 TInt EventCount(); |
|
443 |
|
444 /** |
|
445 * Gets command count |
|
446 * @since S60 3.1 |
|
447 * @return TInt count of commands |
|
448 */ |
|
449 TInt CommandCount(); |
|
450 |
|
451 /** |
|
452 * Commits the changes made to the command list. |
|
453 * @since S60 3.1 |
|
454 * @param None. |
|
455 * @return None. |
|
456 */ |
|
457 void CommitCommands(); |
|
458 |
|
459 /** |
|
460 * Rolls back the changes made to the command list. |
|
461 * @since S60 3.1 |
|
462 * @param None. |
|
463 * @return None. |
|
464 */ |
|
465 void RollbackCommands(); |
|
466 |
|
467 /** |
|
468 * Commits the changes made to the event list. |
|
469 * @since S60 3.1 |
|
470 * @param None. |
|
471 * @return None. |
|
472 */ |
|
473 void CommitEvents(); |
|
474 |
|
475 /** |
|
476 * Rolls back the changes made to the event list. |
|
477 * @since S60 3.1 |
|
478 * @param None. |
|
479 * @return None. |
|
480 */ |
|
481 void RollbackEvents(); |
|
482 |
|
483 private: // New functions |
|
484 /** |
|
485 * Finds event from the event list |
|
486 * @since S60 3.1 |
|
487 * @param aEvent reference to event to be searched |
|
488 * @return TInt indicating the index. KErrNotFound if event cannot be found |
|
489 */ |
|
490 TInt FindEvent( const CEvent& aEvent ); |
|
491 |
|
492 /** |
|
493 * Finds command from the command list |
|
494 * @since S60 3.1 |
|
495 * @param aCommand reference to command to be searched |
|
496 * @return TInt indicating the index. KErrNotFound if command cannot be found |
|
497 */ |
|
498 TInt FindCommand( const CCommand& aCommand ); |
|
499 |
|
500 /** |
|
501 * Compares two events according to their IDs. User in array finds. |
|
502 * @since S60 3.1 |
|
503 * @param aLeftEvent reference to left event |
|
504 * @param aRightEvent reference to right event |
|
505 * @return TBool indicating if events are same or not. |
|
506 */ |
|
507 static TBool CompareEvents( const CEvent& aLeftEvent, |
|
508 const CEvent& aRightEvent ); |
|
509 |
|
510 /** |
|
511 * Compares two commands according to their IDs. User in array finds. |
|
512 * @since S60 3.1 |
|
513 * @param aLeftCommand reference to left command |
|
514 * @param aRightCommand reference to right command |
|
515 * @return TBool indicating if commands are same or not. |
|
516 */ |
|
517 static TBool CompareCommands( const CCommand& aLeftCommand, |
|
518 const CCommand& aRightCommand ); |
|
519 |
|
520 private: |
|
521 /** |
|
522 * C++ default constructor. |
|
523 */ |
|
524 CCategory(); |
|
525 |
|
526 /** |
|
527 * By default Symbian 2nd phase constructor is private. |
|
528 * |
|
529 * @param aCategory identifier of the category |
|
530 */ |
|
531 void ConstructL( TUid aCategory ); |
|
532 |
|
533 private: |
|
534 /** |
|
535 * UID of the category |
|
536 */ |
|
537 TUid iCategory; |
|
538 |
|
539 /** |
|
540 * List of events included in category |
|
541 */ |
|
542 RPointerArray<CEvent> iEventList; |
|
543 |
|
544 /** |
|
545 * List of commands included in category |
|
546 */ |
|
547 RPointerArray<CCommand> iCommandList; |
|
548 |
|
549 /** |
|
550 * A helper command for seaches. Does not manage any other data than id. |
|
551 * Own. |
|
552 */ |
|
553 CCommand* iSearchCommand; |
|
554 |
|
555 /** |
|
556 * A helper event for seaches. Does not manage any other data than id. |
|
557 * Own. |
|
558 */ |
|
559 CEvent* iSearchEvent; |
|
560 }; |
|
561 |
|
562 /** |
|
563 * Class to contain item information (pure virtual) |
|
564 * |
|
565 * @since S60 3.1 |
|
566 */ |
|
567 class CItem : public CBase |
|
568 { |
|
569 public: // Constructors and destructor |
|
570 |
|
571 |
|
572 /** |
|
573 * Destructor. |
|
574 */ |
|
575 virtual ~CItem(); |
|
576 |
|
577 public: |
|
578 |
|
579 /** |
|
580 * Commitment state enumeration for list transaction management. |
|
581 * |
|
582 * @since S60 3.1 |
|
583 */ |
|
584 enum TCommitState |
|
585 { |
|
586 EAdded, // item has been added to a list |
|
587 ERemoved, // item has been removed from list |
|
588 ECommitted // no changes pending for the item |
|
589 }; |
|
590 |
|
591 /** |
|
592 * Getter for item policy |
|
593 * @since S60 3.1 |
|
594 * @param none |
|
595 * @return TCapabilitySet policy of the item |
|
596 */ |
|
597 TCapabilitySet Policy() const; |
|
598 |
|
599 /** |
|
600 * Getter for item type |
|
601 * Pure virtual |
|
602 * @since S60 3.1 |
|
603 * @param none |
|
604 * @return TItemType type of the item |
|
605 */ |
|
606 virtual TItemType Type() const = 0; |
|
607 |
|
608 /** |
|
609 * Getter for Id of the item |
|
610 * @since S60 3.1 |
|
611 * @param none |
|
612 * @return TInt indicating the Id of the item |
|
613 */ |
|
614 TInt Id() const; |
|
615 |
|
616 /** |
|
617 * Setter for Id of the item |
|
618 * @since S60 3.1 |
|
619 * @param aId id of the item |
|
620 * @return None. |
|
621 */ |
|
622 void SetId( TInt aId ); |
|
623 |
|
624 /** |
|
625 * Setter for the domain Uid of the item |
|
626 * @since S60 3.1 |
|
627 * @param aDomain identifier of the domain |
|
628 * @return None. |
|
629 */ |
|
630 void SetDomain( TUid aDomain ); |
|
631 |
|
632 /** |
|
633 * Getter for domain Uid of the item |
|
634 * @since S60 3.1 |
|
635 * @param none |
|
636 * @return TInt indicating the Id of the item |
|
637 */ |
|
638 TUid Domain() const; |
|
639 |
|
640 /** |
|
641 * Setter for the category Uid of the item |
|
642 * @since S60 3.1 |
|
643 * @param aCategory identifier of the category |
|
644 * @return None |
|
645 */ |
|
646 void SetCategory( TUid aCategory ); |
|
647 |
|
648 /** |
|
649 * Getter for category Uid of the item |
|
650 * @since S60 3.1 |
|
651 * @param none |
|
652 * @return TInt indicating the Id of the item |
|
653 */ |
|
654 TUid Category() const; |
|
655 |
|
656 /** |
|
657 * Setter for the item version |
|
658 * @since S60 3.1 |
|
659 * @param aVersion indicating the version information |
|
660 * @return none. |
|
661 */ |
|
662 void SetVersion( TVersion aVersion ); |
|
663 |
|
664 /** |
|
665 * Getter for the item version |
|
666 * @since S60 3.1 |
|
667 * @param none |
|
668 * @return TVersion indicating the version of the item. |
|
669 */ |
|
670 TVersion Version() const; |
|
671 |
|
672 /** |
|
673 * Setter for the secure id |
|
674 * @since S60 3.1 |
|
675 * @param aSecureId secure id information of the registrator |
|
676 * @return none. |
|
677 */ |
|
678 void SetSecureId( TSecureId aSecureId ); |
|
679 |
|
680 /** |
|
681 * Getter for the secure Id |
|
682 * @since S60 3.1 |
|
683 * @param none |
|
684 * @return TSecureId of the item |
|
685 */ |
|
686 TSecureId SecureId() const; |
|
687 |
|
688 /** |
|
689 * Setter for the parameter data |
|
690 * @since S60 3.1 |
|
691 * @param aData reference to data buffer |
|
692 * @return none |
|
693 */ |
|
694 void SetParameterDataL( const TDesC8& aData ); |
|
695 |
|
696 /** |
|
697 * Getter for the parameter data |
|
698 * @since S60 3.1 |
|
699 * @param none |
|
700 * @return TDesC8& to parameter data |
|
701 */ |
|
702 const TDesC8& ParameterData() const; |
|
703 |
|
704 /** |
|
705 * Getter for the commitment state |
|
706 * @since S60 3.1 |
|
707 * @param none |
|
708 * @return TCommitState commitment state |
|
709 */ |
|
710 TCommitState CommitState() const; |
|
711 |
|
712 /** |
|
713 * Setter for the commitment state |
|
714 * @since S60 3.1 |
|
715 * @param aState commitment state |
|
716 * @return None |
|
717 */ |
|
718 void SetCommitState( TCommitState aState ); |
|
719 |
|
720 protected: |
|
721 /** |
|
722 * C++ default constructor. |
|
723 */ |
|
724 CItem(); |
|
725 |
|
726 protected: |
|
727 /** |
|
728 * Domain information of the item |
|
729 */ |
|
730 TUid iDomain; |
|
731 |
|
732 /** |
|
733 * Category information of the item |
|
734 */ |
|
735 TUid iCategory; |
|
736 |
|
737 /** |
|
738 * ID of the item |
|
739 */ |
|
740 TInt iId; |
|
741 |
|
742 /** |
|
743 * Policy of the item |
|
744 */ |
|
745 TCapabilitySet iPolicy; |
|
746 |
|
747 /** |
|
748 * Version of the item |
|
749 */ |
|
750 TVersion iVersion; |
|
751 |
|
752 /** |
|
753 * If item is persistent |
|
754 */ |
|
755 TBool iPersistent; |
|
756 |
|
757 /** |
|
758 * Parameter data |
|
759 * Own. |
|
760 */ |
|
761 HBufC8* iData; |
|
762 |
|
763 /** |
|
764 * Secure ID of the registrator |
|
765 */ |
|
766 TSecureId iSecureId; |
|
767 |
|
768 /** |
|
769 * Commitment state |
|
770 */ |
|
771 TCommitState iCommitState; |
|
772 }; |
|
773 |
|
774 /** |
|
775 * Class to contain event information. Derived from CItem |
|
776 * |
|
777 * @since S60 3.1 |
|
778 */ |
|
779 class CEvent : public CItem |
|
780 { |
|
781 public: // Constructors and destructor |
|
782 |
|
783 /** |
|
784 * Two-phased constructor. |
|
785 * |
|
786 * @param aId identifier of the event |
|
787 * @return a new CEvent instance |
|
788 */ |
|
789 static CEvent* NewL( const TInt aId ); |
|
790 |
|
791 /** |
|
792 * Two-phased constructor. |
|
793 * |
|
794 * @param aEvent source event |
|
795 * @return a new CEvent instance |
|
796 */ |
|
797 static CEvent* NewL( const TEvent aEvent ); |
|
798 |
|
799 /** |
|
800 * Destructor. |
|
801 */ |
|
802 virtual ~CEvent(); |
|
803 |
|
804 public: // New functions |
|
805 |
|
806 /** |
|
807 * Adds event observer to observer array |
|
808 * @since S60 3.1 |
|
809 * @param aObserver pointer to observer (not owned by CItem) |
|
810 * @return TInt indicating the success of the call. |
|
811 */ |
|
812 TInt AddObserver( MMediatorServerEventObserver* aObserver ); |
|
813 |
|
814 /** |
|
815 * Removes observer from event |
|
816 * @since S60 3.1 |
|
817 * @param aObserver pointer to observer (not owned by CItem) |
|
818 * @return TInt indicating the success of the call. |
|
819 */ |
|
820 TInt RemoveObserver( MMediatorServerEventObserver* aObserver ); |
|
821 |
|
822 /** |
|
823 * Returns an array of registered observers |
|
824 * @since S60 3.1 |
|
825 * @param None. |
|
826 * @return RPointerArray of observers |
|
827 */ |
|
828 RPointerArray<MMediatorServerEventObserver>& GetObservers(); |
|
829 |
|
830 /** |
|
831 * Adds an array of observers to event |
|
832 * @since S60 3.1 |
|
833 * @param aObservers reference to observer array |
|
834 * @return None. |
|
835 */ |
|
836 void AddObservers( RPointerArray<MMediatorServerEventObserver>& aObservers ); |
|
837 |
|
838 /** |
|
839 * Gets TEvent structure of the current event |
|
840 * @since S60 3.1 |
|
841 * @param None |
|
842 * @return MediatorService::TEvent structure. |
|
843 */ |
|
844 MediatorService::TEvent Event() const; |
|
845 |
|
846 private: |
|
847 /** |
|
848 * C++ default constructor. |
|
849 * |
|
850 * @param aId identifier of the event |
|
851 */ |
|
852 CEvent( const TInt aId ); |
|
853 |
|
854 /** |
|
855 * C++ default constructor. |
|
856 * |
|
857 * @param aEvent source event |
|
858 */ |
|
859 CEvent( const TEvent aEvent ); |
|
860 |
|
861 /** |
|
862 * By default Symbian 2nd phase constructor is private. |
|
863 */ |
|
864 void ConstructL(); |
|
865 |
|
866 public: // From base class |
|
867 |
|
868 /** |
|
869 * Getter for item type |
|
870 * @since S60 3.1 |
|
871 * @param void |
|
872 * @return TItemType type of the item |
|
873 */ |
|
874 TItemType Type() const; |
|
875 |
|
876 private: |
|
877 |
|
878 // Observers (not owned) |
|
879 RPointerArray<MMediatorServerEventObserver> iObservers; |
|
880 |
|
881 }; |
|
882 |
|
883 /** |
|
884 * Class to contain command information. Derived from CItem |
|
885 * |
|
886 * @since S60 3.1 |
|
887 */ |
|
888 class CCommand : public CItem |
|
889 { |
|
890 |
|
891 public: // Constructors and destructor |
|
892 |
|
893 /** |
|
894 * Two-phased constructor. |
|
895 * |
|
896 * @param aId identifier of the command |
|
897 * @return a new CCommand instance |
|
898 */ |
|
899 static CCommand* NewL( const TInt aId ); |
|
900 |
|
901 /** |
|
902 * Two-phased constructor. |
|
903 * |
|
904 * @param aCommand source command |
|
905 * @return a new CCommand instance |
|
906 */ |
|
907 static CCommand* NewL( const TCommand aCommand ); |
|
908 |
|
909 /** |
|
910 * Destructor. |
|
911 */ |
|
912 virtual ~CCommand(); |
|
913 |
|
914 public: // New functions |
|
915 |
|
916 /** |
|
917 * Sets timeout for command (milliseconds) |
|
918 * @since S60 3.1 |
|
919 * @param aTimeout timeout value |
|
920 * @return None. |
|
921 */ |
|
922 void SetTimeout( TInt aTimeout ); |
|
923 |
|
924 /** |
|
925 * Gets timeout value of the command (milliseconds) |
|
926 * @since S60 3.1 |
|
927 * @param None. |
|
928 * @return TInt timeout value |
|
929 */ |
|
930 TInt Timeout() const; |
|
931 |
|
932 /** |
|
933 * Starts timeout timer |
|
934 * @since S60 3.1 |
|
935 * @param aCallBack pointer to callback observer |
|
936 * @return TInt indicating the success of the call. |
|
937 */ |
|
938 TInt StartTimer( MMediatorTimerCallback* aCallBack ); |
|
939 |
|
940 /** |
|
941 * Cancels (ongoing) timeout timer |
|
942 * @since S60 3.1 |
|
943 * @param None. |
|
944 * @return None. |
|
945 */ |
|
946 void CancelTimer(); |
|
947 |
|
948 /** |
|
949 * Gets TCommand structure of the current command. |
|
950 * @since S60 3.1 |
|
951 * @param None. |
|
952 * @return MediatorService::TCommand information |
|
953 */ |
|
954 MediatorService::TCommand Command() const; |
|
955 |
|
956 /** |
|
957 * Sets command handler (observer) |
|
958 * @since S60 3.1 |
|
959 * @param aObserver pointer to command handling instance. |
|
960 * @return None |
|
961 */ |
|
962 void SetObserver( MMediatorCommandObserver* aObserver ); |
|
963 |
|
964 /** |
|
965 * Gets command handler. |
|
966 * @since S60 3.1 |
|
967 * @param None. |
|
968 * @return MMediatorCommandObserver pointer to command observer |
|
969 */ |
|
970 MMediatorCommandObserver* Observer(); |
|
971 |
|
972 /** |
|
973 * Sets command response observer |
|
974 * @since S60 3.1 |
|
975 * @param aObserver pointer to command response observer |
|
976 * @return None. |
|
977 */ |
|
978 void SetResponseObserver( MMediatorCommandResponseObserver* aObserver ); |
|
979 |
|
980 /** |
|
981 * Gets command response observer |
|
982 * @since S60 3.1 |
|
983 * @param None. |
|
984 * @return MMediatorCommandResponseObserver pointer to observer |
|
985 */ |
|
986 MMediatorCommandResponseObserver* ResponseObserver(); |
|
987 |
|
988 /** |
|
989 * Setter for command status |
|
990 * |
|
991 * @since S60 3.1 |
|
992 * @param aStatus command status |
|
993 * @return TCommandStatus None. |
|
994 */ |
|
995 void CCommand::SetStatus( TCommandStatus aStatus ); |
|
996 |
|
997 /** |
|
998 * Getter for command status |
|
999 * |
|
1000 * @since S60 3.1 |
|
1001 * @param void |
|
1002 * @return TCommandStatus the command status |
|
1003 */ |
|
1004 TCommandStatus Status() const; |
|
1005 |
|
1006 public: // From base class |
|
1007 |
|
1008 /** |
|
1009 * Getter for item type |
|
1010 * @since S60 3.1 |
|
1011 * @param void |
|
1012 * @return TItemType type of the item |
|
1013 */ |
|
1014 TItemType Type() const; |
|
1015 |
|
1016 private: |
|
1017 /** |
|
1018 * C++ default constructor. |
|
1019 * |
|
1020 * @param aId identifier of the command |
|
1021 */ |
|
1022 CCommand( const TInt aId ); |
|
1023 |
|
1024 /** |
|
1025 * C++ default constructor. |
|
1026 * |
|
1027 * @param aCommand source command |
|
1028 */ |
|
1029 CCommand( const TCommand aCommand ); |
|
1030 |
|
1031 /** |
|
1032 * By default Symbian 2nd phase constructor is private. |
|
1033 */ |
|
1034 void ConstructL(); |
|
1035 |
|
1036 private: |
|
1037 // Command timeout |
|
1038 TInt iTimeout; |
|
1039 |
|
1040 /** |
|
1041 * Command observer |
|
1042 * Not own. |
|
1043 */ |
|
1044 MMediatorCommandObserver* iObserver; |
|
1045 |
|
1046 /** |
|
1047 * Command response observer |
|
1048 * Not own. |
|
1049 */ |
|
1050 MMediatorCommandResponseObserver* iResponseObserver; |
|
1051 |
|
1052 /** |
|
1053 * Command timer |
|
1054 * Own. |
|
1055 */ |
|
1056 CMediatorCommandTimer* iCommandTimer; |
|
1057 |
|
1058 /** |
|
1059 * Command status. |
|
1060 */ |
|
1061 TCommandStatus iStatus; |
|
1062 }; |
|
1063 |
|
1064 #endif // MEDIATORSERVEROBJECTS_H |
|
1065 |
|
1066 // End of File |