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 session. sl@0: * sl@0: */ sl@0: sl@0: sl@0: /** sl@0: @file sl@0: */ sl@0: sl@0: sl@0: #include "scstestclient.h" sl@0: #include "scstestcommon.h" sl@0: sl@0: sl@0: EXPORT_C RScsTestSession::RScsTestSession() sl@0: /** sl@0: This constructor defines a single point from which sl@0: the base class constructor is called. sl@0: */ sl@0: : RScsClientBase() sl@0: { sl@0: // empty. sl@0: } sl@0: sl@0: EXPORT_C TInt RScsTestSession::Connect() sl@0: /** sl@0: Connect to the SCS test server using the default version. sl@0: 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: const TVersion serverVersion = ScsTestImpl::Version(); sl@0: return Connect(serverVersion); sl@0: } sl@0: sl@0: EXPORT_C TInt RScsTestSession::Connect(const TVersion& aVersion) sl@0: /** sl@0: Connect to the SCS test server with the supplied version. This sl@0: function is defined to test the version checking functionality in sl@0: CScsServer. A client API would normally just ask for a server sl@0: version which at least matches its own. sl@0: sl@0: @param aVersion Server version to ask for. 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: const TUidType serverFullUid = ScsTestImpl::ServerImageFullUid(); sl@0: sl@0: TInt r = RScsClientBase::Connect( sl@0: ScsTestImpl::KServerName, aVersion, sl@0: ScsTestImpl::KServerImageName, serverFullUid); sl@0: sl@0: return r; sl@0: } sl@0: sl@0: EXPORT_C TInt RScsTestSession::SendCustomFunction(TInt aFunction) sl@0: /** sl@0: Sends the supplied function identifier to the server with sl@0: no IPC arguments. This function should be used to test the sl@0: server can handle an invalid SCS or session function. sl@0: sl@0: @param aFunction Function identifier to send to server-side sl@0: session. This is sent as-is, and can use the sl@0: SCS field. sl@0: */ sl@0: { sl@0: return SendReceive(aFunction); sl@0: } sl@0: sl@0: EXPORT_C TInt RScsTestSession::NukeServer() sl@0: /** sl@0: Calls an synchronous function which causes the server to panic sl@0: */ sl@0: { sl@0: return CallSessionFunction(ScsTestImpl::ESessNukeServer); sl@0: } sl@0: sl@0: EXPORT_C TInt RScsTestSession::Double(TInt& aValue) sl@0: /** sl@0: Calls a synchronous session function to ensure the function sl@0: call is routed to the session subclass on the server side. sl@0: sl@0: @param aValue An arbitrary integer. On completion sl@0: this should be double its entry value. 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: TPckg valPckg(aValue); sl@0: TIpcArgs ipc(&valPckg); sl@0: return CallSessionFunction(ScsTestImpl::ESessDouble, ipc); sl@0: } sl@0: sl@0: EXPORT_C void RScsTestSession::Treble(TDes8& aValue, TRequestStatus& aStatus) sl@0: /** sl@0: Calls an asynchronous function to test the SCS can successfully manage sl@0: asynchronous requests. 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: @see CancelTreble sl@0: */ sl@0: { sl@0: TIpcArgs ipc(&aValue); sl@0: CallSessionFunction(ScsTestImpl::ESessTreble, ipc, aStatus); sl@0: } sl@0: sl@0: EXPORT_C void RScsTestSession::CancelTreble() sl@0: /** sl@0: Cancel an outstanding request set up with Treble. This function has sl@0: no effect if there is no outstanding request. sl@0: sl@0: @see Treble sl@0: */ sl@0: { sl@0: CancelSessionFunction(ScsTestImpl::ESessTreble); sl@0: }