|
1 /* |
|
2 * Copyright (c) 2004 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: MCC EventHandler |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 #ifndef __MCC_EVENT_H__ |
|
22 #define __MCC_EVENT_H__ |
|
23 |
|
24 // INCLUDES |
|
25 #include <e32base.h> |
|
26 #include <mmf/common/mmfcontroller.h> |
|
27 #include "mccdef.h" |
|
28 #include "mmccevents.h" |
|
29 #include "mccinternaldef.h" |
|
30 |
|
31 // CONSTANTS |
|
32 |
|
33 // MACROS |
|
34 |
|
35 // DATA TYPES |
|
36 |
|
37 // FUNCTION PROTOTYPES |
|
38 |
|
39 // FORWARD DECLARATIONS |
|
40 class MMccCtrlObserver; |
|
41 |
|
42 // CLASS DECLARATION |
|
43 |
|
44 /** |
|
45 * CMccEvent receives event notifications from the controller plugin and forwards |
|
46 * them to the client by calling corresponding callback functions of the |
|
47 * MMCCCtrlObserver. |
|
48 * |
|
49 * @lib MCCInterface.lib |
|
50 * @since Series 60 3.0 |
|
51 */ |
|
52 #ifdef EKA2 |
|
53 NONSHARABLE_CLASS( CMccEvent ) : public CActive |
|
54 #else |
|
55 class CMccEvent : public CActive |
|
56 #endif |
|
57 { |
|
58 #ifdef TEST_EUNIT |
|
59 friend class UT_CMCCInterface; |
|
60 #endif |
|
61 |
|
62 public: // Constructors and destructor |
|
63 |
|
64 /** |
|
65 * Two-phased constructor. |
|
66 */ |
|
67 static CMccEvent* NewL( RMMFController& aController, |
|
68 MMccCtrlObserver& aObserver ); |
|
69 |
|
70 /** |
|
71 * Destructor. |
|
72 */ |
|
73 virtual ~CMccEvent(); |
|
74 |
|
75 public: // New functions |
|
76 /** |
|
77 * Requests for event from Controller plugin and starts event listening loop. |
|
78 * @since Series 60 3.0 |
|
79 * @return void |
|
80 */ |
|
81 void RequestEventNotification(); |
|
82 |
|
83 protected: // From CActive |
|
84 /** |
|
85 * From CActive Handles an active object’s request completion event. |
|
86 * @since Series 60 3.0 |
|
87 * @return None |
|
88 */ |
|
89 void RunL(); |
|
90 |
|
91 /** |
|
92 * From CActive |
|
93 */ |
|
94 TInt RunError( TInt aError ); |
|
95 |
|
96 /** |
|
97 * From CActive Implements cancellation of an outstanding request. |
|
98 * @since Series 60 3.0 |
|
99 * @return None |
|
100 */ |
|
101 void DoCancel(); |
|
102 |
|
103 private: // New functions |
|
104 |
|
105 /** |
|
106 * Handles an media event |
|
107 * @since Series 60 3.0 |
|
108 * @param aEvent Media event |
|
109 * @return void |
|
110 */ |
|
111 void HandleMccMediaEvent( const TMccEvent& aEvent ); |
|
112 |
|
113 /** |
|
114 * Handles state change |
|
115 * @since Series 60 3.0 |
|
116 * @param aEvent Statechange event |
|
117 * @return void |
|
118 */ |
|
119 void HandleMccStateChangeEvent( const TMccEvent& aEvent ); |
|
120 |
|
121 /** |
|
122 * Handles error event |
|
123 * @since Series 60 3.0 |
|
124 * @param aEvent Error event |
|
125 * @return void |
|
126 */ |
|
127 void HandleMccErrorEvent( const TMccEvent& aEvent ); |
|
128 |
|
129 /** |
|
130 * Handles inactivity event |
|
131 * @since Series 60 3.0 |
|
132 * @param aEvent Error event |
|
133 * @return void |
|
134 */ |
|
135 void HandleMccInactivityEvent( const TMccEvent& aEvent ); |
|
136 |
|
137 /** |
|
138 * Handles activity event |
|
139 * @since Series 60 3.0 |
|
140 * @param aEvent Error event |
|
141 * @return void |
|
142 */ |
|
143 void HandleMccActivityEvent( const TMccEvent& aEvent ); |
|
144 |
|
145 /** |
|
146 * Handles unknown media event |
|
147 * |
|
148 * @since Series 60 3.0 |
|
149 * @param aEvent Event |
|
150 * @return void |
|
151 */ |
|
152 void HandleMccUnknownMediaEvent( const TMccEvent& aEvent ); |
|
153 |
|
154 private: |
|
155 |
|
156 /** |
|
157 * C++ default constructor. |
|
158 */ |
|
159 CMccEvent( RMMFController& aController, |
|
160 MMccCtrlObserver& aCallback ); |
|
161 |
|
162 /** |
|
163 * By default Symbian 2nd phase constructor is private. |
|
164 */ |
|
165 void ConstructL(); |
|
166 |
|
167 |
|
168 private: // Data |
|
169 |
|
170 // Handle to the controller plugin for sending custom commands |
|
171 RMMFController& iController; |
|
172 |
|
173 // Callback object to inform client about events |
|
174 MMccCtrlObserver& iEventCallBack; |
|
175 |
|
176 // Destination of the custom command |
|
177 TMMFMessageDestinationPckg iMessageDest; |
|
178 |
|
179 // Contains information about event after completion of |
|
180 // notification request issued to the controller |
|
181 TMccEventPackage iPackage; |
|
182 |
|
183 private: |
|
184 #ifdef TEST_EUNIT |
|
185 friend class UT_CMccInterface; |
|
186 #endif |
|
187 }; |
|
188 |
|
189 #endif /* __MCC_EVENT_H__ */ |
|
190 |
|
191 // End of File |