|
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: Video telephony engine class implementation. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 // INCLUDE FILES |
|
21 #include "CVtEngModel.h" |
|
22 #include "CVtEngHandlerContainer.h" |
|
23 #include "CVtEngCommandHandler.h" |
|
24 #include "CVtEngEventManager.h" |
|
25 #include "CVtEngStateManager.h" |
|
26 #include "VtEngUtils.h" |
|
27 #include "VtEngPanic.h" |
|
28 #include <cvtlogger.h> |
|
29 #include "CVtEngExtensions.h" |
|
30 |
|
31 // ============================ MEMBER FUNCTIONS =============================== |
|
32 |
|
33 // ----------------------------------------------------------------------------- |
|
34 // CVtEngModel::CVtEngModel |
|
35 // C++ default constructor can NOT contain any code, that |
|
36 // might leave. |
|
37 // ----------------------------------------------------------------------------- |
|
38 // |
|
39 CVtEngModel::CVtEngModel() |
|
40 { |
|
41 } |
|
42 |
|
43 // ----------------------------------------------------------------------------- |
|
44 // CVtEngModel::ConstructL |
|
45 // Symbian 2nd phase constructor can leave. |
|
46 // ----------------------------------------------------------------------------- |
|
47 // |
|
48 void CVtEngModel::ConstructL( |
|
49 MVtEngEventObserver& aEventObserver, |
|
50 MVtEngCommandObserver& aCommandObserver ) |
|
51 { |
|
52 VTLOGINIT |
|
53 __VTPRINTENTER( "Model.ConstructL" ) |
|
54 |
|
55 __VTPRINT( DEBUG_GEN | DEBUG_CONSTRUCT, "Model.ConL" ) |
|
56 iUtils = CVtEngUtility::NewL( ); |
|
57 iHandlers = CVtEngHandlerContainer::NewL( ); |
|
58 |
|
59 // Create extensions |
|
60 iExtensions = CVtEngExtensions::NewL(); |
|
61 |
|
62 iUtils->PrepareL( |
|
63 *iHandlers, |
|
64 iStateManager, |
|
65 iEventManager, |
|
66 iExtensions ); |
|
67 iCommandHandler = CVtEngCommandHandler::NewL( *iHandlers ); |
|
68 iCommandHandler->AddObserverL( aCommandObserver ); |
|
69 iEventManager = CVtEngEventManager::NewL( aEventObserver ); |
|
70 iStateManager = CVtEngStateManager::NewL( *iHandlers, *iEventManager ); |
|
71 __VTPRINTEXIT( "Model.ConstructL" ) |
|
72 } |
|
73 |
|
74 // ----------------------------------------------------------------------------- |
|
75 // CVtEngModel::NewL |
|
76 // Two-phased constructor. |
|
77 // ----------------------------------------------------------------------------- |
|
78 // |
|
79 EXPORT_C CVtEngModel* CVtEngModel::NewL( |
|
80 MVtEngEventObserver& aEventObserver, |
|
81 MVtEngCommandObserver& aCommandObserver) |
|
82 { |
|
83 CVtEngModel* self = new( ELeave ) CVtEngModel; |
|
84 |
|
85 CleanupStack::PushL( self ); |
|
86 self->ConstructL( aEventObserver, aCommandObserver ); |
|
87 CleanupStack::Pop(); |
|
88 |
|
89 return self; |
|
90 } |
|
91 |
|
92 |
|
93 // Destructor |
|
94 CVtEngModel::~CVtEngModel() |
|
95 { |
|
96 __VTPRINTENTER( "Model.~" ) |
|
97 delete iStateManager; |
|
98 delete iCommandHandler; |
|
99 delete iHandlers; |
|
100 delete iUtils; |
|
101 delete iEventManager; |
|
102 delete iExtensions; |
|
103 __VTPRINTEXIT( "Model.~" ) |
|
104 VTLOGUNINIT |
|
105 } |
|
106 |
|
107 // ----------------------------------------------------------------------------- |
|
108 // CVtEngModel::CommandHandler |
|
109 // Returns command handler reference. |
|
110 // ----------------------------------------------------------------------------- |
|
111 // |
|
112 EXPORT_C MVtEngCommandHandler& CVtEngModel::CommandHandler() const |
|
113 { |
|
114 return *iCommandHandler; |
|
115 } |
|
116 |
|
117 // ----------------------------------------------------------------------------- |
|
118 // CVtEngModel::Session |
|
119 // Returns session reference. |
|
120 // ----------------------------------------------------------------------------- |
|
121 // |
|
122 EXPORT_C MVtEngSessionInfo& CVtEngModel::Session() const |
|
123 { |
|
124 return iHandlers->Session(); |
|
125 } |
|
126 |
|
127 // ----------------------------------------------------------------------------- |
|
128 // CVtEngModel::Media |
|
129 // Returns media reference. |
|
130 // |
|
131 // ----------------------------------------------------------------------------- |
|
132 // |
|
133 EXPORT_C MVtEngMedia& CVtEngModel::Media() const |
|
134 { |
|
135 return iHandlers->Media(); |
|
136 } |
|
137 |
|
138 // ----------------------------------------------------------------------------- |
|
139 // CVtEngModel::Audio |
|
140 // Returns audio reference. |
|
141 // ----------------------------------------------------------------------------- |
|
142 // |
|
143 EXPORT_C MVtEngAudio& CVtEngModel::Audio() const |
|
144 { |
|
145 return iHandlers->Audio(); |
|
146 } |
|
147 |
|
148 // ----------------------------------------------------------------------------- |
|
149 // CVtEngModel::Extension |
|
150 // Returns extension pointer (currently none) |
|
151 // ----------------------------------------------------------------------------- |
|
152 // |
|
153 EXPORT_C TAny* CVtEngModel::Extension( const TUid& aExtensionUid ) |
|
154 { |
|
155 __VTPRINTENTER( "Model.Extension" ) |
|
156 |
|
157 // init local variables |
|
158 TInt error = KErrNone; |
|
159 TAny* interfacePtr = NULL; |
|
160 |
|
161 // get mediahandler handle |
|
162 MVtEngMedia& msession = iHandlers->Media(); |
|
163 CVtEngMediaHandler& handler = static_cast<CVtEngMediaHandler&>( msession ); |
|
164 |
|
165 // get API IF from extension |
|
166 error = iExtensions->GetClientInterface( &interfacePtr, aExtensionUid , |
|
167 handler ); |
|
168 |
|
169 // in case of error |
|
170 if ( error != KErrNone ) |
|
171 { |
|
172 __VTPRINTEXITR( "Model.Extension GetClientInterface failed %d", error) |
|
173 return NULL; |
|
174 } |
|
175 |
|
176 __VTPRINTEXIT( "Model.Extension" ) |
|
177 return interfacePtr; |
|
178 } |
|
179 |
|
180 // Engine's internal panic function |
|
181 void Panic( TVtEngPanic aPanic ) |
|
182 { |
|
183 __VTPRINT2( DEBUG_GEN, "EnginePanic %d", aPanic) |
|
184 User::Panic( KVtEngPanicCategory, aPanic ); |
|
185 } |
|
186 |
|
187 // ========================== OTHER EXPORTED FUNCTIONS ========================= |
|
188 |
|
189 // End of File |