sl@0: /* sl@0: * Copyright (c) 2004-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 "CFStokenclient.h" sl@0: #include "clientutils.h" sl@0: #include "clientfactories.h" sl@0: sl@0: // Information strings returned by MCTToken::Information() sl@0: _LIT(KVersion, "1.00"); sl@0: _LIT(KSerialNo, "0"); sl@0: _LIT(KManufacturer, "Nokia Corporation and/or its subsidiary(-ies)."); sl@0: sl@0: MCTToken* CFSTokenClient::NewL(ETokenEnum aTokenTypeVal, MCTTokenType* aTokenType, RFileStoreClientSession& aClient) sl@0: { sl@0: __ASSERT_DEBUG(aTokenType, FSTokenPanic(EBadArgument)); sl@0: sl@0: // Destroyed by MCTToken::Release() (refcounted) sl@0: CFSTokenClient* me = new (ELeave) CFSTokenClient(aTokenTypeVal, aTokenType, aClient); sl@0: return (static_cast(me)); sl@0: } sl@0: sl@0: CFSTokenClient::CFSTokenClient(ETokenEnum aTokenTypeVal, MCTTokenType* aTokenType, RFileStoreClientSession& aClient) sl@0: : iTokenEnum(aTokenTypeVal), sl@0: iTokenType(aTokenType), sl@0: iRefCount(0), sl@0: iClient(aClient) sl@0: { sl@0: ASSERT(iTokenEnum < ETotalTokensSupported); sl@0: } sl@0: sl@0: MCTTokenType& CFSTokenClient::TokenType() sl@0: { sl@0: __ASSERT_DEBUG(iTokenType, FSTokenPanic(ENotInitialised)); sl@0: return (*iTokenType); sl@0: } sl@0: sl@0: const TDesC& CFSTokenClient::Label() sl@0: { sl@0: RSupportedTokensArray supportedTokens; sl@0: const TDesC* token = supportedTokens[iTokenEnum]; sl@0: return (*token); sl@0: } sl@0: sl@0: TCTTokenHandle CFSTokenClient::Handle() sl@0: { sl@0: __ASSERT_DEBUG(iTokenType, FSTokenPanic(ENotInitialised)); sl@0: return (TCTTokenHandle(iTokenType->Type(), iTokenEnum)); sl@0: } sl@0: sl@0: TInt& CFSTokenClient::ReferenceCount() sl@0: { sl@0: return (iRefCount); sl@0: } sl@0: sl@0: void CFSTokenClient::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: sl@0: aReturnedInterface = NULL; sl@0: TRAPD(result, aReturnedInterface = CClientInterfaceFactory::ClientInterfaceL(aRequiredInterface.iUid, *this, iClient)); sl@0: if (result != KErrNone) sl@0: { sl@0: Release(); sl@0: } sl@0: sl@0: // Complete the TRequestStatus here since not asynchronous sl@0: TRequestStatus* status = &aStatus; sl@0: User::RequestComplete(status, result); sl@0: } sl@0: sl@0: TBool CFSTokenClient::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& CFSTokenClient::Information(TTokenInformation aRequiredInformation) sl@0: { sl@0: switch (aRequiredInformation) sl@0: { sl@0: case EVersion: sl@0: return KVersion; sl@0: sl@0: case ESerialNo: sl@0: return KSerialNo; sl@0: sl@0: case EManufacturer: sl@0: return KManufacturer; sl@0: sl@0: default: sl@0: FSTokenPanic(EBadArgument); sl@0: } sl@0: sl@0: return KNullDesC; sl@0: }