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: * Implements CScsTestSubsession. See class and function definitons sl@0: * for more information. sl@0: * sl@0: */ sl@0: sl@0: sl@0: /** sl@0: @file sl@0: */ sl@0: sl@0: #include "scstestserver.h" sl@0: sl@0: sl@0: CScsTestSubsession* CScsTestSubsession::NewL(CScsTestSession &aSession, const RMessage2& aMessage) sl@0: /** sl@0: Factory function allocates new, initialized instance of CScsTestSubsession. sl@0: sl@0: @param aSession Reference to our parent session sl@0: @param aMessage Create subsession message sent from the client. sl@0: This contains the integer on which the subsession sl@0: is curried. sl@0: @return New, initialized instance of CScsTestSubsession sl@0: which is owned by the caller. sl@0: */ sl@0: { sl@0: CScsTestSubsession* self = new(ELeave) CScsTestSubsession(aSession); sl@0: sl@0: // record value on which this subsession is curried sl@0: self->iValue = aMessage.Int0(); sl@0: return self; sl@0: } sl@0: sl@0: CScsTestSubsession::CScsTestSubsession(CScsTestSession &aSession) sl@0: /** sl@0: This private constructor prevents direct instantiation and provides sl@0: a single point of definition. sl@0: */ sl@0: : CScsSubsession(aSession) sl@0: { sl@0: // empty. sl@0: } sl@0: sl@0: CScsTestSubsession::~CScsTestSubsession() sl@0: /** sl@0: This destructor is only defined to breakpoint when the sl@0: subsession is destroyed. sl@0: */ sl@0: { sl@0: // empty. sl@0: } sl@0: sl@0: TBool CScsTestSubsession::DoServiceL(TInt aFunction, const RMessage2& aMessage) sl@0: /** sl@0: Implement CSscSubsession by handling messages sent to this subsession. sl@0: sl@0: @param aFunction Function identifier without SCS code. sl@0: @param aMessage Standard server-side handle to message. sl@0: @return ETrue means complete client request now. sl@0: */ sl@0: { sl@0: ScsTestImpl::TSubsessionFunction f = sl@0: static_cast(aFunction); sl@0: sl@0: TBool completeMessage = ETrue; sl@0: switch (f) sl@0: { sl@0: case ScsTestImpl::ESubsessQuadruple: sl@0: { sl@0: TPckgBuf times4 = iValue * 4; sl@0: aMessage.WriteL(0, times4); sl@0: } sl@0: break; sl@0: sl@0: case ScsTestImpl::ESubsessTreble: sl@0: { sl@0: CScsTestSession* owningSession = static_cast(&iSession); sl@0: CTrebleRequest::NewL(owningSession, this, aMessage); sl@0: completeMessage = EFalse; // do not complete yet sl@0: } sl@0: break; sl@0: sl@0: default: sl@0: User::Leave(KErrNotSupported); sl@0: } sl@0: return completeMessage; sl@0: } sl@0: