sl@0: /* sl@0: * Copyright (c) 2007-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: * Client-side API tests an implementation of the session count server sl@0: * by implementing a handle to a subsession. sl@0: * sl@0: */ sl@0: sl@0: sl@0: /** sl@0: @file sl@0: */ sl@0: sl@0: #include "scstestclient.h" sl@0: #include "scstestcommon.h" sl@0: sl@0: sl@0: EXPORT_C RScsTestSubsession::RScsTestSubsession() sl@0: /** sl@0: This constructor provides a single definition from sl@0: which to call the base class constructor. sl@0: */ sl@0: : RScsClientSubsessionBase() sl@0: { sl@0: // empty. sl@0: } sl@0: sl@0: EXPORT_C TInt RScsTestSubsession::Create(RScsTestSession& aSession, TInt aValue) sl@0: /** sl@0: Create a new subsession over the supplied session. sl@0: sl@0: @param aSession Session which will host this subsession. sl@0: @param aValue Value which will be stored by the subsession. sl@0: @return Symbian OS error code where KErrNone indicates sl@0: success and any other value indicates failure. sl@0: */ sl@0: { sl@0: TIpcArgs args(aValue); sl@0: return CreateSubsession(aSession, ScsTestImpl::ESessSubsessFromInt, args); sl@0: } sl@0: sl@0: EXPORT_C TInt RScsTestSubsession::SendFunction(TInt aFunction) sl@0: /** sl@0: Send an arbitrary function identifier to the subsession. sl@0: Used to test the subsession implementation handles unrecognized sl@0: functions correctly. sl@0: sl@0: @param aFunction Arbitrary function. Note that, unlike the sl@0: RScsTestSession::SendFunction, this cannot sl@0: include an SCS code. sl@0: @see RScsTestSession::SendFunction sl@0: */ sl@0: { sl@0: return CallSubsessionFunction(aFunction); sl@0: } sl@0: sl@0: EXPORT_C TInt RScsTestSubsession::Quadruple(TInt& aResult) sl@0: /** sl@0: Send a synchronous request to the subsession. sl@0: sl@0: @param aResult On return this should be set to four times sl@0: the value of the integer which was supplied to sl@0: Create when the subsession was created. sl@0: @return Symbian OS error code where KErrNone indicates sl@0: success and any other value indicates failure. sl@0: @see Create sl@0: */ sl@0: { sl@0: TPckg resultPckg(aResult); sl@0: TIpcArgs args(&resultPckg); sl@0: return CallSubsessionFunction(ScsTestImpl::ESubsessQuadruple, args); sl@0: } sl@0: sl@0: EXPORT_C void RScsTestSubsession::Treble(TDes8& aValue, TRequestStatus& aStatus) sl@0: /** sl@0: Launch an aysnchronous request on the subsession. sl@0: sl@0: To reuse server-side code, this does not use the integer sl@0: value stored in the subsession object, but transforms sl@0: the supplied value in the same way as the session implementation. sl@0: sl@0: @param aValue Describes an integer, e.g. TPckgBuf. sl@0: The descriptor must be supplied by the caller sl@0: instead of being constructed in this function sl@0: because it must persist until the request has sl@0: been completed. sl@0: @param aStatus The server will complete this status object sl@0: when it has handled the function. sl@0: */ sl@0: { sl@0: TIpcArgs args(&aValue); sl@0: CallSubsessionFunction(ScsTestImpl::ESubsessTreble, args, aStatus); sl@0: } sl@0: sl@0: EXPORT_C void RScsTestSubsession::CancelTreble() sl@0: /** sl@0: Cancel an outstanding synchronous request launched with Treble. sl@0: sl@0: @see Treble sl@0: */ sl@0: { sl@0: return CancelSubsessionFunction(ScsTestImpl::ESubsessTreble); sl@0: } sl@0: