|
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: Server class |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef CSATSSERVER_H |
|
20 #define CSATSSERVER_H |
|
21 |
|
22 #include <e32base.h> |
|
23 #include "TSatEventMediator.h" |
|
24 #include "MSatSSessions.h" |
|
25 |
|
26 class CSatCommandContainer; |
|
27 class CSatSUiClientHandler; |
|
28 class MSatUtils; |
|
29 |
|
30 // ---------------------------------------------------------------------------------------- |
|
31 // Server's policy here |
|
32 // ---------------------------------------------------------------------------------------- |
|
33 |
|
34 //Total number of ranges |
|
35 const TUint KSatServerCount = 14; // 13 + 0 |
|
36 |
|
37 //Definition of the ranges of IPC numbers |
|
38 const TInt satServerRanges[KSatServerCount] = |
|
39 { |
|
40 // Illegal service request. |
|
41 0, //ESatSNone, //Range 0 |
|
42 |
|
43 /*// Server test commands |
|
44 ESatSDisplayText, |
|
45 ESatSNotifyTest, |
|
46 ESatSNotifyTestCancel, |
|
47 ESatSShutdown,*/ |
|
48 1, // Range 1. |
|
49 |
|
50 /*These proactive commands need no capability checling |
|
51 Proactive commands (asynchronous) |
|
52 ESatSProactiveDisplayText, |
|
53 ESatSProactiveGetInkey, |
|
54 ESatSProactiveGetInput, |
|
55 ESatSProactiveSetUpMenu, |
|
56 ESatSProactiveSelectItem, |
|
57 ESatSProactivePlayTone, |
|
58 ESatSProactiveRefresh,*/ |
|
59 5, // Range 2. |
|
60 |
|
61 /* This range needs capability checking, NetworkServices. |
|
62 //ESatSProactiveSendSs, |
|
63 ESatSProactiveSendUssd, |
|
64 ESatSProactiveSendDtmf, |
|
65 ESatSProactiveQuery, // for Send SM and Set Up Call |
|
66 ESatSProactiveEvent, // for server event notification |
|
67 ESatSProactiveSetUpCall,*/ |
|
68 12, // Range 3. |
|
69 |
|
70 // Envelope commands (synchronous) |
|
71 // ESatSActiveMenuSelection, |
|
72 18, // Range 4 |
|
73 |
|
74 // CallControl command |
|
75 //ESatSCallControl, |
|
76 19, // Range 5 |
|
77 |
|
78 |
|
79 // MoSmControl command |
|
80 // ESatSMoSmControl, |
|
81 20, // Range 6 |
|
82 |
|
83 /* Command responses (synchronous) |
|
84 ESatSProactiveDisplayTextResponse, |
|
85 ESatSProactiveGetInkeyResponse, |
|
86 ESatSProactiveGetInputResponse, |
|
87 ESatSProactiveSetUpMenuResponse, |
|
88 ESatSProactiveSelectItemResponse, |
|
89 ESatSProactivePlayToneResponse, |
|
90 ESatSProactiveSendSsResponse, |
|
91 ESatSProactiveSendUssdResponse, |
|
92 ESatSProactiveSendDtmfResponse, |
|
93 ESatSProactiveQueryResponse, |
|
94 ESatSProactiveEventResponse, |
|
95 ESatSProactiveSetUpCallResponse,*/ |
|
96 21, // Range 7 |
|
97 |
|
98 // SAT UI related call control response |
|
99 //ESatSCallControlUIResponse, |
|
100 33, // Range 8 |
|
101 |
|
102 // ESatSProactiveRefreshResponse, |
|
103 34, // Range 9 |
|
104 |
|
105 // SAT UI related response |
|
106 // ESatSMoSmControlUIResponse, |
|
107 35, // Range 10 |
|
108 |
|
109 /* Session indicators (for internal use) |
|
110 ESatSOpenUiSubSession, |
|
111 ESatSGetSIMAppStatus, |
|
112 ESatSCloseUiSubSession,*/ |
|
113 |
|
114 36, // Range 11 |
|
115 |
|
116 /* Refresh handling |
|
117 ESatSOpenRefreshSubSession, |
|
118 ESatSCloseRefreshSubSession, |
|
119 ESatSRefreshAllowed, |
|
120 ESatSNotifyAllowRefresh, |
|
121 ESatSNotityAllowRefreshCancel, |
|
122 ESatSNotifyRefresh, |
|
123 ESatSCancelNotifyRefresh,*/ |
|
124 |
|
125 39, // Range 12 |
|
126 |
|
127 /* Icon handling |
|
128 ESatSOpenIconSubSession, |
|
129 ESatSCloseIconSubSession, |
|
130 ESatSGetIconInfo, |
|
131 ESatSGetIconInstance, |
|
132 ESatSIconInstanceGot*/ |
|
133 |
|
134 46, // Range 13 |
|
135 |
|
136 }; |
|
137 |
|
138 //Policy to implement for each of the above ranges |
|
139 const TUint8 satServerElementsIndex[KSatServerCount] = |
|
140 { |
|
141 CPolicyServer::EAlwaysPass, // 0 |
|
142 CPolicyServer::EAlwaysPass, // 1 |
|
143 CPolicyServer::EAlwaysPass, // 2 |
|
144 0, // Check Network Capabilites for this range |
|
145 CPolicyServer::EAlwaysPass, // 4 |
|
146 CPolicyServer::EAlwaysPass, // 5 |
|
147 CPolicyServer::EAlwaysPass, // 6 |
|
148 CPolicyServer::EAlwaysPass, // 7 |
|
149 CPolicyServer::EAlwaysPass, // 8 |
|
150 CPolicyServer::EAlwaysPass, // 9 |
|
151 CPolicyServer::EAlwaysPass, // 10 |
|
152 CPolicyServer::EAlwaysPass, // 11 |
|
153 CPolicyServer::EAlwaysPass, // 12 |
|
154 CPolicyServer::EAlwaysPass // 13 |
|
155 }; |
|
156 |
|
157 //Specific capability checks |
|
158 const CPolicyServer::TPolicyElement satServerElements[] = |
|
159 { |
|
160 // policy "0"; fail call if NetworkServices not present. |
|
161 //lint -e{778,1924} Macro can not be affected. |
|
162 { |
|
163 _INIT_SECURITY_POLICY_C1( ECapabilityNetworkServices ), |
|
164 CPolicyServer::EFailClient |
|
165 }, |
|
166 }; |
|
167 |
|
168 //Package all the above together into a policy |
|
169 const CPolicyServer::TPolicy satServerPolicy = |
|
170 { |
|
171 CPolicyServer::EAlwaysPass, //specifies all connect attempts should pass |
|
172 KSatServerCount, //number of ranges |
|
173 satServerRanges, //ranges array |
|
174 satServerElementsIndex, //elements<->ranges index |
|
175 satServerElements, //array of elements |
|
176 }; |
|
177 |
|
178 // End Server's Policy |
|
179 |
|
180 /** |
|
181 * Manages sessions |
|
182 * |
|
183 * @lib SatServer.exe |
|
184 * @since Series 60 3.0 |
|
185 */ |
|
186 class CSatSServer : public CPolicyServer, |
|
187 public MSatSSessions |
|
188 { |
|
189 public: // Constructors and destructor |
|
190 |
|
191 /** |
|
192 * Two-phased constructor. |
|
193 */ |
|
194 static CSatSServer* NewL(); |
|
195 |
|
196 /** |
|
197 * Destructor. |
|
198 */ |
|
199 virtual ~CSatSServer(); |
|
200 |
|
201 public: // New functions |
|
202 |
|
203 /** |
|
204 * Completes current message from client. |
|
205 * @param aError Standard Symbian error code. |
|
206 */ |
|
207 void CompleteMessage( TInt aError ) const; |
|
208 |
|
209 /** |
|
210 * Creates new container for sessions. |
|
211 * @return New container. |
|
212 */ |
|
213 CObjectCon* CreateNewContainerL(); |
|
214 |
|
215 /** |
|
216 * Gets MSatUtils interface |
|
217 * @return MSatUtils interface |
|
218 */ |
|
219 MSatUtils* SatUtils(); |
|
220 |
|
221 /** |
|
222 * Adds refresh subsession. |
|
223 * @param aSubSession refresh subsession. |
|
224 */ |
|
225 void AddL( const MSatRefreshSubSession* aSubSession ); |
|
226 |
|
227 /** |
|
228 * Removes refresh subsession. |
|
229 * @param aSubSession Sub session to be removed. |
|
230 */ |
|
231 void Remove( const MSatRefreshSubSession* aSubSession ); |
|
232 |
|
233 public: // Functions from base classes |
|
234 |
|
235 /** |
|
236 * From MSatSSessions Gives ui session interface. |
|
237 * @return Interface for ui session |
|
238 */ |
|
239 MSatUiSession* UiSession(); |
|
240 |
|
241 /** |
|
242 * From MSatSSessions Gives refresh subsessions. |
|
243 * @return Pointer array containing refresh subsessions |
|
244 */ |
|
245 const RPointerArray<MSatRefreshSubSession>& RefreshSubSessions(); |
|
246 |
|
247 private: // Functions from base classes |
|
248 |
|
249 /** |
|
250 * From CServer2, creates a new server session. |
|
251 * @param aVersion Client interface version. |
|
252 * @param aMessage 'connect' message from the client. |
|
253 * @return Pointer to the created server session. |
|
254 */ |
|
255 CSession2* NewSessionL( |
|
256 const TVersion& aVersion, |
|
257 const RMessage2& aMessage ) const; |
|
258 |
|
259 private: |
|
260 |
|
261 /** |
|
262 * C++ default constructor. |
|
263 */ |
|
264 CSatSServer(); |
|
265 |
|
266 /** |
|
267 * By default Symbian 2nd phase constructor is private. |
|
268 */ |
|
269 void ConstructL(); |
|
270 |
|
271 private: // Data |
|
272 |
|
273 // SAT Command handler container |
|
274 CSatCommandContainer* iCmdContainer; |
|
275 |
|
276 // SAT Ui client handler |
|
277 CSatSUiClientHandler* iUiHandler; |
|
278 |
|
279 // Event mediator |
|
280 TSatEventMediator iEventMediator; |
|
281 |
|
282 // CObjectCon factory. |
|
283 CObjectConIx* iObjectConIx; |
|
284 |
|
285 // Refresh subsessions |
|
286 RPointerArray<MSatRefreshSubSession> iRefreshSubSessions; |
|
287 |
|
288 }; |
|
289 |
|
290 #endif // CSATSSERVER_H |