sl@0
|
1 |
/*
|
sl@0
|
2 |
* Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
|
sl@0
|
3 |
* All rights reserved.
|
sl@0
|
4 |
* This component and the accompanying materials are made available
|
sl@0
|
5 |
* under the terms of the License "Eclipse Public License v1.0"
|
sl@0
|
6 |
* which accompanies this distribution, and is available
|
sl@0
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
sl@0
|
8 |
*
|
sl@0
|
9 |
* Initial Contributors:
|
sl@0
|
10 |
* Nokia Corporation - initial contribution.
|
sl@0
|
11 |
*
|
sl@0
|
12 |
* Contributors:
|
sl@0
|
13 |
*
|
sl@0
|
14 |
* Description:
|
sl@0
|
15 |
* Defines the functionality which client-side subsession handles use
|
sl@0
|
16 |
* to create and destroy subsessions, and to send messages to them.
|
sl@0
|
17 |
*
|
sl@0
|
18 |
*/
|
sl@0
|
19 |
|
sl@0
|
20 |
|
sl@0
|
21 |
/**
|
sl@0
|
22 |
@file
|
sl@0
|
23 |
*/
|
sl@0
|
24 |
|
sl@0
|
25 |
|
sl@0
|
26 |
#include <scs/scsclient.h>
|
sl@0
|
27 |
#include <scs/scscommon.h>
|
sl@0
|
28 |
|
sl@0
|
29 |
using namespace ScsImpl;
|
sl@0
|
30 |
|
sl@0
|
31 |
|
sl@0
|
32 |
EXPORT_C RScsClientSubsessionBase::RScsClientSubsessionBase()
|
sl@0
|
33 |
/**
|
sl@0
|
34 |
This protected constructor prevents the class from being
|
sl@0
|
35 |
instantiated directly.
|
sl@0
|
36 |
*/
|
sl@0
|
37 |
: RSubSessionBase()
|
sl@0
|
38 |
{
|
sl@0
|
39 |
// empty.
|
sl@0
|
40 |
}
|
sl@0
|
41 |
|
sl@0
|
42 |
EXPORT_C void RScsClientSubsessionBase::Close()
|
sl@0
|
43 |
/**
|
sl@0
|
44 |
Closes the subsession, releasing resources on the server side.
|
sl@0
|
45 |
*/
|
sl@0
|
46 |
{
|
sl@0
|
47 |
CloseSubSession(ECloseSubsession);
|
sl@0
|
48 |
}
|
sl@0
|
49 |
|
sl@0
|
50 |
EXPORT_C TInt RScsClientSubsessionBase::CreateSubsession(const RScsClientBase& aSession, TInt aFunction, const TIpcArgs& aArgs)
|
sl@0
|
51 |
/**
|
sl@0
|
52 |
Create a subsession over the supplied session.
|
sl@0
|
53 |
|
sl@0
|
54 |
@param aSession Session which will host the subsession.
|
sl@0
|
55 |
@param aFunction Command identifier. Bits 31:24 must be zero, because
|
sl@0
|
56 |
they are reserved for SCS commands.
|
sl@0
|
57 |
@param aArgs Standard IPC arguments. The fourth argument cannot be
|
sl@0
|
58 |
used because that is reserved for the subsession handle.
|
sl@0
|
59 |
@return Error code with which the server completed the request.
|
sl@0
|
60 |
*/
|
sl@0
|
61 |
{
|
sl@0
|
62 |
return RSubSessionBase::CreateSubSession(
|
sl@0
|
63 |
aSession,
|
sl@0
|
64 |
ECreateSubsession | aFunction,
|
sl@0
|
65 |
aArgs);
|
sl@0
|
66 |
}
|
sl@0
|
67 |
|
sl@0
|
68 |
EXPORT_C TInt RScsClientSubsessionBase::CallSubsessionFunction(TInt aFunction) const
|
sl@0
|
69 |
/**
|
sl@0
|
70 |
Send a command to the corresponding server-side subsession.
|
sl@0
|
71 |
The subclass uses this function instead of directly calling
|
sl@0
|
72 |
RSubSessionBase::SendReceive because it adds the SCS code which
|
sl@0
|
73 |
marks this as a subsession call. Therefore, it can be routed
|
sl@0
|
74 |
to the subsession object on the server side without any custom
|
sl@0
|
75 |
decoding.
|
sl@0
|
76 |
|
sl@0
|
77 |
@param aFunction Subsession command identifier. Bits 31:24 must be zero,
|
sl@0
|
78 |
because they are reserved for SCS commands.
|
sl@0
|
79 |
@return Error code with which the server completed the request.
|
sl@0
|
80 |
*/
|
sl@0
|
81 |
{
|
sl@0
|
82 |
__ASSERT_DEBUG(! ScsFieldUsed(aFunction), ClientSidePanic(EScsClNoArgsSubsessUsedScs));
|
sl@0
|
83 |
|
sl@0
|
84 |
TInt f = ECallSubsessionFunc | aFunction;
|
sl@0
|
85 |
return RSubSessionBase::SendReceive(f);
|
sl@0
|
86 |
}
|
sl@0
|
87 |
|
sl@0
|
88 |
EXPORT_C TInt RScsClientSubsessionBase::CallSubsessionFunction(TInt aFunction, const TIpcArgs& aArgs) const
|
sl@0
|
89 |
/**
|
sl@0
|
90 |
Send a command to the corresponding server-side subsession.
|
sl@0
|
91 |
The subclass uses this function instead of directly calling
|
sl@0
|
92 |
RSubSessionBase::SendReceive because it adds the SCS code which
|
sl@0
|
93 |
marks this as a subsession call. Therefore, it can be routed
|
sl@0
|
94 |
to the subsession object on the server side without any custom
|
sl@0
|
95 |
decoding.
|
sl@0
|
96 |
|
sl@0
|
97 |
@param aFunction Subsession command identifier. Bits 31:24 must be zero,
|
sl@0
|
98 |
because they are reserved for SCS commands.
|
sl@0
|
99 |
@param aArgs Standard IPC arguments. The fourth argument cannot be
|
sl@0
|
100 |
used because that is reserved for the subsession handle.
|
sl@0
|
101 |
@return Error code with which the server completed the request.
|
sl@0
|
102 |
*/
|
sl@0
|
103 |
{
|
sl@0
|
104 |
__ASSERT_DEBUG(! ScsFieldUsed(aFunction), ClientSidePanic(EScsClArgsSubsessUsedScs));
|
sl@0
|
105 |
|
sl@0
|
106 |
TInt f = ECallSubsessionFunc | aFunction;
|
sl@0
|
107 |
return RSubSessionBase::SendReceive(f, aArgs);
|
sl@0
|
108 |
}
|
sl@0
|
109 |
|
sl@0
|
110 |
EXPORT_C void RScsClientSubsessionBase::CallSubsessionFunction(TInt aFunction, const TIpcArgs& aArgs, TRequestStatus& aStatus) const
|
sl@0
|
111 |
/**
|
sl@0
|
112 |
Send a command to the corresponding server-side subsession.
|
sl@0
|
113 |
|
sl@0
|
114 |
@param aFunction Subsession command identifier. Bits 31:24 must be zero,
|
sl@0
|
115 |
because they are reserved for SCS commands.
|
sl@0
|
116 |
@param aArgs Standard IPC arguments. The fourth argument cannot be
|
sl@0
|
117 |
used because that is reserved for the subsession handle.
|
sl@0
|
118 |
@param aStatus The server completes this object when it has finished
|
sl@0
|
119 |
handling the session.
|
sl@0
|
120 |
*/
|
sl@0
|
121 |
{
|
sl@0
|
122 |
__ASSERT_DEBUG(! ScsFieldUsed(aFunction), ClientSidePanic(EScsClArgsSubsessAsyncUsedScs));
|
sl@0
|
123 |
|
sl@0
|
124 |
TInt f = ECallSubsessionFunc | aFunction;
|
sl@0
|
125 |
RSubSessionBase::SendReceive(f, aArgs, aStatus);
|
sl@0
|
126 |
}
|
sl@0
|
127 |
|
sl@0
|
128 |
EXPORT_C void RScsClientSubsessionBase::CancelSubsessionFunction(TInt aFunction) const
|
sl@0
|
129 |
/**
|
sl@0
|
130 |
Cancel an outstanding subsession request. This has no effect if the
|
sl@0
|
131 |
request is not outstanding.
|
sl@0
|
132 |
|
sl@0
|
133 |
@param aFunction Implementation function. This must be the
|
sl@0
|
134 |
same value that was supplied to CallSubsessionFunction.
|
sl@0
|
135 |
*/
|
sl@0
|
136 |
{
|
sl@0
|
137 |
__ASSERT_DEBUG(! ScsFieldUsed(aFunction), ClientSidePanic(EScsClCancelSubsessUsedScs));
|
sl@0
|
138 |
|
sl@0
|
139 |
TInt f = ECancelSubsessionFunc | aFunction;
|
sl@0
|
140 |
RSubSessionBase::SendReceive(f);
|
sl@0
|
141 |
}
|
sl@0
|
142 |
|