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: * Defines the functionality which client-side subsession handles use sl@0: * to create and destroy subsessions, and to send messages to them. sl@0: * sl@0: */ sl@0: sl@0: sl@0: /** sl@0: @file sl@0: */ sl@0: sl@0: sl@0: #include sl@0: #include sl@0: sl@0: using namespace ScsImpl; sl@0: sl@0: sl@0: EXPORT_C RScsClientSubsessionBase::RScsClientSubsessionBase() sl@0: /** sl@0: This protected constructor prevents the class from being sl@0: instantiated directly. sl@0: */ sl@0: : RSubSessionBase() sl@0: { sl@0: // empty. sl@0: } sl@0: sl@0: EXPORT_C void RScsClientSubsessionBase::Close() sl@0: /** sl@0: Closes the subsession, releasing resources on the server side. sl@0: */ sl@0: { sl@0: CloseSubSession(ECloseSubsession); sl@0: } sl@0: sl@0: EXPORT_C TInt RScsClientSubsessionBase::CreateSubsession(const RScsClientBase& aSession, TInt aFunction, const TIpcArgs& aArgs) sl@0: /** sl@0: Create a subsession over the supplied session. sl@0: sl@0: @param aSession Session which will host the subsession. sl@0: @param aFunction Command identifier. Bits 31:24 must be zero, because sl@0: they are reserved for SCS commands. sl@0: @param aArgs Standard IPC arguments. The fourth argument cannot be sl@0: used because that is reserved for the subsession handle. sl@0: @return Error code with which the server completed the request. sl@0: */ sl@0: { sl@0: return RSubSessionBase::CreateSubSession( sl@0: aSession, sl@0: ECreateSubsession | aFunction, sl@0: aArgs); sl@0: } sl@0: sl@0: EXPORT_C TInt RScsClientSubsessionBase::CallSubsessionFunction(TInt aFunction) const sl@0: /** sl@0: Send a command to the corresponding server-side subsession. sl@0: The subclass uses this function instead of directly calling sl@0: RSubSessionBase::SendReceive because it adds the SCS code which sl@0: marks this as a subsession call. Therefore, it can be routed sl@0: to the subsession object on the server side without any custom sl@0: decoding. sl@0: sl@0: @param aFunction Subsession command identifier. Bits 31:24 must be zero, sl@0: because they are reserved for SCS commands. sl@0: @return Error code with which the server completed the request. sl@0: */ sl@0: { sl@0: __ASSERT_DEBUG(! ScsFieldUsed(aFunction), ClientSidePanic(EScsClNoArgsSubsessUsedScs)); sl@0: sl@0: TInt f = ECallSubsessionFunc | aFunction; sl@0: return RSubSessionBase::SendReceive(f); sl@0: } sl@0: sl@0: EXPORT_C TInt RScsClientSubsessionBase::CallSubsessionFunction(TInt aFunction, const TIpcArgs& aArgs) const sl@0: /** sl@0: Send a command to the corresponding server-side subsession. sl@0: The subclass uses this function instead of directly calling sl@0: RSubSessionBase::SendReceive because it adds the SCS code which sl@0: marks this as a subsession call. Therefore, it can be routed sl@0: to the subsession object on the server side without any custom sl@0: decoding. sl@0: sl@0: @param aFunction Subsession command identifier. Bits 31:24 must be zero, sl@0: because they are reserved for SCS commands. sl@0: @param aArgs Standard IPC arguments. The fourth argument cannot be sl@0: used because that is reserved for the subsession handle. sl@0: @return Error code with which the server completed the request. sl@0: */ sl@0: { sl@0: __ASSERT_DEBUG(! ScsFieldUsed(aFunction), ClientSidePanic(EScsClArgsSubsessUsedScs)); sl@0: sl@0: TInt f = ECallSubsessionFunc | aFunction; sl@0: return RSubSessionBase::SendReceive(f, aArgs); sl@0: } sl@0: sl@0: EXPORT_C void RScsClientSubsessionBase::CallSubsessionFunction(TInt aFunction, const TIpcArgs& aArgs, TRequestStatus& aStatus) const sl@0: /** sl@0: Send a command to the corresponding server-side subsession. sl@0: sl@0: @param aFunction Subsession command identifier. Bits 31:24 must be zero, sl@0: because they are reserved for SCS commands. sl@0: @param aArgs Standard IPC arguments. The fourth argument cannot be sl@0: used because that is reserved for the subsession handle. sl@0: @param aStatus The server completes this object when it has finished sl@0: handling the session. sl@0: */ sl@0: { sl@0: __ASSERT_DEBUG(! ScsFieldUsed(aFunction), ClientSidePanic(EScsClArgsSubsessAsyncUsedScs)); sl@0: sl@0: TInt f = ECallSubsessionFunc | aFunction; sl@0: RSubSessionBase::SendReceive(f, aArgs, aStatus); sl@0: } sl@0: sl@0: EXPORT_C void RScsClientSubsessionBase::CancelSubsessionFunction(TInt aFunction) const sl@0: /** sl@0: Cancel an outstanding subsession request. This has no effect if the sl@0: request is not outstanding. sl@0: sl@0: @param aFunction Implementation function. This must be the sl@0: same value that was supplied to CallSubsessionFunction. sl@0: */ sl@0: { sl@0: __ASSERT_DEBUG(! ScsFieldUsed(aFunction), ClientSidePanic(EScsClCancelSubsessUsedScs)); sl@0: sl@0: TInt f = ECancelSubsessionFunc | aFunction; sl@0: RSubSessionBase::SendReceive(f); sl@0: } sl@0: