sl@0: /*
sl@0: * Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
sl@0: * All rights reserved.
sl@0: * This component and the accompanying materials are made available
sl@0: * under the terms of the License "Eclipse Public License v1.0"
sl@0: * which accompanies this distribution, and is available
sl@0: * at the URL "http://www.eclipse.org/legal/epl-v10.html".
sl@0: *
sl@0: * Initial Contributors:
sl@0: * Nokia Corporation - initial contribution.
sl@0: *
sl@0: * Contributors:
sl@0: *
sl@0: * Description: 
sl@0: *
sl@0: */
sl@0: 
sl@0: 
sl@0: #include "cdummytokenclient.h"
sl@0: #include "cdummykeystoreclient.h"
sl@0: 
sl@0: _LIT(KTokenString, "Dummy Token");
sl@0: 
sl@0: 
sl@0: MCTToken* CDummyTokenClient::NewL(MCTTokenType* aTokenType)
sl@0: 	{
sl@0: 	CDummyTokenClient* self = new (ELeave) CDummyTokenClient(aTokenType);
sl@0: 	return static_cast<MCTToken*>(self);
sl@0: 	}
sl@0: 
sl@0: CDummyTokenClient::CDummyTokenClient(MCTTokenType* aTokenType)
sl@0: 			:	iTokenType(aTokenType),
sl@0: 				iRefCount(0)
sl@0: 	{
sl@0: 	}
sl@0: 
sl@0: MCTTokenType& CDummyTokenClient::TokenType()
sl@0: 	{
sl@0: 	return *iTokenType;
sl@0: 	}
sl@0: 
sl@0: const TDesC& CDummyTokenClient::Label()
sl@0: 	{
sl@0: 	return KTokenString();
sl@0: 	}
sl@0: 
sl@0: TCTTokenHandle CDummyTokenClient::Handle()
sl@0: 	{
sl@0: 	return (TCTTokenHandle(iTokenType->Type(), 0));
sl@0: 	}
sl@0: 
sl@0: TInt& CDummyTokenClient::ReferenceCount()
sl@0: 	{
sl@0: 	return iRefCount;
sl@0: 	}
sl@0: 
sl@0: void CDummyTokenClient::DoGetInterface(TUid aRequiredInterface, MCTTokenInterface*& aReturnedInterface, TRequestStatus& aStatus)
sl@0: 	{
sl@0: 	// No longer calls server to get the interface - just creates a client object of the appropriate type
sl@0: 	TUid userUid = {0x101F7334};
sl@0: 	#ifndef KEYSTORE_INTERFACE
sl@0: 	TUid managerUid = {0x101F7335};
sl@0: 	#endif // KEYSTORE_INTERFACE
sl@0: 
sl@0: 	//	Complete the TRequestStatus here since not asynchronous
sl@0: 	TRequestStatus* status = &aStatus;
sl@0: 	aReturnedInterface = NULL;
sl@0: 	TInt err = KErrGeneral;
sl@0: 	
sl@0: 	if(userUid == aRequiredInterface
sl@0: 	#ifndef KEYSTORE_INTERFACE
sl@0: 		|| managerUid == aRequiredInterface
sl@0: 	#endif //KEYSTORE_INTERFACE
sl@0: 	  )
sl@0: 		{
sl@0: 		TRAP(err, aReturnedInterface = CDummyKeyStoreClient::NewKeyStoreInterfaceL(*this));
sl@0: 		}
sl@0: 						
sl@0: 	if (NULL == aReturnedInterface)
sl@0: 		{
sl@0: 		Release();
sl@0: 		}
sl@0: 	
sl@0: 	User::RequestComplete(status, err);		
sl@0: 	}
sl@0: 
sl@0: TBool CDummyTokenClient::DoCancelGetInterface()
sl@0: 	{//	Not an asynchronous call for current file store, so nothing to do
sl@0: 	return EFalse;
sl@0: 	}
sl@0: 
sl@0: const TDesC& CDummyTokenClient::Information(TTokenInformation /*aRequiredInformation*/)
sl@0: 	{
sl@0: 	return KNullDesC;
sl@0: 	}