os/ossrv/syslibsapitest/syslibssvs/ecom/src/T_EComSessionData.cpp
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/ossrv/syslibsapitest/syslibssvs/ecom/src/T_EComSessionData.cpp	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,596 @@
     1.4 +/*
     1.5 +* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
     1.6 +* All rights reserved.
     1.7 +* This component and the accompanying materials are made available
     1.8 +* under the terms of "Eclipse Public License v1.0"
     1.9 +* which accompanies this distribution, and is available
    1.10 +* at the URL "http://www.eclipse.org/legal/epl-v10.html".
    1.11 +*
    1.12 +* Initial Contributors:
    1.13 +* Nokia Corporation - initial contribution.
    1.14 +*
    1.15 +* Contributors:
    1.16 +*
    1.17 +* Description: 
    1.18 +*
    1.19 +*/
    1.20 +
    1.21 +
    1.22 +
    1.23 +#include "T_EComSessionData.h"
    1.24 +#include "T_ImplementationInformationData.h"
    1.25 +#include "TestEComInterface.h"
    1.26 +
    1.27 +/*@{*/
    1.28 +///	Parameters
    1.29 +_LIT(KUid,							"uid");
    1.30 +_LIT(KResolver,						"resolver");
    1.31 +_LIT(KExpectedResult,				"expected");
    1.32 +_LIT(KResolverUid,					"resolver_uid");
    1.33 +_LIT(KOffset,						"offset");
    1.34 +_LIT(KInteger,						"integer");
    1.35 +_LIT(KDescriptor,					"descriptor");
    1.36 +_LIT(KEmpty,						"empty");
    1.37 +_LIT(KSaveTo,						"saveto");
    1.38 +_LIT(KSaveIndex,					"saveindex");
    1.39 +
    1.40 +///	REComSession
    1.41 +_LIT(KCmdOpenL,		 				"OpenL");
    1.42 +_LIT(KCmdClose,					 	"Close");
    1.43 +_LIT(KCmdFinalClose,				"FinalClose");
    1.44 +_LIT(KCmdNotifyOnChange,			"NotifyOnChange");
    1.45 +_LIT(KCmdCancelNotifyOnChange,		"CancelNotifyOnChange");
    1.46 +_LIT(KCmdListImplementationsL,		"ListImplementationsL");
    1.47 +_LIT(KCmdCreateImplementationL,		"CreateImplementationL");
    1.48 +_LIT(KCmdDestroyedImplementation,	"DestroyedImplementation");
    1.49 +_LIT(KCmdClean,						"~");
    1.50 +
    1.51 +_LIT(KEmptyString,					"");
    1.52 +_LIT(KDefault,						"default");
    1.53 +/*@}*/
    1.54 +
    1.55 +//////////////////////////////////////////////////////////////////////
    1.56 +// Construction/Destruction
    1.57 +//////////////////////////////////////////////////////////////////////
    1.58 +
    1.59 +/**
    1.60 + * Two phase constructor
    1.61 + */
    1.62 +CT_EComSessionData* CT_EComSessionData::NewL()
    1.63 +	{
    1.64 +	CT_EComSessionData*	ret=new (ELeave) CT_EComSessionData();
    1.65 +	CleanupStack::PushL(ret);
    1.66 +	ret->ConstructL();
    1.67 +	CleanupStack::Pop(ret);
    1.68 +	return ret;
    1.69 +	}
    1.70 +
    1.71 +/**
    1.72 + * Constructor. First phase construction
    1.73 + */
    1.74 +CT_EComSessionData::CT_EComSessionData()
    1.75 +:	iActiveNotifyOnChange(NULL)
    1.76 +,	iImplementationInterface(NULL)
    1.77 +	{
    1.78 +	iInitParams.iInteger=0;
    1.79 +	iInitParams.iDescriptor=&iInterfaceDesc;
    1.80 +	}
    1.81 +
    1.82 +/**
    1.83 + * Second phase construction
    1.84 + */
    1.85 +void CT_EComSessionData::ConstructL()
    1.86 +	{
    1.87 +	iInterfaceDesc=KEmptyString;
    1.88 +	iDTorKey=TUid::Uid(0);
    1.89 +	iActiveNotifyOnChange=CActiveCallback::NewL(*this);
    1.90 +	}
    1.91 +
    1.92 +/**
    1.93 + * Public destructor
    1.94 + */
    1.95 +CT_EComSessionData::~CT_EComSessionData()
    1.96 +	{
    1.97 +	DestroyData();
    1.98 +	iInfoArray.ResetAndDestroy();
    1.99 +	iInfoArray.Close();
   1.100 +	delete iActiveNotifyOnChange;
   1.101 +	iActiveNotifyOnChange=NULL;
   1.102 +	}
   1.103 +
   1.104 +TAny* CT_EComSessionData::GetObject()
   1.105 +/**
   1.106 + * Return a pointer to the object that the data wraps
   1.107 + *
   1.108 + * @return	Pointer to the object that the data wraps
   1.109 + */
   1.110 +	{
   1.111 +	return &iSession;
   1.112 +	}
   1.113 +
   1.114 +void CT_EComSessionData::DestroyData()
   1.115 +	{
   1.116 +	if (iImplementationInterface)
   1.117 +		{
   1.118 +		delete static_cast<CBase*>(iImplementationInterface);
   1.119 +		iImplementationInterface=NULL;
   1.120 +		};
   1.121 +	}
   1.122 +
   1.123 +//////////////////////////////////////////////////////////////////////
   1.124 +// Read data from INI file
   1.125 +//////////////////////////////////////////////////////////////////////
   1.126 +
   1.127 +void CT_EComSessionData::GetUid(const TDesC& aSection, TUid& aUid)
   1.128 +	{
   1.129 +	TInt	uidValue=0;
   1.130 +
   1.131 +	GetHexFromConfig(aSection, KUid(), uidValue );
   1.132 +	aUid = TUid::Uid(uidValue);
   1.133 +	}
   1.134 +
   1.135 +TBool CT_EComSessionData::GetResolver(const TDesC& aSection, TPtrC& aResolver)
   1.136 +	{
   1.137 +	return GetStringFromConfig(aSection, KResolver(), aResolver);
   1.138 +	}
   1.139 +
   1.140 +TBool CT_EComSessionData::GetResolverUid(const TDesC& aSection, TUid& aUid)
   1.141 +	{
   1.142 +	TInt	uidValue=0;
   1.143 +	TBool	ret=GetHexFromConfig(aSection, KResolverUid(), uidValue );
   1.144 +	aUid = TUid::Uid(uidValue);
   1.145 +	return ret;
   1.146 +	}
   1.147 +
   1.148 +TBool CT_EComSessionData::GetEmpty(const TDesC& aSection, TBool& aEmpty)
   1.149 +	{
   1.150 +	aEmpty = EFalse;
   1.151 +	return GetBoolFromConfig(aSection, KEmpty(), aEmpty );
   1.152 +	}
   1.153 +
   1.154 +TBool CT_EComSessionData::GetExpectedResult(const TDesC& aSection, TInt& aExpectedResult)
   1.155 +	{
   1.156 +	aExpectedResult = 0;
   1.157 +	return GetIntFromConfig(aSection, KExpectedResult(), aExpectedResult );
   1.158 +	}
   1.159 +
   1.160 +TBool CT_EComSessionData::GetOffset(const TDesC& aSection, TInt& aOffset)
   1.161 +	{
   1.162 +	aOffset=_FOFF(CTestEComInterface, iDtor_ID_Key);
   1.163 +
   1.164 +	TPtrC	offset;
   1.165 +	TBool	ret=GetStringFromConfig(aSection, KOffset(), offset);
   1.166 +	if ( ret )
   1.167 +		{
   1.168 +		if ( offset == KDefault )
   1.169 +			{
   1.170 +			INFO_PRINTF2(_L("Default offset %d"), aOffset);
   1.171 +			}
   1.172 +		else
   1.173 +			{
   1.174 +			ret=GetIntFromConfig(aSection, KOffset(), aOffset);
   1.175 +			}
   1.176 +		}
   1.177 +
   1.178 +	return ret;
   1.179 +	}
   1.180 +
   1.181 +TBool CT_EComSessionData::GetDescriptor(const TDesC& aSection, TPtrC& aDescriptor)
   1.182 +	{
   1.183 +	aDescriptor.Set(KEmptyString);
   1.184 +	return GetStringFromConfig(aSection, KDescriptor(), aDescriptor );
   1.185 +	}
   1.186 +
   1.187 +TBool CT_EComSessionData::GetInteger(const TDesC& aSection, TInt& aInt)
   1.188 +	{
   1.189 +	return GetIntFromConfig(aSection, KInteger(), aInt );
   1.190 +	}
   1.191 +
   1.192 +
   1.193 +TBool CT_EComSessionData::DoCommandL(const TTEFFunction& aCommand, const TTEFSectionName& aSection, const TInt aAsyncErrorIndex)
   1.194 +/**
   1.195 + * Process a command read from the ini file
   1.196 + *
   1.197 + * @param aCommand			The command to process
   1.198 + * @param aSection			The section in the ini containing data for the command
   1.199 + * @param aAsyncErrorIndex	Command index for async calls to return errors to
   1.200 + *
   1.201 + * @return					ETrue if the command is processed
   1.202 + * @pre						N/A
   1.203 + * @post					N/A
   1.204 + *
   1.205 + * @leave					System wide error
   1.206 + */
   1.207 +	{
   1.208 +	TBool	retVal=ETrue;
   1.209 +
   1.210 +	if ( aCommand==KCmdOpenL )
   1.211 +		{
   1.212 +		DoCmdOpenL();
   1.213 +		}
   1.214 +	else if ( aCommand==KCmdClose )
   1.215 +		{
   1.216 +		DoCmdClose();
   1.217 +		}
   1.218 +	else if ( aCommand==KCmdFinalClose )
   1.219 +		{
   1.220 +		DoCmdFinalClose();
   1.221 +		}
   1.222 +	else if ( aCommand==KCmdNotifyOnChange )
   1.223 +		{
   1.224 +		DoCmdNotifyOnChange(aAsyncErrorIndex);
   1.225 +		}
   1.226 +	else if ( aCommand==KCmdCancelNotifyOnChange )
   1.227 +		{
   1.228 +		DoCmdCancelNotifyOnChange();
   1.229 +		}
   1.230 +	else if ( aCommand==KCmdListImplementationsL )
   1.231 +		{
   1.232 +		DoCmdListImplementationsL(aSection);
   1.233 +		}
   1.234 +	else if ( aCommand==KCmdCreateImplementationL )
   1.235 +		{
   1.236 +		DoCmdCreateImplementationL(aSection);
   1.237 +		}
   1.238 +	else if ( aCommand==KCmdDestroyedImplementation )
   1.239 +		{
   1.240 +		DoCmdDestroyedImplementation(aSection);
   1.241 +		}
   1.242 +	else if ( aCommand==KCmdClean )
   1.243 +		{
   1.244 +		DestroyData();
   1.245 +		}
   1.246 +	else
   1.247 +		{
   1.248 +		retVal=EFalse;
   1.249 +		}
   1.250 +	return retVal;
   1.251 +	}
   1.252 +
   1.253 +void CT_EComSessionData::DoCmdOpenL()
   1.254 +	{
   1.255 +	INFO_PRINTF1(_L("OpenL Call"));
   1.256 +	TRAPD ( err, iSession = REComSession::OpenL() );
   1.257 +	if ( err!=KErrNone )
   1.258 +		{
   1.259 +		ERR_PRINTF2(_L("OpenL Error %d"), err);
   1.260 +		SetError(err);
   1.261 +		}
   1.262 +	else
   1.263 +		{
   1.264 +		INFO_PRINTF1(_L("Session opened"));
   1.265 +		}
   1.266 +	}
   1.267 +
   1.268 +void CT_EComSessionData::DoCmdClose()
   1.269 +	{
   1.270 +	INFO_PRINTF1(_L("Close"));
   1.271 +	iSession.Close();
   1.272 +	}
   1.273 +
   1.274 +void CT_EComSessionData::DoCmdFinalClose()
   1.275 +	{
   1.276 +	INFO_PRINTF1(_L("Final Close"));
   1.277 +	REComSession::FinalClose();
   1.278 +	}
   1.279 +
   1.280 +void CT_EComSessionData::DoCmdNotifyOnChange(const TInt aIndex)
   1.281 +	{
   1.282 +	INFO_PRINTF1(_L("NotifyOnChange"));
   1.283 +	iSession.NotifyOnChange(iActiveNotifyOnChange->iStatus);
   1.284 +	iActiveNotifyOnChange->Activate(aIndex);
   1.285 +   	IncOutstanding();
   1.286 +	}
   1.287 +
   1.288 +void CT_EComSessionData::DoCmdCancelNotifyOnChange()
   1.289 +	{
   1.290 +	INFO_PRINTF1(_L("CancelNotifyOnChange"));
   1.291 +	iSession.CancelNotifyOnChange(iActiveNotifyOnChange->iStatus);
   1.292 +	}
   1.293 +
   1.294 +// Found defects:
   1.295 +// 1. ListImplementationsL with impossible aResolutionParameters argument don't leave
   1.296 +//    Status: possible defect
   1.297 +void CT_EComSessionData::DoCmdListImplementationsL(const TDesC& aSection)
   1.298 +	{
   1.299 +	INFO_PRINTF1(_L("Getting Implementnation List"));
   1.300 +
   1.301 +	TUid	impUid;
   1.302 +	GetUid(aSection, impUid);
   1.303 +
   1.304 +	TUid	resolverUid;
   1.305 +	TBool	hasResolverUid=GetResolverUid(aSection, resolverUid);
   1.306 +
   1.307 +	TInt	err = KErrNone;
   1.308 +
   1.309 +	TPtrC	resolver;
   1.310 +	TBool	hasResolver=GetResolver(aSection, resolver);
   1.311 +	if ( hasResolver )
   1.312 +		{
   1.313 +		TEComResolverParams*	resolverParams=static_cast<TEComResolverParams*>(GetDataObjectL(resolver));
   1.314 +		if ( hasResolverUid )
   1.315 +			{
   1.316 +			INFO_PRINTF1(_L("Getting Implementnation List(3) by Uid, ResolverParams as a filter params && Resolver Uid as a filter"));
   1.317 +			TRAP(err, REComSession::ListImplementationsL(impUid, *resolverParams, resolverUid, iInfoArray));
   1.318 +			}
   1.319 +		else
   1.320 +			{
   1.321 +			INFO_PRINTF1(_L("Getting Implementnation List(1) by Uid && ResolverParams as a filter"));
   1.322 +			TRAP(err, REComSession::ListImplementationsL(impUid, *resolverParams, iInfoArray));
   1.323 +			}
   1.324 +		}
   1.325 +	else
   1.326 +		{
   1.327 +		INFO_PRINTF1(_L("Getting Implementnation List(2) by Uid"));
   1.328 +		TRAP(err, REComSession::ListImplementationsL(impUid, iInfoArray));
   1.329 +		}
   1.330 +
   1.331 +	if ( err==KErrNone )
   1.332 +		{
   1.333 +		//	Check to see if we the data object has to be set in a CT_ImplementationInformationData
   1.334 +		TPtrC	saveTo;
   1.335 +		if ( GetStringFromConfig(aSection, KSaveTo(), saveTo) )
   1.336 +			{
   1.337 +			TInt	index=0;
   1.338 +			GetIntFromConfig(aSection, KSaveIndex(), index);
   1.339 +			CDataWrapper*	wrapper=static_cast<CDataWrapper*>(GetDataWrapperL(saveTo));
   1.340 +			wrapper->SetObjectL(iInfoArray[index]);
   1.341 +			}
   1.342 +		}
   1.343 +
   1.344 +	if( err != KErrNone )
   1.345 +		{
   1.346 +		ERR_PRINTF2(_L("Failed to get implementation list with error %d"), err);
   1.347 +		SetError(err);
   1.348 +		}
   1.349 +	else
   1.350 +		{
   1.351 +		TInt	expectedResult;
   1.352 +		if ( GetExpectedResult(aSection, expectedResult) )
   1.353 +			{
   1.354 +			if (iInfoArray.Count() != expectedResult)
   1.355 +				{
   1.356 +				ERR_PRINTF3(_L("List retrieved. Found %d imlementations, expected %d"),
   1.357 +				iInfoArray.Count(), expectedResult );
   1.358 +				SetBlockResult(EFail);
   1.359 +				}
   1.360 +			}
   1.361 +
   1.362 +		for (TInt i = 0; i < iInfoArray.Count(); i++)
   1.363 +			{
   1.364 +			const TDesC8&	name8=iInfoArray[i]->DataType();
   1.365 +			TBuf<KMaxTestExecuteCommandLength>	name16;
   1.366 +			name16.Copy(name8);
   1.367 +			INFO_PRINTF3(_L("Implementation UID %d: - \"%S\""), iInfoArray[i]->ImplementationUid().iUid, &(iInfoArray[i]->DisplayName()));
   1.368 +			INFO_PRINTF2(_L("Data Type is \"%S\""), &name16);
   1.369 +			};
   1.370 +		}
   1.371 +	}
   1.372 +
   1.373 +// Found defects:
   1.374 +// 1. CreateImplementationL with any aKeyOffset argument - aKeyOffset can have any value (-1, 0, 10000, ...)
   1.375 +//    but CreateImplementationL returns no error and generates memory leak.
   1.376 +//    Status: possible defects
   1.377 +// 2. CreateImplementationL with impossible aResolutionParameters argument - returns KErrnotFound, but in documentation
   1.378 +//    CreateImplementationL levaes only with KErrNoMemory, KErrNotConnected, KErrArgument or KErrPermissionDenied error
   1.379 +//    Status: documentation  defect
   1.380 +void CT_EComSessionData::DoCmdCreateImplementationL(const TDesC& aSection)
   1.381 +	{
   1.382 +	DestroyData();
   1.383 +
   1.384 +	TUid	impUid;
   1.385 +	GetUid(aSection,impUid);
   1.386 +
   1.387 +	TInt	offset;
   1.388 +	TBool	hasOffset=GetOffset(aSection,offset);
   1.389 +
   1.390 +	TUid	resolverUid;
   1.391 +	TBool	hasResolverUid=GetResolverUid(aSection,	resolverUid);
   1.392 +
   1.393 +	TBool	hasIntegerValue=GetInteger(aSection, iInitParams.iInteger);
   1.394 +
   1.395 +	TBool	emptyArgs;
   1.396 +	TBool	hasEmptyArgs=GetEmpty(aSection, emptyArgs);
   1.397 +
   1.398 +	TBool	hasInitParams=hasIntegerValue || hasEmptyArgs;
   1.399 +	TAny*	initParamsPtr=NULL;
   1.400 +	if (hasInitParams)
   1.401 +		{
   1.402 +		if (!emptyArgs)
   1.403 +			{
   1.404 +			initParamsPtr=&iInitParams;
   1.405 +			}
   1.406 +		}
   1.407 +
   1.408 +	TInt	err = KErrNone;
   1.409 +	TBool	getKeyFromOffset=EFalse;
   1.410 +
   1.411 +	TPtrC	resolver;
   1.412 +	if ( GetResolver(aSection, resolver) )
   1.413 +		{
   1.414 +		TEComResolverParams*	resolverParams=static_cast<TEComResolverParams*>(GetDataObjectL(resolver));
   1.415 +		if (hasResolverUid && hasInitParams && hasOffset)
   1.416 +			{
   1.417 +			INFO_PRINTF1(_L("Creating Implementnation(12) by Interface Uid,  Offset, Init Params, ResolverParams as a filter params && Resolver Uid as a filter"));
   1.418 +		
   1.419 +			TRAP( err, iImplementationInterface =
   1.420 +				REComSession::CreateImplementationL(impUid, offset, initParamsPtr, *resolverParams, resolverUid));
   1.421 +			getKeyFromOffset=(err==KErrNone);
   1.422 +			}
   1.423 +		else if (hasResolverUid && hasInitParams)
   1.424 +			{
   1.425 +			INFO_PRINTF1(_L("Creating Implementnation(11) by Interface Uid,  Init Params, ResolverParams as a filter params && Resolver Uid as a filter"));
   1.426 +			TRAP( err, iImplementationInterface =
   1.427 +				REComSession::CreateImplementationL(impUid, iDTorKey, initParamsPtr, *resolverParams, resolverUid));
   1.428 +			}
   1.429 +		else if (hasResolverUid && hasOffset)
   1.430 +			{
   1.431 +			INFO_PRINTF1(_L("Creating Implementnation(10) by Interface Uid, Offset, ResolverParams as a filter params && Resolver Uid as a filter"));
   1.432 +			TRAP( err, iImplementationInterface =
   1.433 +				REComSession::CreateImplementationL(impUid, offset, *resolverParams, resolverUid));
   1.434 +			getKeyFromOffset=(err==KErrNone);
   1.435 +			}
   1.436 +		else if (hasResolverUid)
   1.437 +			{
   1.438 +			INFO_PRINTF1(_L("Creating Implementnation(9) by Interface Uid, ResolverParams as a filter params && Resolver Uid as a filter"));
   1.439 +			TRAP( err, iImplementationInterface =
   1.440 +				REComSession::CreateImplementationL(impUid, iDTorKey, *resolverParams, resolverUid));
   1.441 +			}
   1.442 +		else if (hasInitParams && hasOffset)
   1.443 +			{
   1.444 +			INFO_PRINTF1(_L("Creating Implementnation(8) by Interface Uid, Offset, Init Params && Resolver Parameters as a filter"));
   1.445 +			TRAP( err, iImplementationInterface =
   1.446 +				REComSession::CreateImplementationL(impUid, offset, initParamsPtr, *resolverParams));
   1.447 +
   1.448 +			getKeyFromOffset=(err==KErrNone);
   1.449 +			}
   1.450 +		else if (hasInitParams)
   1.451 +			{
   1.452 +			INFO_PRINTF1(_L("Creating Implementnation(7) by Interface Uid, Init Params && Resolver Parameters as a filter"));
   1.453 +			TRAP( err, iImplementationInterface =
   1.454 +				REComSession::CreateImplementationL(impUid, iDTorKey, initParamsPtr, *resolverParams));
   1.455 +			}
   1.456 +		else if (hasOffset)
   1.457 +			{
   1.458 +			INFO_PRINTF1(_L("Creating Implementnation(6) by Interface Uid, Offset && Resolver Parameters as a filter"));
   1.459 +
   1.460 +			TRAP( err, iImplementationInterface =
   1.461 +				REComSession::CreateImplementationL(impUid, offset, *resolverParams));
   1.462 +
   1.463 +			getKeyFromOffset=(err==KErrNone);
   1.464 +			}
   1.465 +		else
   1.466 +			{
   1.467 +			INFO_PRINTF1(_L("Creating Implementnation(5) by Interface Uid && Resolver Parameters as a filter"));
   1.468 +
   1.469 +			TRAP( err, iImplementationInterface =
   1.470 +				REComSession::CreateImplementationL(impUid, iDTorKey, *resolverParams));
   1.471 +
   1.472 +			}
   1.473 +		}
   1.474 +	else
   1.475 +		{
   1.476 +		if (hasInitParams && hasOffset)
   1.477 +			{
   1.478 +			INFO_PRINTF1(_L("Creating Implementnation(4) by Uid, Offset && Construction Parameters"));
   1.479 +
   1.480 +			TRAP( err, iImplementationInterface =
   1.481 +				REComSession::CreateImplementationL(impUid, offset, initParamsPtr));
   1.482 +
   1.483 +			getKeyFromOffset=(err==KErrNone);
   1.484 +			}
   1.485 +		else if (hasInitParams)
   1.486 +			{
   1.487 +			INFO_PRINTF1(_L("Creating Implementnation(3) by Uid && Construction Parameters"));
   1.488 +
   1.489 +			TRAP( err, iImplementationInterface =
   1.490 +				REComSession::CreateImplementationL(impUid, iDTorKey, initParamsPtr));
   1.491 +
   1.492 +			}
   1.493 +		else if (hasOffset)
   1.494 +			{
   1.495 +			INFO_PRINTF1(_L("Creating Implementnation(2) by Uid && offset defined by interface"));
   1.496 +
   1.497 +			TRAP( err, iImplementationInterface =
   1.498 +				REComSession::CreateImplementationL(impUid, offset));
   1.499 +
   1.500 +			getKeyFromOffset=(err==KErrNone);
   1.501 +			}
   1.502 +		else
   1.503 +			{
   1.504 +			INFO_PRINTF1(_L("Creating Implementnation(1) by Uid"));
   1.505 +
   1.506 +			TRAP( err, iImplementationInterface =
   1.507 +				REComSession::CreateImplementationL(impUid, iDTorKey ));
   1.508 +
   1.509 +			}
   1.510 +		}
   1.511 +
   1.512 +	if ( getKeyFromOffset )
   1.513 +		{
   1.514 +		TUint8*	uidPtr=REINTERPRET_CAST(TUint8*, iImplementationInterface) + offset;
   1.515 +		TUid*	uid=REINTERPRET_CAST(TUid*, uidPtr);
   1.516 +		iDTorKey=*uid;
   1.517 +		*uid=TUid::Null();
   1.518 +		}
   1.519 +
   1.520 +	INFO_PRINTF2(_L("Implementation created successfully. iDTorKey is %d"), iDTorKey.iUid);
   1.521 +	if (BlockResult()==EPass)
   1.522 +		{
   1.523 +		if( err != KErrNone )
   1.524 +			{
   1.525 +			ERR_PRINTF2(_L("Failed to create implementation with error %d"), err);
   1.526 +			SetError(err);
   1.527 +			if (iImplementationInterface != NULL)
   1.528 +				{
   1.529 +				SetBlockResult(EFail);
   1.530 +				ERR_PRINTF1(_L("Data verification failed: CreateImplementationL returns an error, but implementation was created"));
   1.531 +				}
   1.532 +			else
   1.533 +				{
   1.534 +				INFO_PRINTF1(_L("Data verification succcess: CreateImplementationL returns an error and implementation was not created as expected"));
   1.535 +				}
   1.536 +			}
   1.537 +		}
   1.538 +	}
   1.539 +
   1.540 +void CT_EComSessionData::DoCmdDestroyedImplementation(const TDesC& aSection)
   1.541 +	{
   1.542 +	TInt	uidValue;
   1.543 +	if ( GetIntFromConfig(aSection, KUid(), uidValue) )
   1.544 +		{
   1.545 +		iDTorKey = TUid::Uid(uidValue);
   1.546 +		}
   1.547 +
   1.548 +	INFO_PRINTF2(_L("Destroy Interface Implementation. UID is %d"), iDTorKey.iUid);
   1.549 +	REComSession::DestroyedImplementation(iDTorKey);
   1.550 +	INFO_PRINTF1(_L("REComSession::DestroyedImplementation(iDTorKey) completed"));
   1.551 +	DestroyData();
   1.552 +	INFO_PRINTF1(_L("Interface implementation destroyed"));
   1.553 +	}
   1.554 +
   1.555 +/**
   1.556 + Virtual RunL - Called on completion of an asynchronous command
   1.557 + @internalComponent
   1.558 + @see MTPActiveCallback
   1.559 + @param aActive Active Object that RunL has been called on
   1.560 + @pre N/A
   1.561 + @post N/A
   1.562 + @leave system wide error code
   1.563 +*/
   1.564 +void CT_EComSessionData::RunL(CActive* aActive, const TInt aIndex)
   1.565 +	{
   1.566 +	if ( aActive==iActiveNotifyOnChange )
   1.567 +		{
   1.568 +		RunNotifyOnChangeL( aIndex );
   1.569 +		}
   1.570 +	else
   1.571 +		{
   1.572 +		ERR_PRINTF1(_L("Stray signal"));
   1.573 +		SetBlockResult(EFail);
   1.574 +		}
   1.575 +	}
   1.576 +
   1.577 +/**
   1.578 + RunNotifyOnChangeL - Process RunL for iActiveNotifyOnChange
   1.579 + @internalComponent
   1.580 + @pre N/A
   1.581 + @post N/A
   1.582 + @leave system wide error code
   1.583 +*/
   1.584 +void CT_EComSessionData::RunNotifyOnChangeL(const TInt aIndex)
   1.585 +	{
   1.586 +	TInt	err=iActiveNotifyOnChange->iStatus.Int();
   1.587 +	if ( err!=KErrNone )
   1.588 +		{
   1.589 +		ERR_PRINTF2(_L("RunL Error %d"), err);
   1.590 +		SetAsyncError(aIndex, err);
   1.591 +		}
   1.592 +	else
   1.593 +		{
   1.594 +		INFO_PRINTF1(_L("RunNotifyOnChangeL OK"));
   1.595 +		}
   1.596 +
   1.597 +   	DecOutstanding();
   1.598 +	}
   1.599 +