sl@0: /* sl@0: * Copyright (c) 2002-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 "CFSCertAppsClient.h" sl@0: #include "fsmarshaller.h" sl@0: #include "clientutils.h" sl@0: #include "clientsession.h" sl@0: #include sl@0: sl@0: const TInt KDefaultBufferSize = 256; sl@0: sl@0: MCTTokenInterface* CFSCertAppsClient::NewInterfaceL(MCTToken& aToken, sl@0: RFileStoreClientSession& aClient) sl@0: { sl@0: // Destroyed by MCTTokenInterface::DoRelease() (no refcounting) sl@0: return new (ELeave) CFSCertAppsClient(KInterfaceCertApps, aToken, aClient); sl@0: } sl@0: sl@0: CFSCertAppsClient::CFSCertAppsClient(TInt aUID, sl@0: MCTToken& aToken, sl@0: RFileStoreClientSession& aClient) : sl@0: CFSClient(aUID, aToken, aClient) sl@0: { sl@0: } sl@0: sl@0: CFSCertAppsClient::~CFSCertAppsClient() sl@0: { sl@0: } sl@0: sl@0: void CFSCertAppsClient::DoRelease() sl@0: { sl@0: MCTTokenInterface::DoRelease(); sl@0: } sl@0: sl@0: MCTToken& CFSCertAppsClient::Token() sl@0: { sl@0: return iToken; sl@0: } sl@0: sl@0: void CFSCertAppsClient::RunL() sl@0: { sl@0: // RunL should never get called sl@0: __ASSERT_DEBUG(EFalse, FSTokenPanic(EInvalidRequest)); sl@0: } sl@0: sl@0: void CFSCertAppsClient::AddL(const TCertificateAppInfo& aClient) sl@0: { sl@0: // Package up the certificate app info into a buffer. It is sl@0: // then sent as the second parameter (index 1) sl@0: TPckgC pckg(aClient); sl@0: User::LeaveIfError(iClient.SendRequest(EAddApp, TIpcArgs(0, &pckg))); sl@0: } sl@0: sl@0: void CFSCertAppsClient::RemoveL(const TUid& aUid) sl@0: { sl@0: // Package up Uid sl@0: TPckgC pckg(aUid); sl@0: User::LeaveIfError(iClient.SendRequest(ERemoveApp, TIpcArgs(0, &pckg))); sl@0: } sl@0: sl@0: TInt CFSCertAppsClient::ApplicationCountL() const sl@0: { sl@0: // Parameter is a package of TInt which is returned from the server sl@0: TInt appCount = 0; sl@0: TPckg pckg(appCount); sl@0: User::LeaveIfError(iClient.SendRequest(EGetAppCount, TIpcArgs(0, &pckg))); sl@0: return appCount; sl@0: } sl@0: sl@0: void CFSCertAppsClient::ApplicationsL(RArray& aAppArray) const sl@0: { sl@0: // This message contains the following parameters: sl@0: // Param2: [OUT] TDes8 - The buffer to write into; if buffer size too sl@0: // small then will return KErrOverflow with param 2 being sl@0: // required size sl@0: sl@0: TRAPD(err, DoApplicationsL(aAppArray)); sl@0: FreeRequestBuffer(); sl@0: User::LeaveIfError(err); sl@0: } sl@0: sl@0: void CFSCertAppsClient::DoApplicationsL(RArray& aAppArray) const sl@0: { sl@0: TIpcArgs args(0, 0, &iRequestPtr); sl@0: SendSyncRequestAndHandleOverflowL(EGetApps, KDefaultBufferSize, args); sl@0: TokenDataMarshaller::ReadL(iRequestPtr, aAppArray); sl@0: } sl@0: sl@0: void CFSCertAppsClient::ApplicationL(const TUid& aUid, TCertificateAppInfo& aInfo) const sl@0: { sl@0: // The parameters for the ApplicationL function are as follows: sl@0: // Param1: [IN] TUid - The Uid of the app to retrieve sl@0: // Param2: [OUT] TCertificateAppInfo - The app info returned sl@0: sl@0: // Package everything up and ship them sl@0: TPckgC pckgUid(aUid); sl@0: TPckg pckgInfo(aInfo); sl@0: sl@0: TIpcArgs args(0, &pckgUid, &pckgInfo); sl@0: User::LeaveIfError(iClient.SendRequest(EGetApplication, args)); sl@0: }