|
1 /* |
|
2 * Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of the License "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 * Client-side API tests an implementation of the session count server |
|
16 * by implementing a handle to a subsession. |
|
17 * |
|
18 */ |
|
19 |
|
20 |
|
21 /** |
|
22 @file |
|
23 */ |
|
24 |
|
25 #include "scstestclient.h" |
|
26 #include "scstestcommon.h" |
|
27 |
|
28 |
|
29 EXPORT_C RScsTestSubsession::RScsTestSubsession() |
|
30 /** |
|
31 This constructor provides a single definition from |
|
32 which to call the base class constructor. |
|
33 */ |
|
34 : RScsClientSubsessionBase() |
|
35 { |
|
36 // empty. |
|
37 } |
|
38 |
|
39 EXPORT_C TInt RScsTestSubsession::Create(RScsTestSession& aSession, TInt aValue) |
|
40 /** |
|
41 Create a new subsession over the supplied session. |
|
42 |
|
43 @param aSession Session which will host this subsession. |
|
44 @param aValue Value which will be stored by the subsession. |
|
45 @return Symbian OS error code where KErrNone indicates |
|
46 success and any other value indicates failure. |
|
47 */ |
|
48 { |
|
49 TIpcArgs args(aValue); |
|
50 return CreateSubsession(aSession, ScsTestImpl::ESessSubsessFromInt, args); |
|
51 } |
|
52 |
|
53 EXPORT_C TInt RScsTestSubsession::SendFunction(TInt aFunction) |
|
54 /** |
|
55 Send an arbitrary function identifier to the subsession. |
|
56 Used to test the subsession implementation handles unrecognized |
|
57 functions correctly. |
|
58 |
|
59 @param aFunction Arbitrary function. Note that, unlike the |
|
60 RScsTestSession::SendFunction, this cannot |
|
61 include an SCS code. |
|
62 @see RScsTestSession::SendFunction |
|
63 */ |
|
64 { |
|
65 return CallSubsessionFunction(aFunction); |
|
66 } |
|
67 |
|
68 EXPORT_C TInt RScsTestSubsession::Quadruple(TInt& aResult) |
|
69 /** |
|
70 Send a synchronous request to the subsession. |
|
71 |
|
72 @param aResult On return this should be set to four times |
|
73 the value of the integer which was supplied to |
|
74 Create when the subsession was created. |
|
75 @return Symbian OS error code where KErrNone indicates |
|
76 success and any other value indicates failure. |
|
77 @see Create |
|
78 */ |
|
79 { |
|
80 TPckg<TInt> resultPckg(aResult); |
|
81 TIpcArgs args(&resultPckg); |
|
82 return CallSubsessionFunction(ScsTestImpl::ESubsessQuadruple, args); |
|
83 } |
|
84 |
|
85 EXPORT_C void RScsTestSubsession::Treble(TDes8& aValue, TRequestStatus& aStatus) |
|
86 /** |
|
87 Launch an aysnchronous request on the subsession. |
|
88 |
|
89 To reuse server-side code, this does not use the integer |
|
90 value stored in the subsession object, but transforms |
|
91 the supplied value in the same way as the session implementation. |
|
92 |
|
93 @param aValue Describes an integer, e.g. TPckgBuf<TInt>. |
|
94 The descriptor must be supplied by the caller |
|
95 instead of being constructed in this function |
|
96 because it must persist until the request has |
|
97 been completed. |
|
98 @param aStatus The server will complete this status object |
|
99 when it has handled the function. |
|
100 */ |
|
101 { |
|
102 TIpcArgs args(&aValue); |
|
103 CallSubsessionFunction(ScsTestImpl::ESubsessTreble, args, aStatus); |
|
104 } |
|
105 |
|
106 EXPORT_C void RScsTestSubsession::CancelTreble() |
|
107 /** |
|
108 Cancel an outstanding synchronous request launched with Treble. |
|
109 |
|
110 @see Treble |
|
111 */ |
|
112 { |
|
113 return CancelSubsessionFunction(ScsTestImpl::ESubsessTreble); |
|
114 } |
|
115 |