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 |
* Implements CScsTestSubsession. See class and function definitons
|
sl@0
|
16 |
* for more information.
|
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 |
#include "scstestserver.h"
|
sl@0
|
26 |
|
sl@0
|
27 |
|
sl@0
|
28 |
CScsTestSubsession* CScsTestSubsession::NewL(CScsTestSession &aSession, const RMessage2& aMessage)
|
sl@0
|
29 |
/**
|
sl@0
|
30 |
Factory function allocates new, initialized instance of CScsTestSubsession.
|
sl@0
|
31 |
|
sl@0
|
32 |
@param aSession Reference to our parent session
|
sl@0
|
33 |
@param aMessage Create subsession message sent from the client.
|
sl@0
|
34 |
This contains the integer on which the subsession
|
sl@0
|
35 |
is curried.
|
sl@0
|
36 |
@return New, initialized instance of CScsTestSubsession
|
sl@0
|
37 |
which is owned by the caller.
|
sl@0
|
38 |
*/
|
sl@0
|
39 |
{
|
sl@0
|
40 |
CScsTestSubsession* self = new(ELeave) CScsTestSubsession(aSession);
|
sl@0
|
41 |
|
sl@0
|
42 |
// record value on which this subsession is curried
|
sl@0
|
43 |
self->iValue = aMessage.Int0();
|
sl@0
|
44 |
return self;
|
sl@0
|
45 |
}
|
sl@0
|
46 |
|
sl@0
|
47 |
CScsTestSubsession::CScsTestSubsession(CScsTestSession &aSession)
|
sl@0
|
48 |
/**
|
sl@0
|
49 |
This private constructor prevents direct instantiation and provides
|
sl@0
|
50 |
a single point of definition.
|
sl@0
|
51 |
*/
|
sl@0
|
52 |
: CScsSubsession(aSession)
|
sl@0
|
53 |
{
|
sl@0
|
54 |
// empty.
|
sl@0
|
55 |
}
|
sl@0
|
56 |
|
sl@0
|
57 |
CScsTestSubsession::~CScsTestSubsession()
|
sl@0
|
58 |
/**
|
sl@0
|
59 |
This destructor is only defined to breakpoint when the
|
sl@0
|
60 |
subsession is destroyed.
|
sl@0
|
61 |
*/
|
sl@0
|
62 |
{
|
sl@0
|
63 |
// empty.
|
sl@0
|
64 |
}
|
sl@0
|
65 |
|
sl@0
|
66 |
TBool CScsTestSubsession::DoServiceL(TInt aFunction, const RMessage2& aMessage)
|
sl@0
|
67 |
/**
|
sl@0
|
68 |
Implement CSscSubsession by handling messages sent to this subsession.
|
sl@0
|
69 |
|
sl@0
|
70 |
@param aFunction Function identifier without SCS code.
|
sl@0
|
71 |
@param aMessage Standard server-side handle to message.
|
sl@0
|
72 |
@return ETrue means complete client request now.
|
sl@0
|
73 |
*/
|
sl@0
|
74 |
{
|
sl@0
|
75 |
ScsTestImpl::TSubsessionFunction f =
|
sl@0
|
76 |
static_cast<ScsTestImpl::TSubsessionFunction>(aFunction);
|
sl@0
|
77 |
|
sl@0
|
78 |
TBool completeMessage = ETrue;
|
sl@0
|
79 |
switch (f)
|
sl@0
|
80 |
{
|
sl@0
|
81 |
case ScsTestImpl::ESubsessQuadruple:
|
sl@0
|
82 |
{
|
sl@0
|
83 |
TPckgBuf<TInt> times4 = iValue * 4;
|
sl@0
|
84 |
aMessage.WriteL(0, times4);
|
sl@0
|
85 |
}
|
sl@0
|
86 |
break;
|
sl@0
|
87 |
|
sl@0
|
88 |
case ScsTestImpl::ESubsessTreble:
|
sl@0
|
89 |
{
|
sl@0
|
90 |
CScsTestSession* owningSession = static_cast<CScsTestSession*>(&iSession);
|
sl@0
|
91 |
CTrebleRequest::NewL(owningSession, this, aMessage);
|
sl@0
|
92 |
completeMessage = EFalse; // do not complete yet
|
sl@0
|
93 |
}
|
sl@0
|
94 |
break;
|
sl@0
|
95 |
|
sl@0
|
96 |
default:
|
sl@0
|
97 |
User::Leave(KErrNotSupported);
|
sl@0
|
98 |
}
|
sl@0
|
99 |
return completeMessage;
|
sl@0
|
100 |
}
|
sl@0
|
101 |
|