sl@0
|
1 |
/*
|
sl@0
|
2 |
* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
|
sl@0
|
3 |
* All rights reserved.
|
sl@0
|
4 |
* This component and the accompanying materials are made available
|
sl@0
|
5 |
* under the terms of "Eclipse Public License v1.0"
|
sl@0
|
6 |
* which accompanies this distribution, and is available
|
sl@0
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
sl@0
|
8 |
*
|
sl@0
|
9 |
* Initial Contributors:
|
sl@0
|
10 |
* Nokia Corporation - initial contribution.
|
sl@0
|
11 |
*
|
sl@0
|
12 |
* Contributors:
|
sl@0
|
13 |
*
|
sl@0
|
14 |
* Description:
|
sl@0
|
15 |
*
|
sl@0
|
16 |
*/
|
sl@0
|
17 |
|
sl@0
|
18 |
|
sl@0
|
19 |
|
sl@0
|
20 |
#include "T_EComSessionData.h"
|
sl@0
|
21 |
#include "T_ImplementationInformationData.h"
|
sl@0
|
22 |
#include "TestEComInterface.h"
|
sl@0
|
23 |
|
sl@0
|
24 |
/*@{*/
|
sl@0
|
25 |
/// Parameters
|
sl@0
|
26 |
_LIT(KUid, "uid");
|
sl@0
|
27 |
_LIT(KResolver, "resolver");
|
sl@0
|
28 |
_LIT(KExpectedResult, "expected");
|
sl@0
|
29 |
_LIT(KResolverUid, "resolver_uid");
|
sl@0
|
30 |
_LIT(KOffset, "offset");
|
sl@0
|
31 |
_LIT(KInteger, "integer");
|
sl@0
|
32 |
_LIT(KDescriptor, "descriptor");
|
sl@0
|
33 |
_LIT(KEmpty, "empty");
|
sl@0
|
34 |
_LIT(KSaveTo, "saveto");
|
sl@0
|
35 |
_LIT(KSaveIndex, "saveindex");
|
sl@0
|
36 |
|
sl@0
|
37 |
/// REComSession
|
sl@0
|
38 |
_LIT(KCmdOpenL, "OpenL");
|
sl@0
|
39 |
_LIT(KCmdClose, "Close");
|
sl@0
|
40 |
_LIT(KCmdFinalClose, "FinalClose");
|
sl@0
|
41 |
_LIT(KCmdNotifyOnChange, "NotifyOnChange");
|
sl@0
|
42 |
_LIT(KCmdCancelNotifyOnChange, "CancelNotifyOnChange");
|
sl@0
|
43 |
_LIT(KCmdListImplementationsL, "ListImplementationsL");
|
sl@0
|
44 |
_LIT(KCmdCreateImplementationL, "CreateImplementationL");
|
sl@0
|
45 |
_LIT(KCmdDestroyedImplementation, "DestroyedImplementation");
|
sl@0
|
46 |
_LIT(KCmdClean, "~");
|
sl@0
|
47 |
|
sl@0
|
48 |
_LIT(KEmptyString, "");
|
sl@0
|
49 |
_LIT(KDefault, "default");
|
sl@0
|
50 |
/*@}*/
|
sl@0
|
51 |
|
sl@0
|
52 |
//////////////////////////////////////////////////////////////////////
|
sl@0
|
53 |
// Construction/Destruction
|
sl@0
|
54 |
//////////////////////////////////////////////////////////////////////
|
sl@0
|
55 |
|
sl@0
|
56 |
/**
|
sl@0
|
57 |
* Two phase constructor
|
sl@0
|
58 |
*/
|
sl@0
|
59 |
CT_EComSessionData* CT_EComSessionData::NewL()
|
sl@0
|
60 |
{
|
sl@0
|
61 |
CT_EComSessionData* ret=new (ELeave) CT_EComSessionData();
|
sl@0
|
62 |
CleanupStack::PushL(ret);
|
sl@0
|
63 |
ret->ConstructL();
|
sl@0
|
64 |
CleanupStack::Pop(ret);
|
sl@0
|
65 |
return ret;
|
sl@0
|
66 |
}
|
sl@0
|
67 |
|
sl@0
|
68 |
/**
|
sl@0
|
69 |
* Constructor. First phase construction
|
sl@0
|
70 |
*/
|
sl@0
|
71 |
CT_EComSessionData::CT_EComSessionData()
|
sl@0
|
72 |
: iActiveNotifyOnChange(NULL)
|
sl@0
|
73 |
, iImplementationInterface(NULL)
|
sl@0
|
74 |
{
|
sl@0
|
75 |
iInitParams.iInteger=0;
|
sl@0
|
76 |
iInitParams.iDescriptor=&iInterfaceDesc;
|
sl@0
|
77 |
}
|
sl@0
|
78 |
|
sl@0
|
79 |
/**
|
sl@0
|
80 |
* Second phase construction
|
sl@0
|
81 |
*/
|
sl@0
|
82 |
void CT_EComSessionData::ConstructL()
|
sl@0
|
83 |
{
|
sl@0
|
84 |
iInterfaceDesc=KEmptyString;
|
sl@0
|
85 |
iDTorKey=TUid::Uid(0);
|
sl@0
|
86 |
iActiveNotifyOnChange=CActiveCallback::NewL(*this);
|
sl@0
|
87 |
}
|
sl@0
|
88 |
|
sl@0
|
89 |
/**
|
sl@0
|
90 |
* Public destructor
|
sl@0
|
91 |
*/
|
sl@0
|
92 |
CT_EComSessionData::~CT_EComSessionData()
|
sl@0
|
93 |
{
|
sl@0
|
94 |
DestroyData();
|
sl@0
|
95 |
iInfoArray.ResetAndDestroy();
|
sl@0
|
96 |
iInfoArray.Close();
|
sl@0
|
97 |
delete iActiveNotifyOnChange;
|
sl@0
|
98 |
iActiveNotifyOnChange=NULL;
|
sl@0
|
99 |
}
|
sl@0
|
100 |
|
sl@0
|
101 |
TAny* CT_EComSessionData::GetObject()
|
sl@0
|
102 |
/**
|
sl@0
|
103 |
* Return a pointer to the object that the data wraps
|
sl@0
|
104 |
*
|
sl@0
|
105 |
* @return Pointer to the object that the data wraps
|
sl@0
|
106 |
*/
|
sl@0
|
107 |
{
|
sl@0
|
108 |
return &iSession;
|
sl@0
|
109 |
}
|
sl@0
|
110 |
|
sl@0
|
111 |
void CT_EComSessionData::DestroyData()
|
sl@0
|
112 |
{
|
sl@0
|
113 |
if (iImplementationInterface)
|
sl@0
|
114 |
{
|
sl@0
|
115 |
delete static_cast<CBase*>(iImplementationInterface);
|
sl@0
|
116 |
iImplementationInterface=NULL;
|
sl@0
|
117 |
};
|
sl@0
|
118 |
}
|
sl@0
|
119 |
|
sl@0
|
120 |
//////////////////////////////////////////////////////////////////////
|
sl@0
|
121 |
// Read data from INI file
|
sl@0
|
122 |
//////////////////////////////////////////////////////////////////////
|
sl@0
|
123 |
|
sl@0
|
124 |
void CT_EComSessionData::GetUid(const TDesC& aSection, TUid& aUid)
|
sl@0
|
125 |
{
|
sl@0
|
126 |
TInt uidValue=0;
|
sl@0
|
127 |
|
sl@0
|
128 |
GetHexFromConfig(aSection, KUid(), uidValue );
|
sl@0
|
129 |
aUid = TUid::Uid(uidValue);
|
sl@0
|
130 |
}
|
sl@0
|
131 |
|
sl@0
|
132 |
TBool CT_EComSessionData::GetResolver(const TDesC& aSection, TPtrC& aResolver)
|
sl@0
|
133 |
{
|
sl@0
|
134 |
return GetStringFromConfig(aSection, KResolver(), aResolver);
|
sl@0
|
135 |
}
|
sl@0
|
136 |
|
sl@0
|
137 |
TBool CT_EComSessionData::GetResolverUid(const TDesC& aSection, TUid& aUid)
|
sl@0
|
138 |
{
|
sl@0
|
139 |
TInt uidValue=0;
|
sl@0
|
140 |
TBool ret=GetHexFromConfig(aSection, KResolverUid(), uidValue );
|
sl@0
|
141 |
aUid = TUid::Uid(uidValue);
|
sl@0
|
142 |
return ret;
|
sl@0
|
143 |
}
|
sl@0
|
144 |
|
sl@0
|
145 |
TBool CT_EComSessionData::GetEmpty(const TDesC& aSection, TBool& aEmpty)
|
sl@0
|
146 |
{
|
sl@0
|
147 |
aEmpty = EFalse;
|
sl@0
|
148 |
return GetBoolFromConfig(aSection, KEmpty(), aEmpty );
|
sl@0
|
149 |
}
|
sl@0
|
150 |
|
sl@0
|
151 |
TBool CT_EComSessionData::GetExpectedResult(const TDesC& aSection, TInt& aExpectedResult)
|
sl@0
|
152 |
{
|
sl@0
|
153 |
aExpectedResult = 0;
|
sl@0
|
154 |
return GetIntFromConfig(aSection, KExpectedResult(), aExpectedResult );
|
sl@0
|
155 |
}
|
sl@0
|
156 |
|
sl@0
|
157 |
TBool CT_EComSessionData::GetOffset(const TDesC& aSection, TInt& aOffset)
|
sl@0
|
158 |
{
|
sl@0
|
159 |
aOffset=_FOFF(CTestEComInterface, iDtor_ID_Key);
|
sl@0
|
160 |
|
sl@0
|
161 |
TPtrC offset;
|
sl@0
|
162 |
TBool ret=GetStringFromConfig(aSection, KOffset(), offset);
|
sl@0
|
163 |
if ( ret )
|
sl@0
|
164 |
{
|
sl@0
|
165 |
if ( offset == KDefault )
|
sl@0
|
166 |
{
|
sl@0
|
167 |
INFO_PRINTF2(_L("Default offset %d"), aOffset);
|
sl@0
|
168 |
}
|
sl@0
|
169 |
else
|
sl@0
|
170 |
{
|
sl@0
|
171 |
ret=GetIntFromConfig(aSection, KOffset(), aOffset);
|
sl@0
|
172 |
}
|
sl@0
|
173 |
}
|
sl@0
|
174 |
|
sl@0
|
175 |
return ret;
|
sl@0
|
176 |
}
|
sl@0
|
177 |
|
sl@0
|
178 |
TBool CT_EComSessionData::GetDescriptor(const TDesC& aSection, TPtrC& aDescriptor)
|
sl@0
|
179 |
{
|
sl@0
|
180 |
aDescriptor.Set(KEmptyString);
|
sl@0
|
181 |
return GetStringFromConfig(aSection, KDescriptor(), aDescriptor );
|
sl@0
|
182 |
}
|
sl@0
|
183 |
|
sl@0
|
184 |
TBool CT_EComSessionData::GetInteger(const TDesC& aSection, TInt& aInt)
|
sl@0
|
185 |
{
|
sl@0
|
186 |
return GetIntFromConfig(aSection, KInteger(), aInt );
|
sl@0
|
187 |
}
|
sl@0
|
188 |
|
sl@0
|
189 |
|
sl@0
|
190 |
TBool CT_EComSessionData::DoCommandL(const TTEFFunction& aCommand, const TTEFSectionName& aSection, const TInt aAsyncErrorIndex)
|
sl@0
|
191 |
/**
|
sl@0
|
192 |
* Process a command read from the ini file
|
sl@0
|
193 |
*
|
sl@0
|
194 |
* @param aCommand The command to process
|
sl@0
|
195 |
* @param aSection The section in the ini containing data for the command
|
sl@0
|
196 |
* @param aAsyncErrorIndex Command index for async calls to return errors to
|
sl@0
|
197 |
*
|
sl@0
|
198 |
* @return ETrue if the command is processed
|
sl@0
|
199 |
* @pre N/A
|
sl@0
|
200 |
* @post N/A
|
sl@0
|
201 |
*
|
sl@0
|
202 |
* @leave System wide error
|
sl@0
|
203 |
*/
|
sl@0
|
204 |
{
|
sl@0
|
205 |
TBool retVal=ETrue;
|
sl@0
|
206 |
|
sl@0
|
207 |
if ( aCommand==KCmdOpenL )
|
sl@0
|
208 |
{
|
sl@0
|
209 |
DoCmdOpenL();
|
sl@0
|
210 |
}
|
sl@0
|
211 |
else if ( aCommand==KCmdClose )
|
sl@0
|
212 |
{
|
sl@0
|
213 |
DoCmdClose();
|
sl@0
|
214 |
}
|
sl@0
|
215 |
else if ( aCommand==KCmdFinalClose )
|
sl@0
|
216 |
{
|
sl@0
|
217 |
DoCmdFinalClose();
|
sl@0
|
218 |
}
|
sl@0
|
219 |
else if ( aCommand==KCmdNotifyOnChange )
|
sl@0
|
220 |
{
|
sl@0
|
221 |
DoCmdNotifyOnChange(aAsyncErrorIndex);
|
sl@0
|
222 |
}
|
sl@0
|
223 |
else if ( aCommand==KCmdCancelNotifyOnChange )
|
sl@0
|
224 |
{
|
sl@0
|
225 |
DoCmdCancelNotifyOnChange();
|
sl@0
|
226 |
}
|
sl@0
|
227 |
else if ( aCommand==KCmdListImplementationsL )
|
sl@0
|
228 |
{
|
sl@0
|
229 |
DoCmdListImplementationsL(aSection);
|
sl@0
|
230 |
}
|
sl@0
|
231 |
else if ( aCommand==KCmdCreateImplementationL )
|
sl@0
|
232 |
{
|
sl@0
|
233 |
DoCmdCreateImplementationL(aSection);
|
sl@0
|
234 |
}
|
sl@0
|
235 |
else if ( aCommand==KCmdDestroyedImplementation )
|
sl@0
|
236 |
{
|
sl@0
|
237 |
DoCmdDestroyedImplementation(aSection);
|
sl@0
|
238 |
}
|
sl@0
|
239 |
else if ( aCommand==KCmdClean )
|
sl@0
|
240 |
{
|
sl@0
|
241 |
DestroyData();
|
sl@0
|
242 |
}
|
sl@0
|
243 |
else
|
sl@0
|
244 |
{
|
sl@0
|
245 |
retVal=EFalse;
|
sl@0
|
246 |
}
|
sl@0
|
247 |
return retVal;
|
sl@0
|
248 |
}
|
sl@0
|
249 |
|
sl@0
|
250 |
void CT_EComSessionData::DoCmdOpenL()
|
sl@0
|
251 |
{
|
sl@0
|
252 |
INFO_PRINTF1(_L("OpenL Call"));
|
sl@0
|
253 |
TRAPD ( err, iSession = REComSession::OpenL() );
|
sl@0
|
254 |
if ( err!=KErrNone )
|
sl@0
|
255 |
{
|
sl@0
|
256 |
ERR_PRINTF2(_L("OpenL Error %d"), err);
|
sl@0
|
257 |
SetError(err);
|
sl@0
|
258 |
}
|
sl@0
|
259 |
else
|
sl@0
|
260 |
{
|
sl@0
|
261 |
INFO_PRINTF1(_L("Session opened"));
|
sl@0
|
262 |
}
|
sl@0
|
263 |
}
|
sl@0
|
264 |
|
sl@0
|
265 |
void CT_EComSessionData::DoCmdClose()
|
sl@0
|
266 |
{
|
sl@0
|
267 |
INFO_PRINTF1(_L("Close"));
|
sl@0
|
268 |
iSession.Close();
|
sl@0
|
269 |
}
|
sl@0
|
270 |
|
sl@0
|
271 |
void CT_EComSessionData::DoCmdFinalClose()
|
sl@0
|
272 |
{
|
sl@0
|
273 |
INFO_PRINTF1(_L("Final Close"));
|
sl@0
|
274 |
REComSession::FinalClose();
|
sl@0
|
275 |
}
|
sl@0
|
276 |
|
sl@0
|
277 |
void CT_EComSessionData::DoCmdNotifyOnChange(const TInt aIndex)
|
sl@0
|
278 |
{
|
sl@0
|
279 |
INFO_PRINTF1(_L("NotifyOnChange"));
|
sl@0
|
280 |
iSession.NotifyOnChange(iActiveNotifyOnChange->iStatus);
|
sl@0
|
281 |
iActiveNotifyOnChange->Activate(aIndex);
|
sl@0
|
282 |
IncOutstanding();
|
sl@0
|
283 |
}
|
sl@0
|
284 |
|
sl@0
|
285 |
void CT_EComSessionData::DoCmdCancelNotifyOnChange()
|
sl@0
|
286 |
{
|
sl@0
|
287 |
INFO_PRINTF1(_L("CancelNotifyOnChange"));
|
sl@0
|
288 |
iSession.CancelNotifyOnChange(iActiveNotifyOnChange->iStatus);
|
sl@0
|
289 |
}
|
sl@0
|
290 |
|
sl@0
|
291 |
// Found defects:
|
sl@0
|
292 |
// 1. ListImplementationsL with impossible aResolutionParameters argument don't leave
|
sl@0
|
293 |
// Status: possible defect
|
sl@0
|
294 |
void CT_EComSessionData::DoCmdListImplementationsL(const TDesC& aSection)
|
sl@0
|
295 |
{
|
sl@0
|
296 |
INFO_PRINTF1(_L("Getting Implementnation List"));
|
sl@0
|
297 |
|
sl@0
|
298 |
TUid impUid;
|
sl@0
|
299 |
GetUid(aSection, impUid);
|
sl@0
|
300 |
|
sl@0
|
301 |
TUid resolverUid;
|
sl@0
|
302 |
TBool hasResolverUid=GetResolverUid(aSection, resolverUid);
|
sl@0
|
303 |
|
sl@0
|
304 |
TInt err = KErrNone;
|
sl@0
|
305 |
|
sl@0
|
306 |
TPtrC resolver;
|
sl@0
|
307 |
TBool hasResolver=GetResolver(aSection, resolver);
|
sl@0
|
308 |
if ( hasResolver )
|
sl@0
|
309 |
{
|
sl@0
|
310 |
TEComResolverParams* resolverParams=static_cast<TEComResolverParams*>(GetDataObjectL(resolver));
|
sl@0
|
311 |
if ( hasResolverUid )
|
sl@0
|
312 |
{
|
sl@0
|
313 |
INFO_PRINTF1(_L("Getting Implementnation List(3) by Uid, ResolverParams as a filter params && Resolver Uid as a filter"));
|
sl@0
|
314 |
TRAP(err, REComSession::ListImplementationsL(impUid, *resolverParams, resolverUid, iInfoArray));
|
sl@0
|
315 |
}
|
sl@0
|
316 |
else
|
sl@0
|
317 |
{
|
sl@0
|
318 |
INFO_PRINTF1(_L("Getting Implementnation List(1) by Uid && ResolverParams as a filter"));
|
sl@0
|
319 |
TRAP(err, REComSession::ListImplementationsL(impUid, *resolverParams, iInfoArray));
|
sl@0
|
320 |
}
|
sl@0
|
321 |
}
|
sl@0
|
322 |
else
|
sl@0
|
323 |
{
|
sl@0
|
324 |
INFO_PRINTF1(_L("Getting Implementnation List(2) by Uid"));
|
sl@0
|
325 |
TRAP(err, REComSession::ListImplementationsL(impUid, iInfoArray));
|
sl@0
|
326 |
}
|
sl@0
|
327 |
|
sl@0
|
328 |
if ( err==KErrNone )
|
sl@0
|
329 |
{
|
sl@0
|
330 |
// Check to see if we the data object has to be set in a CT_ImplementationInformationData
|
sl@0
|
331 |
TPtrC saveTo;
|
sl@0
|
332 |
if ( GetStringFromConfig(aSection, KSaveTo(), saveTo) )
|
sl@0
|
333 |
{
|
sl@0
|
334 |
TInt index=0;
|
sl@0
|
335 |
GetIntFromConfig(aSection, KSaveIndex(), index);
|
sl@0
|
336 |
CDataWrapper* wrapper=static_cast<CDataWrapper*>(GetDataWrapperL(saveTo));
|
sl@0
|
337 |
wrapper->SetObjectL(iInfoArray[index]);
|
sl@0
|
338 |
}
|
sl@0
|
339 |
}
|
sl@0
|
340 |
|
sl@0
|
341 |
if( err != KErrNone )
|
sl@0
|
342 |
{
|
sl@0
|
343 |
ERR_PRINTF2(_L("Failed to get implementation list with error %d"), err);
|
sl@0
|
344 |
SetError(err);
|
sl@0
|
345 |
}
|
sl@0
|
346 |
else
|
sl@0
|
347 |
{
|
sl@0
|
348 |
TInt expectedResult;
|
sl@0
|
349 |
if ( GetExpectedResult(aSection, expectedResult) )
|
sl@0
|
350 |
{
|
sl@0
|
351 |
if (iInfoArray.Count() != expectedResult)
|
sl@0
|
352 |
{
|
sl@0
|
353 |
ERR_PRINTF3(_L("List retrieved. Found %d imlementations, expected %d"),
|
sl@0
|
354 |
iInfoArray.Count(), expectedResult );
|
sl@0
|
355 |
SetBlockResult(EFail);
|
sl@0
|
356 |
}
|
sl@0
|
357 |
}
|
sl@0
|
358 |
|
sl@0
|
359 |
for (TInt i = 0; i < iInfoArray.Count(); i++)
|
sl@0
|
360 |
{
|
sl@0
|
361 |
const TDesC8& name8=iInfoArray[i]->DataType();
|
sl@0
|
362 |
TBuf<KMaxTestExecuteCommandLength> name16;
|
sl@0
|
363 |
name16.Copy(name8);
|
sl@0
|
364 |
INFO_PRINTF3(_L("Implementation UID %d: - \"%S\""), iInfoArray[i]->ImplementationUid().iUid, &(iInfoArray[i]->DisplayName()));
|
sl@0
|
365 |
INFO_PRINTF2(_L("Data Type is \"%S\""), &name16);
|
sl@0
|
366 |
};
|
sl@0
|
367 |
}
|
sl@0
|
368 |
}
|
sl@0
|
369 |
|
sl@0
|
370 |
// Found defects:
|
sl@0
|
371 |
// 1. CreateImplementationL with any aKeyOffset argument - aKeyOffset can have any value (-1, 0, 10000, ...)
|
sl@0
|
372 |
// but CreateImplementationL returns no error and generates memory leak.
|
sl@0
|
373 |
// Status: possible defects
|
sl@0
|
374 |
// 2. CreateImplementationL with impossible aResolutionParameters argument - returns KErrnotFound, but in documentation
|
sl@0
|
375 |
// CreateImplementationL levaes only with KErrNoMemory, KErrNotConnected, KErrArgument or KErrPermissionDenied error
|
sl@0
|
376 |
// Status: documentation defect
|
sl@0
|
377 |
void CT_EComSessionData::DoCmdCreateImplementationL(const TDesC& aSection)
|
sl@0
|
378 |
{
|
sl@0
|
379 |
DestroyData();
|
sl@0
|
380 |
|
sl@0
|
381 |
TUid impUid;
|
sl@0
|
382 |
GetUid(aSection,impUid);
|
sl@0
|
383 |
|
sl@0
|
384 |
TInt offset;
|
sl@0
|
385 |
TBool hasOffset=GetOffset(aSection,offset);
|
sl@0
|
386 |
|
sl@0
|
387 |
TUid resolverUid;
|
sl@0
|
388 |
TBool hasResolverUid=GetResolverUid(aSection, resolverUid);
|
sl@0
|
389 |
|
sl@0
|
390 |
TBool hasIntegerValue=GetInteger(aSection, iInitParams.iInteger);
|
sl@0
|
391 |
|
sl@0
|
392 |
TBool emptyArgs;
|
sl@0
|
393 |
TBool hasEmptyArgs=GetEmpty(aSection, emptyArgs);
|
sl@0
|
394 |
|
sl@0
|
395 |
TBool hasInitParams=hasIntegerValue || hasEmptyArgs;
|
sl@0
|
396 |
TAny* initParamsPtr=NULL;
|
sl@0
|
397 |
if (hasInitParams)
|
sl@0
|
398 |
{
|
sl@0
|
399 |
if (!emptyArgs)
|
sl@0
|
400 |
{
|
sl@0
|
401 |
initParamsPtr=&iInitParams;
|
sl@0
|
402 |
}
|
sl@0
|
403 |
}
|
sl@0
|
404 |
|
sl@0
|
405 |
TInt err = KErrNone;
|
sl@0
|
406 |
TBool getKeyFromOffset=EFalse;
|
sl@0
|
407 |
|
sl@0
|
408 |
TPtrC resolver;
|
sl@0
|
409 |
if ( GetResolver(aSection, resolver) )
|
sl@0
|
410 |
{
|
sl@0
|
411 |
TEComResolverParams* resolverParams=static_cast<TEComResolverParams*>(GetDataObjectL(resolver));
|
sl@0
|
412 |
if (hasResolverUid && hasInitParams && hasOffset)
|
sl@0
|
413 |
{
|
sl@0
|
414 |
INFO_PRINTF1(_L("Creating Implementnation(12) by Interface Uid, Offset, Init Params, ResolverParams as a filter params && Resolver Uid as a filter"));
|
sl@0
|
415 |
|
sl@0
|
416 |
TRAP( err, iImplementationInterface =
|
sl@0
|
417 |
REComSession::CreateImplementationL(impUid, offset, initParamsPtr, *resolverParams, resolverUid));
|
sl@0
|
418 |
getKeyFromOffset=(err==KErrNone);
|
sl@0
|
419 |
}
|
sl@0
|
420 |
else if (hasResolverUid && hasInitParams)
|
sl@0
|
421 |
{
|
sl@0
|
422 |
INFO_PRINTF1(_L("Creating Implementnation(11) by Interface Uid, Init Params, ResolverParams as a filter params && Resolver Uid as a filter"));
|
sl@0
|
423 |
TRAP( err, iImplementationInterface =
|
sl@0
|
424 |
REComSession::CreateImplementationL(impUid, iDTorKey, initParamsPtr, *resolverParams, resolverUid));
|
sl@0
|
425 |
}
|
sl@0
|
426 |
else if (hasResolverUid && hasOffset)
|
sl@0
|
427 |
{
|
sl@0
|
428 |
INFO_PRINTF1(_L("Creating Implementnation(10) by Interface Uid, Offset, ResolverParams as a filter params && Resolver Uid as a filter"));
|
sl@0
|
429 |
TRAP( err, iImplementationInterface =
|
sl@0
|
430 |
REComSession::CreateImplementationL(impUid, offset, *resolverParams, resolverUid));
|
sl@0
|
431 |
getKeyFromOffset=(err==KErrNone);
|
sl@0
|
432 |
}
|
sl@0
|
433 |
else if (hasResolverUid)
|
sl@0
|
434 |
{
|
sl@0
|
435 |
INFO_PRINTF1(_L("Creating Implementnation(9) by Interface Uid, ResolverParams as a filter params && Resolver Uid as a filter"));
|
sl@0
|
436 |
TRAP( err, iImplementationInterface =
|
sl@0
|
437 |
REComSession::CreateImplementationL(impUid, iDTorKey, *resolverParams, resolverUid));
|
sl@0
|
438 |
}
|
sl@0
|
439 |
else if (hasInitParams && hasOffset)
|
sl@0
|
440 |
{
|
sl@0
|
441 |
INFO_PRINTF1(_L("Creating Implementnation(8) by Interface Uid, Offset, Init Params && Resolver Parameters as a filter"));
|
sl@0
|
442 |
TRAP( err, iImplementationInterface =
|
sl@0
|
443 |
REComSession::CreateImplementationL(impUid, offset, initParamsPtr, *resolverParams));
|
sl@0
|
444 |
|
sl@0
|
445 |
getKeyFromOffset=(err==KErrNone);
|
sl@0
|
446 |
}
|
sl@0
|
447 |
else if (hasInitParams)
|
sl@0
|
448 |
{
|
sl@0
|
449 |
INFO_PRINTF1(_L("Creating Implementnation(7) by Interface Uid, Init Params && Resolver Parameters as a filter"));
|
sl@0
|
450 |
TRAP( err, iImplementationInterface =
|
sl@0
|
451 |
REComSession::CreateImplementationL(impUid, iDTorKey, initParamsPtr, *resolverParams));
|
sl@0
|
452 |
}
|
sl@0
|
453 |
else if (hasOffset)
|
sl@0
|
454 |
{
|
sl@0
|
455 |
INFO_PRINTF1(_L("Creating Implementnation(6) by Interface Uid, Offset && Resolver Parameters as a filter"));
|
sl@0
|
456 |
|
sl@0
|
457 |
TRAP( err, iImplementationInterface =
|
sl@0
|
458 |
REComSession::CreateImplementationL(impUid, offset, *resolverParams));
|
sl@0
|
459 |
|
sl@0
|
460 |
getKeyFromOffset=(err==KErrNone);
|
sl@0
|
461 |
}
|
sl@0
|
462 |
else
|
sl@0
|
463 |
{
|
sl@0
|
464 |
INFO_PRINTF1(_L("Creating Implementnation(5) by Interface Uid && Resolver Parameters as a filter"));
|
sl@0
|
465 |
|
sl@0
|
466 |
TRAP( err, iImplementationInterface =
|
sl@0
|
467 |
REComSession::CreateImplementationL(impUid, iDTorKey, *resolverParams));
|
sl@0
|
468 |
|
sl@0
|
469 |
}
|
sl@0
|
470 |
}
|
sl@0
|
471 |
else
|
sl@0
|
472 |
{
|
sl@0
|
473 |
if (hasInitParams && hasOffset)
|
sl@0
|
474 |
{
|
sl@0
|
475 |
INFO_PRINTF1(_L("Creating Implementnation(4) by Uid, Offset && Construction Parameters"));
|
sl@0
|
476 |
|
sl@0
|
477 |
TRAP( err, iImplementationInterface =
|
sl@0
|
478 |
REComSession::CreateImplementationL(impUid, offset, initParamsPtr));
|
sl@0
|
479 |
|
sl@0
|
480 |
getKeyFromOffset=(err==KErrNone);
|
sl@0
|
481 |
}
|
sl@0
|
482 |
else if (hasInitParams)
|
sl@0
|
483 |
{
|
sl@0
|
484 |
INFO_PRINTF1(_L("Creating Implementnation(3) by Uid && Construction Parameters"));
|
sl@0
|
485 |
|
sl@0
|
486 |
TRAP( err, iImplementationInterface =
|
sl@0
|
487 |
REComSession::CreateImplementationL(impUid, iDTorKey, initParamsPtr));
|
sl@0
|
488 |
|
sl@0
|
489 |
}
|
sl@0
|
490 |
else if (hasOffset)
|
sl@0
|
491 |
{
|
sl@0
|
492 |
INFO_PRINTF1(_L("Creating Implementnation(2) by Uid && offset defined by interface"));
|
sl@0
|
493 |
|
sl@0
|
494 |
TRAP( err, iImplementationInterface =
|
sl@0
|
495 |
REComSession::CreateImplementationL(impUid, offset));
|
sl@0
|
496 |
|
sl@0
|
497 |
getKeyFromOffset=(err==KErrNone);
|
sl@0
|
498 |
}
|
sl@0
|
499 |
else
|
sl@0
|
500 |
{
|
sl@0
|
501 |
INFO_PRINTF1(_L("Creating Implementnation(1) by Uid"));
|
sl@0
|
502 |
|
sl@0
|
503 |
TRAP( err, iImplementationInterface =
|
sl@0
|
504 |
REComSession::CreateImplementationL(impUid, iDTorKey ));
|
sl@0
|
505 |
|
sl@0
|
506 |
}
|
sl@0
|
507 |
}
|
sl@0
|
508 |
|
sl@0
|
509 |
if ( getKeyFromOffset )
|
sl@0
|
510 |
{
|
sl@0
|
511 |
TUint8* uidPtr=REINTERPRET_CAST(TUint8*, iImplementationInterface) + offset;
|
sl@0
|
512 |
TUid* uid=REINTERPRET_CAST(TUid*, uidPtr);
|
sl@0
|
513 |
iDTorKey=*uid;
|
sl@0
|
514 |
*uid=TUid::Null();
|
sl@0
|
515 |
}
|
sl@0
|
516 |
|
sl@0
|
517 |
INFO_PRINTF2(_L("Implementation created successfully. iDTorKey is %d"), iDTorKey.iUid);
|
sl@0
|
518 |
if (BlockResult()==EPass)
|
sl@0
|
519 |
{
|
sl@0
|
520 |
if( err != KErrNone )
|
sl@0
|
521 |
{
|
sl@0
|
522 |
ERR_PRINTF2(_L("Failed to create implementation with error %d"), err);
|
sl@0
|
523 |
SetError(err);
|
sl@0
|
524 |
if (iImplementationInterface != NULL)
|
sl@0
|
525 |
{
|
sl@0
|
526 |
SetBlockResult(EFail);
|
sl@0
|
527 |
ERR_PRINTF1(_L("Data verification failed: CreateImplementationL returns an error, but implementation was created"));
|
sl@0
|
528 |
}
|
sl@0
|
529 |
else
|
sl@0
|
530 |
{
|
sl@0
|
531 |
INFO_PRINTF1(_L("Data verification succcess: CreateImplementationL returns an error and implementation was not created as expected"));
|
sl@0
|
532 |
}
|
sl@0
|
533 |
}
|
sl@0
|
534 |
}
|
sl@0
|
535 |
}
|
sl@0
|
536 |
|
sl@0
|
537 |
void CT_EComSessionData::DoCmdDestroyedImplementation(const TDesC& aSection)
|
sl@0
|
538 |
{
|
sl@0
|
539 |
TInt uidValue;
|
sl@0
|
540 |
if ( GetIntFromConfig(aSection, KUid(), uidValue) )
|
sl@0
|
541 |
{
|
sl@0
|
542 |
iDTorKey = TUid::Uid(uidValue);
|
sl@0
|
543 |
}
|
sl@0
|
544 |
|
sl@0
|
545 |
INFO_PRINTF2(_L("Destroy Interface Implementation. UID is %d"), iDTorKey.iUid);
|
sl@0
|
546 |
REComSession::DestroyedImplementation(iDTorKey);
|
sl@0
|
547 |
INFO_PRINTF1(_L("REComSession::DestroyedImplementation(iDTorKey) completed"));
|
sl@0
|
548 |
DestroyData();
|
sl@0
|
549 |
INFO_PRINTF1(_L("Interface implementation destroyed"));
|
sl@0
|
550 |
}
|
sl@0
|
551 |
|
sl@0
|
552 |
/**
|
sl@0
|
553 |
Virtual RunL - Called on completion of an asynchronous command
|
sl@0
|
554 |
@internalComponent
|
sl@0
|
555 |
@see MTPActiveCallback
|
sl@0
|
556 |
@param aActive Active Object that RunL has been called on
|
sl@0
|
557 |
@pre N/A
|
sl@0
|
558 |
@post N/A
|
sl@0
|
559 |
@leave system wide error code
|
sl@0
|
560 |
*/
|
sl@0
|
561 |
void CT_EComSessionData::RunL(CActive* aActive, const TInt aIndex)
|
sl@0
|
562 |
{
|
sl@0
|
563 |
if ( aActive==iActiveNotifyOnChange )
|
sl@0
|
564 |
{
|
sl@0
|
565 |
RunNotifyOnChangeL( aIndex );
|
sl@0
|
566 |
}
|
sl@0
|
567 |
else
|
sl@0
|
568 |
{
|
sl@0
|
569 |
ERR_PRINTF1(_L("Stray signal"));
|
sl@0
|
570 |
SetBlockResult(EFail);
|
sl@0
|
571 |
}
|
sl@0
|
572 |
}
|
sl@0
|
573 |
|
sl@0
|
574 |
/**
|
sl@0
|
575 |
RunNotifyOnChangeL - Process RunL for iActiveNotifyOnChange
|
sl@0
|
576 |
@internalComponent
|
sl@0
|
577 |
@pre N/A
|
sl@0
|
578 |
@post N/A
|
sl@0
|
579 |
@leave system wide error code
|
sl@0
|
580 |
*/
|
sl@0
|
581 |
void CT_EComSessionData::RunNotifyOnChangeL(const TInt aIndex)
|
sl@0
|
582 |
{
|
sl@0
|
583 |
TInt err=iActiveNotifyOnChange->iStatus.Int();
|
sl@0
|
584 |
if ( err!=KErrNone )
|
sl@0
|
585 |
{
|
sl@0
|
586 |
ERR_PRINTF2(_L("RunL Error %d"), err);
|
sl@0
|
587 |
SetAsyncError(aIndex, err);
|
sl@0
|
588 |
}
|
sl@0
|
589 |
else
|
sl@0
|
590 |
{
|
sl@0
|
591 |
INFO_PRINTF1(_L("RunNotifyOnChangeL OK"));
|
sl@0
|
592 |
}
|
sl@0
|
593 |
|
sl@0
|
594 |
DecOutstanding();
|
sl@0
|
595 |
}
|
sl@0
|
596 |
|