|
1 /* |
|
2 * Copyright (c) 2006 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: State manager for session and audio routing states. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 #ifndef CVTENGSTATEMANAGER_H |
|
21 #define CVTENGSTATEMANAGER_H |
|
22 |
|
23 // INCLUDES |
|
24 #include <e32base.h> |
|
25 #include "vtengcommands.h" |
|
26 #include "MVtEngSessionInfo.h" |
|
27 // FORWARD DECLARATIONS |
|
28 class CVtEngStateBase; |
|
29 class CVtEngHandlerContainer; |
|
30 class CVtEngEventManager; |
|
31 class CVtEngOperation; |
|
32 |
|
33 // CLASS DECLARATION |
|
34 |
|
35 /** |
|
36 * Owner of engine states. Delegates update request |
|
37 * to active state when requested. Provides method |
|
38 * to enquire command availability in current state. |
|
39 * |
|
40 * @lib videoteleng |
|
41 * @since 2.6 |
|
42 */ |
|
43 NONSHARABLE_CLASS( CVtEngStateManager ): public CBase |
|
44 { |
|
45 public: // Constructors and destructor |
|
46 |
|
47 /** |
|
48 * Two-phased constructor. |
|
49 */ |
|
50 static CVtEngStateManager* NewL( |
|
51 CVtEngHandlerContainer& aHandlers, |
|
52 CVtEngEventManager& aEventManager ); |
|
53 |
|
54 /** |
|
55 * Destructor. |
|
56 */ |
|
57 virtual ~CVtEngStateManager(); |
|
58 |
|
59 public: // New functions |
|
60 |
|
61 /** |
|
62 * Requests updates for current state. |
|
63 */ |
|
64 void Update( ); |
|
65 |
|
66 /** |
|
67 * Checks if a command is possible in current state |
|
68 * @param aCommandId command to check |
|
69 * @return ETrue if command can be performed |
|
70 */ |
|
71 TBool IsCommandPossible( |
|
72 const TVtEngCommandId aCommandId ) const; |
|
73 |
|
74 /** |
|
75 * Sets new session state. |
|
76 * @param aNewState new session state |
|
77 */ |
|
78 void SetState( CVtEngStateBase& aNewState ); |
|
79 |
|
80 /** |
|
81 * Passes an operation to current state for |
|
82 * handling. |
|
83 * @param aOp operation to be handled |
|
84 * @return ETrue if operation handled |
|
85 */ |
|
86 TBool HandleOperationL( CVtEngOperation& aOp ); |
|
87 |
|
88 /** |
|
89 * Previous session state. |
|
90 */ |
|
91 MVtEngSessionInfo::TSessionState PreviousSessionState() const; |
|
92 |
|
93 /** |
|
94 * Current session state. |
|
95 */ |
|
96 MVtEngSessionInfo::TSessionState SessionState() const; |
|
97 |
|
98 /** |
|
99 * Returns handler container. |
|
100 * @return handler container |
|
101 */ |
|
102 inline CVtEngHandlerContainer& Handlers(); |
|
103 |
|
104 /** |
|
105 * Returns event manager. |
|
106 * @return event manager |
|
107 */ |
|
108 inline CVtEngEventManager& EventManager(); |
|
109 |
|
110 private: |
|
111 |
|
112 /** |
|
113 * C++ constructor. |
|
114 */ |
|
115 CVtEngStateManager( |
|
116 CVtEngHandlerContainer& aHandlers, |
|
117 CVtEngEventManager& aEventManager ); |
|
118 |
|
119 /** |
|
120 * By default Symbian 2nd phase constructor is private. |
|
121 */ |
|
122 void ConstructL(); |
|
123 |
|
124 private: // Data |
|
125 // Previous session state |
|
126 MVtEngSessionInfo::TSessionState iPreviousSessionState; |
|
127 |
|
128 // Current session state |
|
129 CVtEngStateBase* iSessionState; |
|
130 |
|
131 // Handler container |
|
132 CVtEngHandlerContainer& iHandlers; |
|
133 |
|
134 // Event manager |
|
135 CVtEngEventManager& iEventManager; |
|
136 |
|
137 }; |
|
138 |
|
139 #include "CVtEngStateManager.inl" |
|
140 |
|
141 #endif // CVTENGSTATEMANAGER_H |
|
142 |
|
143 // End of File |