|
1 /* |
|
2 * Copyright (c) 2009 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: HDMI Cable Status FSM's "Connected" state. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef C_HDMICABLESTATECONNECTED_H |
|
20 #define C_HDMICABLESTATECONNECTED_H |
|
21 |
|
22 |
|
23 #include "multifinitestatemachine.h" |
|
24 |
|
25 |
|
26 class CEDIDHandler; |
|
27 class CAccessoryControlIf; |
|
28 class CTVOutConfigForHDMI; |
|
29 class CHDMICableStatusFSM; |
|
30 |
|
31 |
|
32 /** |
|
33 * "Connected" state implementation for HDMI Cable Status FSM. |
|
34 * HDMI Cable is connected in this state. |
|
35 * |
|
36 * @code |
|
37 * ?good_class_usage_example(s) |
|
38 * @endcode |
|
39 * |
|
40 * @lib none. |
|
41 * @since TB 9.2 |
|
42 */ |
|
43 NONSHARABLE_CLASS( CHDMICableStateConnected ): public CBase, public MFSMState |
|
44 { |
|
45 |
|
46 |
|
47 public: |
|
48 |
|
49 |
|
50 /** |
|
51 * Two-phased constructor. |
|
52 * @param aTVOutConfigForHDMI TV Out Configurer for cable connection listening. |
|
53 * @param aEDIDHandler EDID Handler object. |
|
54 * @param aAccessoryControlIf Accessory Control object. |
|
55 * @param aHDMICableStatusFSM HDMI Cable Status FSM. |
|
56 */ |
|
57 static CHDMICableStateConnected* NewL( |
|
58 CTVOutConfigForHDMI& aTVOutConfigForHDMI, |
|
59 CEDIDHandler& aEDIDHandler, |
|
60 CAccessoryControlIf& aAccessoryControlIf, |
|
61 CHDMICableStatusFSM& aHDMICableStatusFSM ); |
|
62 |
|
63 |
|
64 /** |
|
65 * Destructor. |
|
66 */ |
|
67 virtual ~CHDMICableStateConnected(); |
|
68 |
|
69 |
|
70 // from base class MFSMState |
|
71 |
|
72 |
|
73 /** |
|
74 * From MFSMState. |
|
75 * Function is called when entering the state. State can perform |
|
76 * necessary entry actions if any. |
|
77 * |
|
78 * @since TB 9.2 |
|
79 * @param none. |
|
80 * @return aFSMBody Interface pointer of a FSM body. |
|
81 */ |
|
82 virtual void Enter(); |
|
83 |
|
84 /** |
|
85 * From MFSMState. |
|
86 * Function is called by FSM Body whenever an event that might have |
|
87 * impact on the state has been fired. Implementation has to found |
|
88 * out what event has occurred and decide whether it enforces |
|
89 * transition to another state. |
|
90 * |
|
91 * @since TB 9.2 |
|
92 * @param aInterfaceId Interface identification. |
|
93 * @param aEvent Event identification. |
|
94 * @return none. |
|
95 */ |
|
96 virtual void Input( |
|
97 TFSMInterfaceId aInterfaceId , |
|
98 TFSMEventId aEvent ); |
|
99 |
|
100 /** |
|
101 * From MFSMState. |
|
102 * Function returns state's identification. |
|
103 * |
|
104 * @since TB 9.2 |
|
105 * @param none. |
|
106 * @return TFSMState State's identification. |
|
107 */ |
|
108 virtual TFSMState Id(); |
|
109 |
|
110 /** |
|
111 * From MFSMState. |
|
112 * Function returns state's name. |
|
113 * |
|
114 * @since TB 9.2 |
|
115 * @param none. |
|
116 * @return TPtrC Name of the state. |
|
117 */ |
|
118 virtual TPtrC Name(); |
|
119 |
|
120 /** |
|
121 * Function returns substate's identification. |
|
122 * |
|
123 * @since TB 9.2 |
|
124 * @param none. |
|
125 * @return TFSMState Substate's identification. |
|
126 */ |
|
127 virtual TFSMState SubId(); |
|
128 |
|
129 // Substate constants |
|
130 enum TSubState |
|
131 { |
|
132 // Prefer not to change the values, since they are used |
|
133 // for example in test modules |
|
134 ESubStateUndefined = 0x0, |
|
135 ESubStateFechEdidData = 0x10, |
|
136 ESubStateWaitForSettingsChanged = 0x11, |
|
137 ESubStateEnable = 0x12, |
|
138 ESubStateConnectAccessory = 0x13, |
|
139 ESubStateStartListenSettingsChanges = 0x14, |
|
140 |
|
141 ESubStateConnected = 0x21, |
|
142 |
|
143 ESubStateIdlingDisable = 0x30, |
|
144 ESubStateIdlingDisconnectAccessory = 0x31, |
|
145 |
|
146 ESubStateResettingEnable = 0x40, |
|
147 ESubStateResettingDisable = 0x41, |
|
148 |
|
149 ESubStateRejectingDisable = 0x50, |
|
150 ESubStateRejectingDisconnectAccessory = 0x51 |
|
151 }; |
|
152 |
|
153 protected: |
|
154 |
|
155 |
|
156 private: |
|
157 |
|
158 /** |
|
159 * Start listen to Copy Protection Status changes. |
|
160 * |
|
161 * @since TB 9.2 |
|
162 * @param none. |
|
163 * @return void. |
|
164 */ |
|
165 void ListenCopyProtectionStatusChanges(); |
|
166 |
|
167 /** |
|
168 * Input function for substate Fetch Edid Data. |
|
169 * |
|
170 * @since TB 9.2 |
|
171 * @param aInterfaceId Interface Id. |
|
172 * @param aEvent Interface event Id. |
|
173 * @return none. |
|
174 */ |
|
175 void SubStateFetchEdidDataInput( |
|
176 TFSMInterfaceId aInterfaceId , |
|
177 TFSMEventId aEvent ); |
|
178 |
|
179 /** |
|
180 * Input function for substate Start Listen |
|
181 * Config Changes. |
|
182 * |
|
183 * @since TB 9.2 |
|
184 * @param aInterfaceId Interface Id. |
|
185 * @param aEvent Interface event Id. |
|
186 * @return none. |
|
187 */ |
|
188 void SubStateStartListenConfigChangesInput( |
|
189 TFSMInterfaceId aInterfaceId , |
|
190 TFSMEventId aEvent ); |
|
191 |
|
192 /** |
|
193 * Input function for substate Enabling. |
|
194 * |
|
195 * @since TB 9.2 |
|
196 * @param aInterfaceId Interface Id. |
|
197 * @param aEvent Interface event Id. |
|
198 * @return none. |
|
199 */ |
|
200 void SubStateEnableInput( |
|
201 TFSMInterfaceId aInterfaceId , |
|
202 TFSMEventId aEvent ); |
|
203 |
|
204 /** |
|
205 * Input function for substate Enabling for resetting |
|
206 * TV Out Configuration settings. |
|
207 * |
|
208 * @since TB 9.2 |
|
209 * @param aInterfaceId Interface Id. |
|
210 * @param aEvent Interface event Id. |
|
211 * @return none. |
|
212 */ |
|
213 void SubStateResettingEnableInput( |
|
214 TFSMInterfaceId aInterfaceId , |
|
215 TFSMEventId aEvent ); |
|
216 |
|
217 /** |
|
218 * Input function for substate Disabling before |
|
219 * going to Idle state. |
|
220 * |
|
221 * @since TB 9.2 |
|
222 * @param aInterfaceId Interface Id. |
|
223 * @param aEvent Interface event Id. |
|
224 * @return none. |
|
225 */ |
|
226 void SubStateIdlingDisableInput( |
|
227 TFSMInterfaceId aInterfaceId , |
|
228 TFSMEventId aEvent ); |
|
229 |
|
230 /** |
|
231 * Input function for substate Disabling for resetting |
|
232 * TV Out Configuration settings. |
|
233 * |
|
234 * @since TB 9.2 |
|
235 * @param aInterfaceId Interface Id. |
|
236 * @param aEvent Interface event Id. |
|
237 * @return none. |
|
238 */ |
|
239 void SubStateResettingDisableInput( |
|
240 TFSMInterfaceId aInterfaceId , |
|
241 TFSMEventId aEvent ); |
|
242 |
|
243 /** |
|
244 * Input function for substate Disabling for rejecting |
|
245 * the connected cable. |
|
246 * |
|
247 * @since TB 9.2 |
|
248 * @param aInterfaceId Interface Id. |
|
249 * @param aEvent Interface event Id. |
|
250 * @return none. |
|
251 */ |
|
252 void SubStateRejectingDisableInput( |
|
253 TFSMInterfaceId aInterfaceId , |
|
254 TFSMEventId aEvent ); |
|
255 |
|
256 /** |
|
257 * Input function for substate Connect Accessory. |
|
258 * |
|
259 * @since TB 9.2 |
|
260 * @param aInterfaceId Interface Id. |
|
261 * @param aEvent Interface event Id. |
|
262 * @return none. |
|
263 */ |
|
264 void SubStateConnectAccessoryInput( |
|
265 TFSMInterfaceId aInterfaceId , |
|
266 TFSMEventId aEvent ); |
|
267 |
|
268 /** |
|
269 * Input function for substate Disconnect Accessory before |
|
270 * going to Idle state. |
|
271 * |
|
272 * @since TB 9.2 |
|
273 * @param aInterfaceId Interface Id. |
|
274 * @param aEvent Interface event Id. |
|
275 * @return none. |
|
276 */ |
|
277 void SubStateIdlingDisconnectAccessoryInput( |
|
278 TFSMInterfaceId aInterfaceId , |
|
279 TFSMEventId aEvent ); |
|
280 |
|
281 /** |
|
282 * Input function for substate Disconnect Accessory before |
|
283 * going to Rejected state. |
|
284 * |
|
285 * @since TB 9.2 |
|
286 * @param aInterfaceId Interface Id. |
|
287 * @param aEvent Interface event Id. |
|
288 * @return none. |
|
289 */ |
|
290 void SubStateRejectingDisconnectAccessoryInput( |
|
291 TFSMInterfaceId aInterfaceId , |
|
292 TFSMEventId aEvent ); |
|
293 |
|
294 /** |
|
295 * Input function for substate Connected. |
|
296 * |
|
297 * @since TB 9.2 |
|
298 * @param aInterfaceId Interface Id. |
|
299 * @param aEvent Interface event Id. |
|
300 * @return none. |
|
301 */ |
|
302 void SubStateConnectedInput( |
|
303 TFSMInterfaceId aInterfaceId , |
|
304 TFSMEventId aEvent ); |
|
305 |
|
306 /** |
|
307 * Input function for substate Wait For Setting Changes. |
|
308 * |
|
309 * @since TB 9.2 |
|
310 * @param aInterfaceId Interface Id. |
|
311 * @param aEvent Interface event Id. |
|
312 * @return none. |
|
313 */ |
|
314 void SubStateWaitForSettingsChangedInput( |
|
315 TFSMInterfaceId aInterfaceId , |
|
316 TFSMEventId aEvent ); |
|
317 |
|
318 /** |
|
319 * C++ default constructor. |
|
320 * @param aTVOutConfigForHDMI TV Out Configurer for cable connection listening. |
|
321 * @param aEDIDHandler EDID Handler object. |
|
322 * @param aAccessoryControlIf Accessory Control object. |
|
323 * @param aHDMICableStatusFSM HDMI Cable Status FSM.. |
|
324 */ |
|
325 CHDMICableStateConnected( |
|
326 CTVOutConfigForHDMI& aTVOutConfigForHDMI, |
|
327 CEDIDHandler& aEDIDHandler, |
|
328 CAccessoryControlIf& aAccessoryControlIf, |
|
329 CHDMICableStatusFSM& aHDMICableStatusFSM ); |
|
330 |
|
331 /** |
|
332 * By default Symbian OS constructor is private. |
|
333 */ |
|
334 void ConstructL(); |
|
335 |
|
336 private: // data |
|
337 |
|
338 |
|
339 struct SCopyProtectListenFailCounter |
|
340 { |
|
341 TUint8 iCount; |
|
342 enum |
|
343 { |
|
344 ECounterMaxValue = 5 |
|
345 }; |
|
346 }; |
|
347 |
|
348 struct SCableStatusListenFailCounter |
|
349 { |
|
350 TUint8 iCounter; |
|
351 enum |
|
352 { |
|
353 EMaxCounterValue = 5 |
|
354 }; |
|
355 }; |
|
356 |
|
357 |
|
358 /** |
|
359 * TV Out Configurer. |
|
360 * Not own. |
|
361 */ |
|
362 CTVOutConfigForHDMI& iTVOutConfigForHDMI; |
|
363 |
|
364 /** |
|
365 * EDID data Handler. |
|
366 * Not own. |
|
367 */ |
|
368 CEDIDHandler& iEDIDHandler; |
|
369 |
|
370 /** |
|
371 * Accessory Control Interface. |
|
372 * Not own |
|
373 */ |
|
374 CAccessoryControlIf& iAccessoryControlIf; |
|
375 |
|
376 /** |
|
377 * TV Out Configurer for Copy Protection listening and setting . |
|
378 * Not own. |
|
379 */ |
|
380 CTVOutConfigForHDMI* iTVOutConfigForCopyProtect; |
|
381 |
|
382 /** |
|
383 * TV Out Configurer for listening setting changes. |
|
384 * Not own |
|
385 */ |
|
386 CTVOutConfigForHDMI* iTVOutConfigForSettingChanges; |
|
387 |
|
388 /** |
|
389 * HDMI Cable Status FSM. |
|
390 * Not own. |
|
391 */ |
|
392 CHDMICableStatusFSM& iHDMICableStatusFSM; |
|
393 |
|
394 // Counter for Copy Protection status listen failures. |
|
395 SCopyProtectListenFailCounter iCopyProtectListenFailCounter; |
|
396 |
|
397 // Counter for Cable status listen failures. |
|
398 SCableStatusListenFailCounter iCableStatusListenFailCounter; |
|
399 |
|
400 // Substate |
|
401 TSubState iSubState; |
|
402 |
|
403 }; |
|
404 |
|
405 #endif // C_HDMICABLESTATECONNECTED_H |