33
|
1 |
/*
|
|
2 |
* Copyright (c) 2002-2005 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 "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: Sub Session Factory.
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
|
|
21 |
// INCLUDES
|
|
22 |
#include "phcltclientserver.h"
|
|
23 |
|
|
24 |
#include "phsrvsubsessionfactory.h"
|
|
25 |
#include "cphsrvsubsessionnotifier.h"
|
|
26 |
#include "cphsrvsubsessionextcall.h"
|
|
27 |
#include "cphsrvsubsessionussd.h"
|
|
28 |
#include "cphsrvsubsessionemergencynum.h"
|
|
29 |
#include "cphsrvsubsessioncommandhandler.h"
|
|
30 |
#include "cphsrvsubsessionmessenger.h"
|
|
31 |
#include "cphsrvsubsessionimagehandler.h"
|
|
32 |
|
|
33 |
|
|
34 |
// ============================ MEMBER FUNCTIONS ===============================
|
|
35 |
|
|
36 |
// -----------------------------------------------------------------------------
|
|
37 |
// PhSrvSubSessionFactory::PhSrvSubSessionFactoryIsCreationFunction
|
|
38 |
//
|
|
39 |
// A processing function that allows certain IPC op-codes
|
|
40 |
// to be intercepted and processed by the session rather than
|
|
41 |
// a subsession. This function returns ETrue if it is one of
|
|
42 |
// these special IPC op codes.
|
|
43 |
// -----------------------------------------------------------------------------
|
|
44 |
//
|
|
45 |
TBool PhSrvSubSessionFactory::PhSrvSubSessionFactoryIsCreationFunction(
|
|
46 |
TInt aFunction )
|
|
47 |
{
|
|
48 |
switch( aFunction )
|
|
49 |
{
|
|
50 |
case EPhoneServerExtCallSubSessionOpen:
|
|
51 |
case EPhoneServerNotifySubSessionOpen:
|
|
52 |
case EPhoneServerUSSDSubSessionOpen:
|
|
53 |
case EPhoneServerEmergencyNumberSubSessionOpen:
|
|
54 |
case EPhoneServerComHandSubSessionOpen:
|
|
55 |
case EPhoneServerMessengerSubSessionOpen:
|
|
56 |
case EPhoneServerImageHandlerSubSessionOpen:
|
|
57 |
return ETrue;
|
|
58 |
|
|
59 |
default:
|
|
60 |
return EFalse;
|
|
61 |
}
|
|
62 |
}
|
|
63 |
|
|
64 |
|
|
65 |
// -----------------------------------------------------------------------------
|
|
66 |
// PhSrvSubSessionFactory::PhSrvSubSessionFactoryCreateLC
|
|
67 |
//
|
|
68 |
// Creates a new instance of a subsession based upon the
|
|
69 |
// IPC op code specified.
|
|
70 |
// -----------------------------------------------------------------------------
|
|
71 |
//
|
|
72 |
CPhSrvSubSessionBase* PhSrvSubSessionFactory::PhSrvSubSessionFactoryCreateLC(
|
|
73 |
TInt aFunction,
|
|
74 |
CPhSrvSession& aSession )
|
|
75 |
{
|
|
76 |
CPhSrvSubSessionBase* subSession = NULL;
|
|
77 |
|
|
78 |
switch( aFunction )
|
|
79 |
{
|
|
80 |
case EPhoneServerExtCallSubSessionOpen:
|
53
|
81 |
{
|
33
|
82 |
subSession = new( ELeave ) CPhSrvSubSessionExtCall( aSession );
|
|
83 |
break;
|
53
|
84 |
}
|
33
|
85 |
case EPhoneServerNotifySubSessionOpen:
|
53
|
86 |
{
|
33
|
87 |
subSession = new( ELeave ) CPhSrvSubSessionNotifier( aSession );
|
|
88 |
break;
|
53
|
89 |
}
|
33
|
90 |
case EPhoneServerUSSDSubSessionOpen:
|
53
|
91 |
{
|
33
|
92 |
subSession = new( ELeave ) CPhSrvSubSessionUssd( aSession );
|
|
93 |
break;
|
53
|
94 |
}
|
33
|
95 |
case EPhoneServerEmergencyNumberSubSessionOpen:
|
53
|
96 |
{
|
33
|
97 |
subSession =
|
53
|
98 |
new( ELeave ) CPhSrvSubSessionEmergencyNum( aSession );
|
33
|
99 |
break;
|
53
|
100 |
}
|
33
|
101 |
case EPhoneServerMessengerSubSessionOpen:
|
53
|
102 |
{
|
|
103 |
subSession = CPhSrvSubSessionMessenger::NewL( aSession );
|
33
|
104 |
break;
|
53
|
105 |
}
|
|
106 |
case EPhoneServerComHandSubSessionOpen:
|
|
107 |
{
|
|
108 |
subSession = CPhSrvSubSessionCommandHandler::NewL( aSession );
|
|
109 |
break;
|
|
110 |
}
|
33
|
111 |
case EPhoneServerImageHandlerSubSessionOpen:
|
53
|
112 |
{
|
33
|
113 |
subSession = CPhSrvSubSessionImageHandler::NewL( aSession );
|
|
114 |
break;
|
53
|
115 |
}
|
33
|
116 |
default:
|
53
|
117 |
{
|
|
118 |
User::Leave( KErrNotSupported );
|
33
|
119 |
break;
|
53
|
120 |
}
|
33
|
121 |
}
|
|
122 |
|
|
123 |
// Complete construction
|
53
|
124 |
CleanupStack::PushL( subSession );
|
33
|
125 |
subSession->ConstructL();
|
53
|
126 |
|
33
|
127 |
return subSession;
|
|
128 |
}
|
|
129 |
|
|
130 |
// -----------------------------------------------------------------------------
|
|
131 |
// PhSrvSubSessionFactory::PhSrvSubSessionFactoryIsCreationAllowed
|
|
132 |
//
|
|
133 |
// This function returns ETrue if Creation a new instance of a subsession based upon
|
|
134 |
// the IPC op code specified is allowed for the Secure ID of the process which
|
|
135 |
// sent this message.
|
|
136 |
// -----------------------------------------------------------------------------
|
|
137 |
//
|
|
138 |
TBool PhSrvSubSessionFactory::PhSrvSubSessionFactoryIsCreationAllowed(
|
|
139 |
TInt aFunction,
|
|
140 |
TUint32 aSID )
|
|
141 |
{
|
|
142 |
switch( aFunction )
|
|
143 |
{
|
|
144 |
case EPhoneServerNotifySubSessionOpen:
|
|
145 |
case EPhoneServerComHandNotifySubSessionOpen:
|
|
146 |
if ( aSID == KPhoneSecureId.iUid
|
|
147 |
#if defined(__WINSCW__)
|
|
148 |
// To enable module testing using EUnit
|
|
149 |
|| aSID == KEunitExeRunnerId.iUid
|
|
150 |
#endif // __WINSCW__
|
|
151 |
)
|
|
152 |
{
|
|
153 |
return ETrue;
|
|
154 |
}
|
|
155 |
else
|
|
156 |
{
|
|
157 |
return EFalse;
|
|
158 |
}
|
|
159 |
default:
|
|
160 |
return ETrue;
|
|
161 |
}
|
|
162 |
}
|
|
163 |
|
|
164 |
// End of File
|