|
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: Timer for implementing mediator service command timeout. |
|
15 * |
|
16 */ |
|
17 |
|
18 #ifndef MEDIATORCOMMANDTIMER_H |
|
19 #define MEDIATORCOMMANDTIMER_H |
|
20 |
|
21 // INCLUDES |
|
22 #include <e32base.h> |
|
23 |
|
24 |
|
25 // CLASS DECLARATION |
|
26 |
|
27 /** |
|
28 * An observer interface for receiving command timeout. |
|
29 * |
|
30 * @since S60 3.1 |
|
31 */ |
|
32 class MMediatorTimerCallback |
|
33 { |
|
34 public: // Timer callback |
|
35 |
|
36 /** |
|
37 * Timer has completed |
|
38 * |
|
39 * @since S60 3.1 |
|
40 * @param aDomain domain of the expired command |
|
41 * @param aCategory category of the expired command |
|
42 * @param aCommandId id of the expired command |
|
43 * @return None. |
|
44 */ |
|
45 virtual void TimerCallBack( TUid aDomain, |
|
46 TUid aCategory, |
|
47 TInt aCommandId ) = 0; |
|
48 }; |
|
49 |
|
50 |
|
51 /** |
|
52 * Timer class for command handling timeouts. |
|
53 * |
|
54 * @lib MediatorServer |
|
55 * @since S60 3.1 |
|
56 */ |
|
57 class CMediatorCommandTimer : public CTimer |
|
58 { |
|
59 public: // Constructors and destructor |
|
60 |
|
61 /** |
|
62 * Two-phased constructor. |
|
63 */ |
|
64 static CMediatorCommandTimer* NewL(); |
|
65 |
|
66 /** |
|
67 * Destructor. |
|
68 */ |
|
69 virtual ~CMediatorCommandTimer(); |
|
70 |
|
71 public: // New functions |
|
72 |
|
73 /** |
|
74 * Starts timer with specified interval |
|
75 * @since S60 3.1 |
|
76 * @param aCallBack observer for command expiration |
|
77 * @param aDomain domain of the command |
|
78 * @param aCategory category of the command |
|
79 * @param aCommandId id of the command |
|
80 * @param aInterval specifies timer interval. |
|
81 * Milliseconds, so multiplied by 1000 |
|
82 * @return TInt indicating the start status |
|
83 */ |
|
84 TInt StartTimer( MMediatorTimerCallback* aCallBack, |
|
85 TUid aDomain, |
|
86 TUid aCategory, |
|
87 TInt aCommandId, |
|
88 TInt aInterval ); |
|
89 |
|
90 private: // From CTimer (CActive) |
|
91 |
|
92 /** |
|
93 * From CActive RunL. |
|
94 * @since S60 3.1 |
|
95 * @param None. |
|
96 * @return None. |
|
97 */ |
|
98 void RunL(); |
|
99 |
|
100 private: |
|
101 |
|
102 /** |
|
103 * C++ default constructor. |
|
104 */ |
|
105 CMediatorCommandTimer(); |
|
106 |
|
107 /** |
|
108 * By default Symbian 2nd phase constructor is private. |
|
109 */ |
|
110 void ConstructL(); |
|
111 |
|
112 private: // Data |
|
113 |
|
114 // Callback pointer for timer event |
|
115 MMediatorTimerCallback* iCallBack; |
|
116 |
|
117 // Domain |
|
118 TUid iDomain; |
|
119 // Category |
|
120 TUid iCategory; |
|
121 // Command |
|
122 TInt iCommandId; |
|
123 }; |
|
124 |
|
125 #endif // MEDIATORCOMMANDTIMER_H |
|
126 |
|
127 // End of File |