|
1 /* |
|
2 * Copyright (c) 2002 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: Principal handler for supplementary service procedures. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 // INCLUDE FILES |
|
20 #include <bldvariant.hrh> |
|
21 |
|
22 #include "CPhoneGsmSsHandler.h" |
|
23 #include "CPhoneGsmSsParser.h" |
|
24 #include "CPhoneGsmParserResult.h" |
|
25 |
|
26 // LOCAL FUNCTION PROTOTYPES |
|
27 |
|
28 /** |
|
29 * Converts from service type to action. |
|
30 */ |
|
31 CPhoneGsmSsHandler::TAction ConvertFromServiceType( |
|
32 CPhoneGsmSsParser::TServiceType aType ); |
|
33 |
|
34 // ============================= LOCAL FUNCTIONS =============================== |
|
35 |
|
36 // ----------------------------------------------------------------------------- |
|
37 // ConvertFromServiceType |
|
38 // ----------------------------------------------------------------------------- |
|
39 // |
|
40 CPhoneGsmSsHandler::TAction ConvertFromServiceType( |
|
41 CPhoneGsmSsParser::TServiceType aType ) |
|
42 { |
|
43 CPhoneGsmSsHandler::TAction result = |
|
44 CPhoneGsmSsHandler::EActivate; |
|
45 |
|
46 switch ( aType ) |
|
47 { |
|
48 case CPhoneGsmSsParser::EServiceActivation: |
|
49 result = CPhoneGsmSsHandler::EActivate; |
|
50 break; |
|
51 case CPhoneGsmSsParser::EServiceDeactivation: |
|
52 result = CPhoneGsmSsHandler::EDeactivate; |
|
53 break; |
|
54 case CPhoneGsmSsParser::EServiceInterrogation: |
|
55 result = CPhoneGsmSsHandler::EInterrogate; |
|
56 break; |
|
57 case CPhoneGsmSsParser::EServiceRegistration: |
|
58 result = CPhoneGsmSsHandler::ERegister; |
|
59 break; |
|
60 case CPhoneGsmSsParser::EServiceErasure: |
|
61 result = CPhoneGsmSsHandler::EErase; |
|
62 break; |
|
63 |
|
64 default: |
|
65 break; |
|
66 } |
|
67 |
|
68 return result; |
|
69 } |
|
70 |
|
71 // ============================ MEMBER FUNCTIONS =============================== |
|
72 |
|
73 // ----------------------------------------------------------------------------- |
|
74 // CPhoneGsmSsHandler::ProcessL |
|
75 // |
|
76 // Process result and call appropriate function. |
|
77 // ----------------------------------------------------------------------------- |
|
78 // |
|
79 EXPORT_C void CPhoneGsmSsHandler::ProcessL( |
|
80 CPhoneGsmParserResult& aResult ) |
|
81 { |
|
82 switch( aResult.Uid() ) |
|
83 { |
|
84 case KPhoneUidForwardingAll: |
|
85 DoProcessForwardingL( |
|
86 EForwardingAll, |
|
87 aResult ); |
|
88 break; |
|
89 |
|
90 case KPhoneUidForwardingAllConditional: |
|
91 DoProcessForwardingL( |
|
92 EForwardingAllConditional, |
|
93 aResult ); |
|
94 break; |
|
95 |
|
96 case KPhoneUidForwardingUnconditional: |
|
97 DoProcessForwardingL( |
|
98 EForwardingUnconditional, |
|
99 aResult ); |
|
100 break; |
|
101 |
|
102 case KPhoneUidForwardingNoReply: |
|
103 DoProcessForwardingL( |
|
104 EForwardingNoReply, |
|
105 aResult ); |
|
106 break; |
|
107 |
|
108 case KPhoneUidForwardingNotReachable: |
|
109 DoProcessForwardingL( |
|
110 EForwardingNotReachable, |
|
111 aResult ); |
|
112 break; |
|
113 |
|
114 case KPhoneUidForwardingBusy: |
|
115 DoProcessForwardingL( |
|
116 EForwardingBusy, |
|
117 aResult ); |
|
118 break; |
|
119 |
|
120 case KPhoneUidBarringAllOutgoingCalls: |
|
121 DoProcessBarringL( |
|
122 EBarringAllOutgoingCalls, |
|
123 aResult ); |
|
124 break; |
|
125 |
|
126 case KPhoneUidBarringAllIncomingCalls: |
|
127 DoProcessBarringL( |
|
128 EBarringAllIncomingCalls, |
|
129 aResult ); |
|
130 break; |
|
131 |
|
132 case KPhoneUidBarringAllServices: |
|
133 DoProcessBarringL( |
|
134 EBarringAllServices, |
|
135 aResult ); |
|
136 break; |
|
137 |
|
138 case KPhoneUidBarringAllOutgoingInternationalCalls: |
|
139 DoProcessBarringL( |
|
140 EBarringAllOutgoingInternationalCalls, |
|
141 aResult ); |
|
142 |
|
143 break; |
|
144 |
|
145 case KPhoneUidBarringAllOutgoingInternationalCallsExceptHome: |
|
146 DoProcessBarringL( |
|
147 EBarringAllOutgoingInternationalCallsExceptHome, |
|
148 aResult ); |
|
149 break; |
|
150 |
|
151 case KPhoneUidBarringAllOutgoingServices: |
|
152 DoProcessBarringL( |
|
153 EBarringAllOutgoingServices, |
|
154 aResult ); |
|
155 break; |
|
156 |
|
157 case KPhoneUidBarringAllIncomingCallsWhenRoaming: |
|
158 DoProcessBarringL( |
|
159 EBarringAllIncomingCallsWhenRoaming, |
|
160 aResult ); |
|
161 break; |
|
162 |
|
163 case KPhoneUidBarringAllIncomingServices: |
|
164 DoProcessBarringL( |
|
165 EBarringAllIncomingServices, |
|
166 aResult ); |
|
167 break; |
|
168 |
|
169 case KPhoneUidWaiting: |
|
170 { |
|
171 TPtrC ptr( KNullDesC ); |
|
172 |
|
173 if ( aResult.CountParameters() ) |
|
174 { |
|
175 ptr.Set( aResult.ParameterAt( 0 ) ); |
|
176 } |
|
177 |
|
178 TUint data = aResult.AuxInformation(); |
|
179 CPhoneGsmSsParser::TServiceType type; |
|
180 CPhoneGsmSsParser::TServiceSyntax syntax; |
|
181 |
|
182 CPhoneGsmSsParser::UnpackData( data, type, syntax ); |
|
183 |
|
184 TAction action = ConvertFromServiceType( type ); |
|
185 ProcessWaitingL( action, ptr ); |
|
186 } |
|
187 break; |
|
188 |
|
189 case KPhoneUidCallingLineIdentificationPresentation: |
|
190 ProcessClipStatusL(); |
|
191 break; |
|
192 |
|
193 case KPhoneUidCallingLineIdentificationRestriction: |
|
194 ProcessClirStatusL(); |
|
195 break; |
|
196 |
|
197 case KPhoneUidConnectedLinePresentation: |
|
198 ProcessColpStatusL(); |
|
199 break; |
|
200 |
|
201 case KPhoneUidConnectedLinePresentationRestriction: |
|
202 ProcessColrStatusL(); |
|
203 break; |
|
204 |
|
205 case KPhoneUidPassword: |
|
206 { |
|
207 TPasswordProcedure procedure = EPasswordNetwork; |
|
208 if ( aResult.ParameterAt( 0 ).Length() ) |
|
209 { |
|
210 procedure = EPasswordBarring; |
|
211 } |
|
212 |
|
213 ProcessPasswordChangeL( |
|
214 procedure, |
|
215 aResult.ParameterAt(1), |
|
216 aResult.ParameterAt(2), |
|
217 aResult.ParameterAt(3) ); |
|
218 } |
|
219 break; |
|
220 |
|
221 case KPhoneUidCallingNamePresentation: |
|
222 ProcessCnapStatusL(); |
|
223 break; |
|
224 |
|
225 default: |
|
226 break; |
|
227 } |
|
228 |
|
229 } |
|
230 |
|
231 // ----------------------------------------------------------------------------- |
|
232 // CPhoneGsmSsHandler::DoProcessBarringL |
|
233 // |
|
234 // Process barring procedures. |
|
235 // ----------------------------------------------------------------------------- |
|
236 // |
|
237 void CPhoneGsmSsHandler::DoProcessBarringL( |
|
238 TBarringProcedure aBarring, |
|
239 CPhoneGsmParserResult& aResult ) |
|
240 { |
|
241 CPhoneGsmSsParser::TServiceType type; |
|
242 CPhoneGsmSsParser::TServiceSyntax syntax; |
|
243 TPtrC password( KNullDesC ); |
|
244 TPtrC basicCode( KNullDesC ); |
|
245 |
|
246 CPhoneGsmSsParser::UnpackData( |
|
247 aResult.AuxInformation(), |
|
248 type, |
|
249 syntax ); |
|
250 |
|
251 TAction action = ConvertFromServiceType( type ); |
|
252 |
|
253 switch ( type ) |
|
254 { |
|
255 case CPhoneGsmSsParser::EServiceDeactivation: |
|
256 case CPhoneGsmSsParser::EServiceActivation: |
|
257 |
|
258 // First parameter is password. |
|
259 if ( aResult.CountParameters() >= 1 ) |
|
260 { |
|
261 password.Set( aResult.ParameterAt( 0 ) ); |
|
262 } |
|
263 |
|
264 // Second parameter is basic service code. |
|
265 if ( aResult.CountParameters() >= 2 ) |
|
266 { |
|
267 basicCode.Set( aResult.ParameterAt( 1 ) ); |
|
268 } |
|
269 |
|
270 ProcessBarringL( |
|
271 action, |
|
272 aBarring, |
|
273 password, |
|
274 basicCode ); |
|
275 |
|
276 break; |
|
277 |
|
278 case CPhoneGsmSsParser::EServiceInterrogation: |
|
279 |
|
280 // First parameter is basic service code. |
|
281 if ( aResult.CountParameters() >= 1 ) |
|
282 { |
|
283 basicCode.Set( aResult.ParameterAt( 0 ) ); |
|
284 } |
|
285 |
|
286 ProcessBarringL( |
|
287 action, |
|
288 aBarring, |
|
289 KNullDesC, |
|
290 basicCode ); |
|
291 |
|
292 break; |
|
293 |
|
294 case CPhoneGsmSsParser::EServiceRegistration: |
|
295 case CPhoneGsmSsParser::EServiceErasure: |
|
296 // These can never happen. |
|
297 break; |
|
298 |
|
299 default: |
|
300 break; |
|
301 } |
|
302 } |
|
303 |
|
304 // ----------------------------------------------------------------------------- |
|
305 // CPhoneGsmSsHandler::DoProcessForwardingL |
|
306 // |
|
307 // Process result and call appropriate function. |
|
308 // ----------------------------------------------------------------------------- |
|
309 // |
|
310 void CPhoneGsmSsHandler::DoProcessForwardingL( |
|
311 TForwardingProcedure aForwarding, |
|
312 CPhoneGsmParserResult& aResult ) |
|
313 { |
|
314 CPhoneGsmSsParser::TServiceType type; |
|
315 CPhoneGsmSsParser::TServiceSyntax syntax; |
|
316 |
|
317 CPhoneGsmSsParser::UnpackData( |
|
318 aResult.AuxInformation(), |
|
319 type, |
|
320 syntax ); |
|
321 |
|
322 TAction action = ConvertFromServiceType( type ); |
|
323 |
|
324 TPtrC number( KNullDesC ); |
|
325 TPtrC basicCode( KNullDesC ); |
|
326 TPtrC timer( KNullDesC ); |
|
327 |
|
328 switch ( type ) |
|
329 { |
|
330 case CPhoneGsmSsParser::EServiceActivation: |
|
331 case CPhoneGsmSsParser::EServiceDeactivation: |
|
332 case CPhoneGsmSsParser::EServiceInterrogation: |
|
333 case CPhoneGsmSsParser::EServiceErasure: |
|
334 basicCode.Set( aResult.ParameterAt( 1 ) ); |
|
335 break; |
|
336 |
|
337 case CPhoneGsmSsParser::EServiceRegistration: |
|
338 { |
|
339 number.Set( aResult.ParameterAt( 0 ) ); |
|
340 |
|
341 if ( aResult.CountParameters() > 1 ) |
|
342 { |
|
343 basicCode.Set( aResult.ParameterAt( 1 ) ); |
|
344 } |
|
345 |
|
346 if ( aResult.CountParameters() > 2 ) |
|
347 { |
|
348 timer.Set( aResult.ParameterAt( 2 ) ); |
|
349 } |
|
350 } |
|
351 break; |
|
352 |
|
353 default: |
|
354 break; |
|
355 } |
|
356 |
|
357 ProcessForwardingL( |
|
358 action, |
|
359 aForwarding, |
|
360 number, |
|
361 basicCode, |
|
362 timer ); |
|
363 |
|
364 } |
|
365 |
|
366 // End of File |