|
1 /* |
|
2 * Copyright (c) 2002-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: Pure virtual command handler base class for ASY |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 // INCLUDE FILES |
|
20 #include "ASYProxyCommandObserver.h" |
|
21 #include "acc_debug.h" |
|
22 #include <AsyCommandHandlerBase.h> |
|
23 #include <e32svr.h> |
|
24 |
|
25 // EXTERNAL DATA STRUCTURES |
|
26 |
|
27 // EXTERNAL FUNCTION PROTOTYPES |
|
28 |
|
29 // CONSTANTS |
|
30 |
|
31 // MACROS |
|
32 |
|
33 // LOCAL CONSTANTS AND MACROS |
|
34 |
|
35 // MODULE DATA STRUCTURES |
|
36 |
|
37 // LOCAL FUNCTION PROTOTYPES |
|
38 |
|
39 // FORWARD DECLARATIONS |
|
40 |
|
41 // ============================= LOCAL FUNCTIONS =============================== |
|
42 |
|
43 // ============================ MEMBER FUNCTIONS =============================== |
|
44 |
|
45 // ----------------------------------------------------------------------------- |
|
46 // CASYCommandHandlerBase::CASYCommandHandlerBase |
|
47 // C++ default constructor can NOT contain any code, that |
|
48 // might leave. |
|
49 // ----------------------------------------------------------------------------- |
|
50 // |
|
51 EXPORT_C CASYCommandHandlerBase::CASYCommandHandlerBase() |
|
52 { |
|
53 API_TRACE_( "[AccFW:AsyProxy] CASYCommandHandlerBase::CASYCommandHandlerBase()" ); |
|
54 API_TRACE_( "[AccFW:AsyProxy] CASYCommandHandlerBase::CASYCommandHandlerBase" ); |
|
55 } |
|
56 |
|
57 // ----------------------------------------------------------------------------- |
|
58 // CASYCommandHandlerBase::ConstructL |
|
59 // Symbian 2nd phase constructor can leave. |
|
60 // ----------------------------------------------------------------------------- |
|
61 // |
|
62 void CASYCommandHandlerBase::ConstructL( |
|
63 CASYMainServiceBase* aAsyMainServiceBase, |
|
64 CASYProxyCommandObserver* aASYProxyCommandObserver ) |
|
65 { |
|
66 COM_TRACE_1( "[AccFW:AsyProxy] CASYCommandHandlerBase::ConstructL(0x%x)", aASYProxyCommandObserver ); |
|
67 |
|
68 iASYProxyCommandObserver = aASYProxyCommandObserver; |
|
69 iAsyMainServiceBase = aAsyMainServiceBase; |
|
70 |
|
71 COM_TRACE_( "[AccFW:AsyProxy] CASYCommandHandlerBase::ConstructL - return void" ); |
|
72 } |
|
73 |
|
74 // ----------------------------------------------------------------------------- |
|
75 // CASYCommandHandlerBase::NewL |
|
76 // Two-phased constructor. |
|
77 // ----------------------------------------------------------------------------- |
|
78 // |
|
79 CASYCommandHandlerBase* CASYCommandHandlerBase::NewL( |
|
80 CASYMainServiceBase* aAsyMainServiceBase, |
|
81 CASYProxyCommandObserver* aASYProxyCommandObserver, |
|
82 TUid aImplementationUidAsyHandler |
|
83 ) |
|
84 { |
|
85 COM_TRACE_1( "[AccFW:AsyProxy] CASYCommandHandlerBase::NewL(0x%x)", aASYProxyCommandObserver ); |
|
86 COM_TRACE_1( "[AccFW:AsyProxy] CASYCommandHandlerBase::NewL - Before REComSession::CreateImplementationL - 0x%x", aImplementationUidAsyHandler.iUid ); |
|
87 |
|
88 TAny* tmpEcom = NULL; |
|
89 |
|
90 #ifdef _DEBUG |
|
91 |
|
92 TRAPD( createErr, tmpEcom = REComSession::CreateImplementationL( |
|
93 aImplementationUidAsyHandler, |
|
94 _FOFF( CASYCommandHandlerBase, |
|
95 iDtor_ID_Key ) ) ); |
|
96 |
|
97 COM_TRACE_1( "[AccFW:AsyProxy] CASYCommandHandlerBase::NewL - After REComSession::CreateImplementationL - createErr == %d", createErr ); |
|
98 User::LeaveIfError( createErr ); |
|
99 |
|
100 #else |
|
101 |
|
102 tmpEcom = REComSession::CreateImplementationL( |
|
103 aImplementationUidAsyHandler, |
|
104 _FOFF( CASYCommandHandlerBase, |
|
105 iDtor_ID_Key ) ); |
|
106 |
|
107 #endif // _DEBUG |
|
108 |
|
109 CASYCommandHandlerBase* theChosenOne = NULL; |
|
110 |
|
111 if ( tmpEcom ) |
|
112 { |
|
113 theChosenOne = reinterpret_cast <CASYCommandHandlerBase*> ( tmpEcom ); |
|
114 theChosenOne->ConstructL( aAsyMainServiceBase, aASYProxyCommandObserver ); |
|
115 } |
|
116 |
|
117 COM_TRACE_1( "[AccFW:AsyProxy] CASYCommandHandlerBase::NewL - return 0x%x", &theChosenOne ); |
|
118 return theChosenOne; |
|
119 } |
|
120 |
|
121 // Destructor |
|
122 EXPORT_C CASYCommandHandlerBase::~CASYCommandHandlerBase() |
|
123 { |
|
124 API_TRACE_( "[AccFW:AsyProxy] CASYCommandHandlerBase::~CASYCommandHandlerBase()" ); |
|
125 |
|
126 REComSession::DestroyedImplementation(iDtor_ID_Key); |
|
127 |
|
128 API_TRACE_( "[AccFW:AsyProxy] CASYCommandHandlerBase::~CASYCommandHandlerBase" ); |
|
129 } |
|
130 |
|
131 // ----------------------------------------------------------------------------- |
|
132 // CASYCommandHandlerBase::ProcessCommandL |
|
133 // ASY implements |
|
134 // (other items were commented in a header). |
|
135 // ----------------------------------------------------------------------------- |
|
136 // |
|
137 EXPORT_C void CASYCommandHandlerBase::ProcessCommandL( |
|
138 const TProcessCmdId /*aCommand*/, |
|
139 const TASYCmdParams& /*aCmdParams*/ ) |
|
140 { |
|
141 // Pure virtual method |
|
142 } |
|
143 |
|
144 // ----------------------------------------------------------------------------- |
|
145 // CASYCommandHandlerBase::ProcessResponseL |
|
146 // Overloaded method for response of TBool -type |
|
147 // (other items were commented in a header). |
|
148 // ----------------------------------------------------------------------------- |
|
149 // |
|
150 EXPORT_C void CASYCommandHandlerBase::ProcessResponseL( |
|
151 const TAccValueTypeTBool aCmdResponse, |
|
152 const TInt aErrCode ) |
|
153 { |
|
154 API_TRACE_1( "[AccFW:AsyProxy] CASYCommandHandlerBase::ProcessResponseL( %d )", aCmdResponse ); |
|
155 API_TRACE_1( "[AccFW:AsyProxy] CASYCommandHandlerBase::ProcessResponseL( %d )", aErrCode ); |
|
156 |
|
157 iASYProxyCommandObserver->DoProcessResponseL( aCmdResponse, aErrCode ); |
|
158 |
|
159 API_TRACE_( "[AccFW:AsyProxy] CASYCommandHandlerBase::ProcessResponseL - return void" ); |
|
160 } |
|
161 |
|
162 // ----------------------------------------------------------------------------- |
|
163 // CASYCommandHandlerBase::ProcessResponseL |
|
164 // Overloaded method for response of TInt -type |
|
165 // (other items were commented in a header). |
|
166 // ----------------------------------------------------------------------------- |
|
167 // |
|
168 EXPORT_C void CASYCommandHandlerBase::ProcessResponseL( |
|
169 const TAccValueTypeTInt aCmdResponse, |
|
170 const TInt aErrCode ) |
|
171 { |
|
172 API_TRACE_1( "[AccFW:AsyProxy] CASYCommandHandlerBase::ProcessResponseL( %d )", aCmdResponse ); |
|
173 API_TRACE_1( "[AccFW:AsyProxy] CASYCommandHandlerBase::ProcessResponseL( %d )", aErrCode ); |
|
174 |
|
175 iASYProxyCommandObserver->DoProcessResponseL( aCmdResponse, aErrCode ); |
|
176 |
|
177 API_TRACE_( "[AccFW:AsyProxy] CASYCommandHandlerBase::ProcessResponseL - return void" ); |
|
178 } |
|
179 |
|
180 // ----------------------------------------------------------------------------- |
|
181 // CASYCommandHandlerBase::ProcessResponseL |
|
182 // Overloaded method for response of TDesC8 -type |
|
183 // (other items were commented in a header). |
|
184 // ----------------------------------------------------------------------------- |
|
185 // |
|
186 EXPORT_C void CASYCommandHandlerBase::ProcessResponseL( |
|
187 const TDesC8& aCmdResponse, |
|
188 const TInt aErrCode ) |
|
189 { |
|
190 #ifdef _DEBUG |
|
191 TBuf8<KTraceMaxSize> buf; |
|
192 TInt size( aCmdResponse.Size() ); |
|
193 if( size > KTraceMaxSize ) |
|
194 { |
|
195 size = KTraceMaxSize;//COM_TRACE_RAW_1 supports KTraceMaxSize |
|
196 } |
|
197 buf.Append(_L("[AccFW:AsyProxy] CASYCommandHandlerBase::ProcessResponseL(): ")); |
|
198 buf.Append( aCmdResponse.Ptr(), size ); |
|
199 COM_TRACE_RAW_( buf ); |
|
200 #endif // _DEBUG |
|
201 API_TRACE_1( "[AccFW:AsyProxy] CASYCommandHandlerBase::ProcessResponseL( %d )", aErrCode ); |
|
202 |
|
203 iASYProxyCommandObserver->DoProcessResponseL( aCmdResponse, aErrCode ); |
|
204 |
|
205 API_TRACE_( "[AccFW:AsyProxy] CASYCommandHandlerBase::ProcessResponseL - return void" ); |
|
206 } |
|
207 |
|
208 // ----------------------------------------------------------------------------- |
|
209 // CASYCommandHandlerBase::ProcessResponseL |
|
210 // Overloaded method for response of CAccPolObjectBase -type |
|
211 // ----------------------------------------------------------------------------- |
|
212 // |
|
213 EXPORT_C void CASYCommandHandlerBase::ProcessResponseL( const CAccPolObjectCon& aObjectCon, const TInt aErrCode ) |
|
214 { |
|
215 |
|
216 API_TRACE_( "[AccFW:AsyProxy] CASYCommandHandlerBase::ProcessResponseL()" ); |
|
217 |
|
218 iASYProxyCommandObserver->DoProcessResponseL( aObjectCon, aErrCode ); |
|
219 |
|
220 API_TRACE_( "[AccFW:AsyProxy] CASYCommandHandlerBase::ProcessResponseL - return void" ); |
|
221 |
|
222 } |
|
223 |
|
224 // ----------------------------------------------------------------------------- |
|
225 // CASYCommandHandlerBase::ObjectConDataFromProxyL |
|
226 // (other items were commented in a header). |
|
227 // ----------------------------------------------------------------------------- |
|
228 // |
|
229 EXPORT_C void CASYCommandHandlerBase::ObjectConDataFromProxyL( CAccPolObjectCon& aObjectCon ) const |
|
230 { |
|
231 API_TRACE_( "[AccFW:AsyProxy] CASYCommandHandlerBase::ObjectConDataFromProxyL()" ); |
|
232 |
|
233 iASYProxyCommandObserver->DoObjectContainerFromProxyL( aObjectCon ); |
|
234 |
|
235 API_TRACE_( "[AccFW:AsyProxy] CASYCommandHandlerBase::ObjectConDataFromProxyL - return void" ); |
|
236 } |
|
237 |
|
238 // ----------------------------------------------------------------------------- |
|
239 // CASYCommandHandlerBase::ASYMainServiceBase |
|
240 // Returns pointer of CASYMainServiceBase -object |
|
241 // (other items were commented in a header). |
|
242 // ----------------------------------------------------------------------------- |
|
243 // |
|
244 EXPORT_C CASYMainServiceBase* CASYCommandHandlerBase::ASYMainServiceBase() |
|
245 { |
|
246 return iAsyMainServiceBase; |
|
247 } |
|
248 |
|
249 // ========================== OTHER EXPORTED FUNCTIONS ========================= |
|
250 |
|
251 // End of File |