|
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: |
|
81 subSession = new( ELeave ) CPhSrvSubSessionExtCall( aSession ); |
|
82 break; |
|
83 case EPhoneServerNotifySubSessionOpen: |
|
84 subSession = new( ELeave ) CPhSrvSubSessionNotifier( aSession ); |
|
85 break; |
|
86 case EPhoneServerUSSDSubSessionOpen: |
|
87 subSession = new( ELeave ) CPhSrvSubSessionUssd( aSession ); |
|
88 break; |
|
89 case EPhoneServerEmergencyNumberSubSessionOpen: |
|
90 subSession = new( ELeave ) CPhSrvSubSessionEmergencyNum( aSession ); |
|
91 break; |
|
92 case EPhoneServerComHandSubSessionOpen: |
|
93 subSession = |
|
94 CPhSrvSubSessionCommandHandler::NewL( aSession ); |
|
95 break; |
|
96 case EPhoneServerMessengerSubSessionOpen: |
|
97 subSession = |
|
98 CPhSrvSubSessionMessenger::NewL( aSession ); |
|
99 break; |
|
100 |
|
101 case EPhoneServerImageHandlerSubSessionOpen: |
|
102 subSession = CPhSrvSubSessionImageHandler::NewL( aSession ); |
|
103 break; |
|
104 default: |
|
105 break; |
|
106 } |
|
107 |
|
108 // Complete construction |
|
109 if ( aFunction != EPhoneServerImageHandlerSubSessionOpen ) |
|
110 { |
|
111 CleanupStack::PushL( subSession ); |
|
112 } |
|
113 subSession->ConstructL(); |
|
114 return subSession; |
|
115 } |
|
116 |
|
117 // ----------------------------------------------------------------------------- |
|
118 // PhSrvSubSessionFactory::PhSrvSubSessionFactoryIsCreationAllowed |
|
119 // |
|
120 // This function returns ETrue if Creation a new instance of a subsession based upon |
|
121 // the IPC op code specified is allowed for the Secure ID of the process which |
|
122 // sent this message. |
|
123 // ----------------------------------------------------------------------------- |
|
124 // |
|
125 TBool PhSrvSubSessionFactory::PhSrvSubSessionFactoryIsCreationAllowed( |
|
126 TInt aFunction, |
|
127 TUint32 aSID ) |
|
128 { |
|
129 switch( aFunction ) |
|
130 { |
|
131 case EPhoneServerNotifySubSessionOpen: |
|
132 case EPhoneServerComHandNotifySubSessionOpen: |
|
133 if ( aSID == KPhoneSecureId.iUid |
|
134 #if defined(__WINSCW__) |
|
135 // To enable module testing using EUnit |
|
136 || aSID == KEunitExeRunnerId.iUid |
|
137 #endif // __WINSCW__ |
|
138 ) |
|
139 { |
|
140 return ETrue; |
|
141 } |
|
142 else |
|
143 { |
|
144 return EFalse; |
|
145 } |
|
146 default: |
|
147 return ETrue; |
|
148 } |
|
149 } |
|
150 |
|
151 // End of File |