|
1 // Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // All rights reserved. |
|
3 // This component and the accompanying materials are made available |
|
4 // under the terms of "Eclipse Public License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // |
|
15 |
|
16 |
|
17 |
|
18 // INCLUDES |
|
19 #include <in_sock.h> |
|
20 #include "cmmpacketcontextgsmwcdmaext.h" |
|
21 #include "Cmmpacketcontexttsy.h" |
|
22 #include "Cmmpacketcontextlist.h" |
|
23 #include "cmmpacketservicegsmwcdmaext.h" |
|
24 #include "CMmCommonStaticUtility.h" |
|
25 #include <ctsy/serviceapi/mmtsy_ipcdefs.h> |
|
26 #include <ctsy/pluginapi/cmmdatapackage.h> |
|
27 |
|
28 |
|
29 // ======== MEMBER FUNCTIONS ======== |
|
30 |
|
31 CMmPacketContextGsmWcdmaExt* CMmPacketContextGsmWcdmaExt::NewL( |
|
32 CMmPacketContextTsy* const aMmPacketContextTsy, |
|
33 CMmPacketServiceTsy* const aMmPacketServiceTsy ) |
|
34 { |
|
35 TFLOGSTRING( "TSY: CMmPacketContextGsmWcdmaExt::NewL." ); |
|
36 |
|
37 CMmPacketContextGsmWcdmaExt* packetContextGsmWcdmaExt = |
|
38 new ( ELeave ) CMmPacketContextGsmWcdmaExt(); |
|
39 |
|
40 CleanupStack::PushL( packetContextGsmWcdmaExt ); |
|
41 |
|
42 packetContextGsmWcdmaExt->iMmPacketContextTsy = aMmPacketContextTsy; |
|
43 packetContextGsmWcdmaExt->iMmPacketServiceTsy = aMmPacketServiceTsy; |
|
44 packetContextGsmWcdmaExt->ConstructL(); |
|
45 |
|
46 CleanupStack::Pop(); |
|
47 |
|
48 return packetContextGsmWcdmaExt; |
|
49 } |
|
50 |
|
51 CMmPacketContextGsmWcdmaExt::CMmPacketContextGsmWcdmaExt() |
|
52 { |
|
53 } |
|
54 |
|
55 void CMmPacketContextGsmWcdmaExt::ConstructL() |
|
56 { |
|
57 InitInternalAttributesL(); |
|
58 } |
|
59 |
|
60 CMmPacketContextGsmWcdmaExt::~CMmPacketContextGsmWcdmaExt() |
|
61 { |
|
62 TFLOGSTRING( "TSY: CMmPacketContextGsmWcdmaExt::~CMmPacketContextGsmWcdmaExt." ); |
|
63 |
|
64 TInfoName contextName; |
|
65 if( iMmPacketContextTsy ) |
|
66 { |
|
67 contextName = iMmPacketContextTsy->ContextName(); |
|
68 } |
|
69 if ( contextName.Compare( KNullDesC ) != 0 ) |
|
70 { |
|
71 CMmDataPackage data; |
|
72 data.PackData( &contextName ); |
|
73 |
|
74 if( iMmPacketServiceTsy ) |
|
75 { |
|
76 TRAP_IGNORE( iMmPacketServiceTsy->MessageManager()-> |
|
77 HandleRequestL( EPacketContextDelete, &data ) ); |
|
78 } |
|
79 |
|
80 } |
|
81 |
|
82 // Notify status change |
|
83 // This is needed to inform Service that context is no longer active |
|
84 if( iMmPacketContextTsy ) |
|
85 { |
|
86 iMmPacketContextTsy->CompleteNotifyStatusChange( |
|
87 RPacketContext::EStatusDeleted ); |
|
88 } |
|
89 |
|
90 // Release memory used for dynamic data members |
|
91 delete iTempConfig; |
|
92 delete iConfig; |
|
93 delete iFilterArray; |
|
94 delete iFilterTemporaryArray; |
|
95 delete iTempMediaAuthorizationArray; |
|
96 } |
|
97 |
|
98 |
|
99 // --------------------------------------------------------------------------- |
|
100 // CMmPacketContextGsmWcdmaExt::InitInternalAttributesL |
|
101 // Initialises miscellaneous internal attributes. |
|
102 // (other items were commented in a header). |
|
103 // --------------------------------------------------------------------------- |
|
104 // |
|
105 void CMmPacketContextGsmWcdmaExt::InitInternalAttributesL() |
|
106 { |
|
107 // Network initiated context indication. |
|
108 //iContextType = EFalse; |
|
109 |
|
110 iIsActivateAllowed = EFalse; |
|
111 iIsInitialiseAllowed = ETrue; |
|
112 iConnectionSpeed = 0; |
|
113 |
|
114 iTempConfig = NULL; |
|
115 |
|
116 iNotifyConfig = RPacketContext::TContextConfigGPRS(); |
|
117 |
|
118 iFilterArray = new ( ELeave ) CArrayFixFlat |
|
119 <RPacketContext::TPacketFilterV2>( 1 ); |
|
120 |
|
121 iFilterTemporaryArray = NULL; |
|
122 |
|
123 iTempMediaAuthorizationArray = NULL; |
|
124 |
|
125 for ( TInt i = 0 ; KMaxNumberOfTftFilters > i; i++ ) |
|
126 { |
|
127 // cell is set 0xFF because of internal check(s) |
|
128 iFilterIdTemporaryArray[i] = 0xFF; |
|
129 } |
|
130 |
|
131 TInfoName hostCidName = iMmPacketContextTsy->HostCID(); |
|
132 |
|
133 iConfig = new ( ELeave ) RPacketContext::TContextConfigGPRS(); |
|
134 |
|
135 if( 0 < hostCidName.Length() ) |
|
136 { |
|
137 CMmPacketContextTsy* iPrimaryContextObject = iMmPacketServiceTsy-> |
|
138 PacketContextList()->PacketContextByName( &hostCidName ); |
|
139 |
|
140 if ( NULL != iPrimaryContextObject ) |
|
141 { |
|
142 *iConfig = *( iPrimaryContextObject-> |
|
143 PacketContextGsmWcdmaExt()->ContextConfig() ); |
|
144 } |
|
145 } |
|
146 |
|
147 iPrevFilterStatus = EAddPacketFilterStatusUnknown; |
|
148 iFilterStatus = EAddPacketFilterStatusUnknown; |
|
149 isAddMediaAuthorizationCalledFirstTime = EFalse; |
|
150 } |
|
151 |
|
152 // --------------------------------------------------------------------------- |
|
153 // CMmPacketContextGsmWcdmaExt::InitialiseContextL |
|
154 // This function starts context initialisation. |
|
155 // (other items were commented in a header). |
|
156 // --------------------------------------------------------------------------- |
|
157 // |
|
158 TInt CMmPacketContextGsmWcdmaExt::InitialiseContextL(RPacketContext::TDataChannelV2* aDataChannel) |
|
159 { |
|
160 TFLOGSTRING( "TSY: CMmPacketContextGsmWcdmaExt::InitialiseContextL." ); |
|
161 |
|
162 TInt ret( KErrArgument ); |
|
163 |
|
164 if ( iIsInitialiseAllowed ) |
|
165 { |
|
166 TInfoName contextName = iMmPacketContextTsy->ContextName(); |
|
167 TInfoName hostCidName = iMmPacketContextTsy->HostCID(); |
|
168 CMmDataPackage dataPackage; |
|
169 dataPackage.PackData( &contextName, &hostCidName ); |
|
170 |
|
171 iDataChannel = aDataChannel; |
|
172 |
|
173 ret = iMmPacketServiceTsy->MessageManager()->HandleRequestL( |
|
174 EPacketContextInitialiseContext, &dataPackage ); |
|
175 |
|
176 if(ret == KErrNone) |
|
177 { |
|
178 iIsInitialiseAllowed = EFalse; |
|
179 } |
|
180 } |
|
181 return ret; |
|
182 } |
|
183 |
|
184 #ifndef USING_CTSY_DISPATCHER |
|
185 |
|
186 // --------------------------------------------------------------------------- |
|
187 // CMmPacketContextGsmWcdmaExt::CompleteInitialiseContextL |
|
188 // This function starts context initialisation. |
|
189 // (other items were commented in a header). |
|
190 // --------------------------------------------------------------------------- |
|
191 // |
|
192 void CMmPacketContextGsmWcdmaExt::CompleteInitialiseContext(const TInt aResult) // Result |
|
193 { |
|
194 TFLOGSTRING( "TSY: CMmPacketContextGsmWcdmaExt::CompleteInitialiseContext." ); |
|
195 |
|
196 if ( KErrNone == aResult ) |
|
197 { |
|
198 iMmPacketContextTsy->CompleteNotifyStatusChange(RPacketContext::EStatusInactive ); |
|
199 |
|
200 if(iDataChannel != NULL) |
|
201 { |
|
202 iDataChannel->iChannelId.Copy(iMmPacketContextTsy->ContextName()); |
|
203 iDataChannel->iPort.Copy(iMmPacketContextTsy->ContextName()); |
|
204 iDataChannel = NULL; |
|
205 } |
|
206 |
|
207 iIsActivateAllowed = ETrue; |
|
208 // Set Dynamic Caps |
|
209 iMmPacketServiceTsy->ActivePacketServiceExtension()-> |
|
210 SetDynamicCapsFlag( RPacketService::KCapsActivate, ETrue ); |
|
211 } |
|
212 else |
|
213 { |
|
214 iIsInitialiseAllowed = ETrue; |
|
215 } |
|
216 iMmPacketContextTsy->CompleteInitialiseContext( aResult ); |
|
217 |
|
218 } |
|
219 #endif //USING_CTSY_DISPATCHER |
|
220 |
|
221 // --------------------------------------------------------------------------- |
|
222 // CMmPacketContextGsmWcdmaExt::ActivateL |
|
223 // This function starts the context activation. |
|
224 // (other items were commented in a header). |
|
225 // --------------------------------------------------------------------------- |
|
226 // |
|
227 TInt CMmPacketContextGsmWcdmaExt::ActivateL() |
|
228 { |
|
229 TFLOGSTRING( "TSY: CMmPacketContextGsmWcdmaExt::ActivateL " ); |
|
230 |
|
231 TInt ret( KErrArgument ); |
|
232 |
|
233 if ( iIsActivateAllowed ) |
|
234 { |
|
235 |
|
236 TInfoName hostCidRef = iMmPacketContextTsy->HostCID(); |
|
237 TInfoName contextName = iMmPacketContextTsy->ContextName(); |
|
238 // Primary context activation |
|
239 CMmDataPackage data; |
|
240 data.PackData( &contextName ); |
|
241 //This is primary context activation and host context's length is |
|
242 //hence zero |
|
243 if ( 0 == hostCidRef.Length() ) |
|
244 { |
|
245 ret = iMmPacketServiceTsy->MessageManager()->HandleRequestL( |
|
246 EPacketContextActivate, &data ); |
|
247 } |
|
248 // Secondary context activation |
|
249 else |
|
250 { |
|
251 TBool qosExtensionId( EFalse ); |
|
252 CMmPacketQoSTsy* qosProfile = iMmPacketContextTsy->PacketQoSTsy(); |
|
253 |
|
254 if ( NULL != qosProfile ) |
|
255 { |
|
256 qosExtensionId = qosProfile->PacketQoSGsmWcdmaExt()-> |
|
257 ProfileAsked(); |
|
258 } |
|
259 |
|
260 // Check that secondary context have qos and at least one filter |
|
261 if ( qosExtensionId && 0 != iFilterArray->Count() ) |
|
262 { |
|
263 ret = iMmPacketServiceTsy->MessageManager()->HandleRequestL( |
|
264 EPacketContextActivate, &data ); |
|
265 } |
|
266 } |
|
267 |
|
268 if ( KErrNone == ret ) |
|
269 { |
|
270 iIsActivateAllowed = EFalse; |
|
271 } |
|
272 } |
|
273 |
|
274 return ret; |
|
275 } |
|
276 |
|
277 // --------------------------------------------------------------------------- |
|
278 // CMmPacketContextGsmWcdmaExt::CompleteActivate |
|
279 // Completes the activate request. Indicates DOS TSY has started activation. |
|
280 // Activation to network may take minutes. |
|
281 // (other items were commented in a header). |
|
282 // --------------------------------------------------------------------------- |
|
283 // |
|
284 void CMmPacketContextGsmWcdmaExt::CompleteActivate( |
|
285 CMmDataPackage* aDataPackage, |
|
286 TInt aResult ) |
|
287 { |
|
288 TFLOGSTRING2( "TSY: CMmPacketContextGsmWcdmaExt::CompleteActivate. Status: %d", |
|
289 aResult ); |
|
290 |
|
291 if ( KErrNone == aResult ) |
|
292 { |
|
293 //Unpack to TPacketDataConfigBase first, determine the Extension ID and |
|
294 //then cast to the appropriate structure before extracting all the necessary |
|
295 //data |
|
296 TPacketDataConfigBase* config = NULL; |
|
297 //DOS layer brings also name in packet due routing in manager. |
|
298 TInfoName* null; |
|
299 aDataPackage->UnPackData( &null, &config ); |
|
300 null = NULL; |
|
301 |
|
302 RPacketContext::TGSNAddress accessPointName = iConfig->iAccessPointName; |
|
303 |
|
304 if ( TPacketDataConfigBase::KConfigGPRS == config->ExtensionId() ) |
|
305 { |
|
306 iConfig->iPdpType = static_cast<RPacketContext::TContextConfigGPRS*>(config)-> |
|
307 iPdpType; |
|
308 accessPointName = static_cast<RPacketContext::TContextConfigGPRS*>(config)-> |
|
309 iAccessPointName; |
|
310 } |
|
311 |
|
312 if ( TPacketDataConfigBase::KConfigRel99Rel4 == config->ExtensionId() || |
|
313 TPacketDataConfigBase::KConfigRel5 == config->ExtensionId()) |
|
314 { |
|
315 iConfig->iPdpType = static_cast<RPacketContext::TContextConfigR99_R4*>(config)-> |
|
316 iPdpType; |
|
317 accessPointName = static_cast<RPacketContext::TContextConfigR99_R4*>(config)-> |
|
318 iAccessPointName; |
|
319 } |
|
320 |
|
321 TInt temp = accessPointName.Length(); |
|
322 if ( !temp ) |
|
323 { |
|
324 iConfig->iAccessPointName = accessPointName; |
|
325 // Notify config changed |
|
326 } |
|
327 CompleteNotifyConfigChanged(); |
|
328 |
|
329 // Notify status change |
|
330 iMmPacketContextTsy->CompleteNotifyStatusChange( |
|
331 RPacketContext::EStatusActivating ); |
|
332 } |
|
333 else |
|
334 { |
|
335 TFLOGSTRING2( "TSY: CMmPacketContextGsmWcdmaExt::CompleteActivate. ErrorCause: %d", |
|
336 aResult ); |
|
337 // Re-activation is allowed because activation has not succeeded |
|
338 iIsActivateAllowed = ETrue; |
|
339 } |
|
340 |
|
341 // Set Dynamic Caps |
|
342 iMmPacketServiceTsy->ActivePacketServiceExtension()->SetDynamicCapsFlag( |
|
343 RPacketService::KCapsActivate, iIsActivateAllowed ); |
|
344 |
|
345 // Complete Activate |
|
346 iMmPacketContextTsy->CompleteActivate( aResult ); |
|
347 |
|
348 } |
|
349 |
|
350 // --------------------------------------------------------------------------- |
|
351 // CMmPacketContextGsmWcdmaExt::CompleteActivatePhase2L |
|
352 // Final completion for the context activation. Context is activated to |
|
353 // network. |
|
354 // (other items were commented in a header). |
|
355 // --------------------------------------------------------------------------- |
|
356 // |
|
357 void CMmPacketContextGsmWcdmaExt::CompleteActivatePhase2( |
|
358 CMmDataPackage* aDataPackage, const TInt aResult ) |
|
359 { |
|
360 TFLOGSTRING2( "TSY: CMmPacketContextGsmWcdmaExt::CompleteActivatePhase2. Status: %d", aResult ); |
|
361 |
|
362 if ( KErrNone == aResult ) |
|
363 { |
|
364 //Unpack to TPacketDataConfigBase first, determine the Extension ID and |
|
365 //then cast to the appropriate structure before extracting all the necessary |
|
366 //data |
|
367 TPacketDataConfigBase* aConfig = NULL; |
|
368 TInfoName* name = NULL; |
|
369 aDataPackage->UnPackData( &name, &aConfig ); |
|
370 |
|
371 if( NULL != aConfig ) |
|
372 { |
|
373 if ( TPacketDataConfigBase::KConfigGPRS == aConfig->ExtensionId() ) |
|
374 { |
|
375 RPacketContext::TContextConfigGPRS* configGPRS = |
|
376 static_cast<RPacketContext::TContextConfigGPRS*>(aConfig); |
|
377 |
|
378 iConfig->iPdpAddress = configGPRS->iPdpAddress; |
|
379 iConfig->iAccessPointName = configGPRS->iAccessPointName; |
|
380 iConfig->iProtocolConfigOption.iDnsAddresses.iPrimaryDns = configGPRS-> |
|
381 iProtocolConfigOption.iDnsAddresses.iPrimaryDns; |
|
382 iConfig->iProtocolConfigOption.iDnsAddresses.iSecondaryDns = configGPRS-> |
|
383 iProtocolConfigOption.iDnsAddresses.iSecondaryDns; |
|
384 iConfig->iPdpCompression = configGPRS->iPdpCompression; |
|
385 iConfig->iProtocolConfigOption.iMiscBuffer = |
|
386 configGPRS->iProtocolConfigOption.iMiscBuffer; |
|
387 } |
|
388 |
|
389 if ( TPacketDataConfigBase::KConfigRel99Rel4 == aConfig->ExtensionId() || |
|
390 TPacketDataConfigBase::KConfigRel5 == aConfig->ExtensionId()) |
|
391 { |
|
392 RPacketContext::TContextConfigR99_R4* configR99_R4 = |
|
393 static_cast<RPacketContext::TContextConfigR99_R4*>(aConfig); |
|
394 |
|
395 iConfig->iPdpAddress = configR99_R4->iPdpAddress; |
|
396 iConfig->iAccessPointName = configR99_R4->iAccessPointName; |
|
397 iConfig->iProtocolConfigOption.iDnsAddresses.iPrimaryDns = configR99_R4-> |
|
398 iProtocolConfigOption.iDnsAddresses.iPrimaryDns; |
|
399 iConfig->iProtocolConfigOption.iDnsAddresses.iSecondaryDns = configR99_R4-> |
|
400 iProtocolConfigOption.iDnsAddresses.iSecondaryDns; |
|
401 iConfig->iPdpCompression = 0; |
|
402 iConfig->iProtocolConfigOption.iMiscBuffer = |
|
403 configR99_R4->iProtocolConfigOption.iMiscBuffer; |
|
404 } |
|
405 } |
|
406 |
|
407 // Complete notifies |
|
408 CompleteNotifyConfigChanged(); |
|
409 iMmPacketContextTsy->CompleteNotifyStatusChange( |
|
410 RPacketContext::EStatusActive ); |
|
411 } |
|
412 |
|
413 else |
|
414 { |
|
415 // Reactivation is allowed because activation has not succeeded |
|
416 iIsActivateAllowed = ETrue; |
|
417 |
|
418 // Set Dynamics Caps |
|
419 iMmPacketServiceTsy->ActivePacketServiceExtension()-> |
|
420 SetDynamicCapsFlag( RPacketService::KCapsActivate, ETrue ); |
|
421 } |
|
422 } |
|
423 |
|
424 // --------------------------------------------------------------------------- |
|
425 // CMmPacketContextGsmWcdmaExt::Deactivate |
|
426 // This function deactivates the context |
|
427 // (other items were commented in a header). |
|
428 // --------------------------------------------------------------------------- |
|
429 // |
|
430 TInt CMmPacketContextGsmWcdmaExt::DeactivateL() |
|
431 { |
|
432 TFLOGSTRING( "TSY: CMmPacketContextGsmWcdmaExt::DeactivateL." ); |
|
433 |
|
434 TInt ret( KErrArgument ); |
|
435 //zero length |
|
436 TInfoName contextName = iMmPacketContextTsy->ContextName(); |
|
437 if ( contextName.Compare( KNullDesC ) != 0 ) |
|
438 { |
|
439 CMmDataPackage data; |
|
440 data.PackData( &contextName ); |
|
441 ret = iMmPacketServiceTsy->MessageManager()->HandleRequestL( |
|
442 EPacketContextDeactivate, &data ); |
|
443 |
|
444 if ( KErrNone == ret ) |
|
445 { |
|
446 iContextStatusBeforeDeactivation = |
|
447 iMmPacketContextTsy->ContextStatus(); |
|
448 } |
|
449 } |
|
450 return ret; |
|
451 } |
|
452 |
|
453 // --------------------------------------------------------------------------- |
|
454 // CMmPacketContextGsmWcdmaExt::CompleteDeactivateL |
|
455 // Completes the deactivate request. |
|
456 // (other items were commented in a header). |
|
457 // --------------------------------------------------------------------------- |
|
458 // |
|
459 void CMmPacketContextGsmWcdmaExt::CompleteDeactivate( |
|
460 const TInt aResult ) |
|
461 { |
|
462 TFLOGSTRING( "TSY: CMmPacketContextGsmWcdmaExt::CompleteDeactivate." ); |
|
463 |
|
464 if ( KErrNone == aResult ) |
|
465 { |
|
466 |
|
467 // Notify status change |
|
468 iMmPacketContextTsy->CompleteNotifyStatusChange( |
|
469 RPacketContext::EStatusInactive ); |
|
470 } |
|
471 else |
|
472 { |
|
473 // Notify status change |
|
474 iMmPacketContextTsy->CompleteNotifyStatusChange( |
|
475 iContextStatusBeforeDeactivation ); |
|
476 } |
|
477 |
|
478 iMmPacketContextTsy->CompleteDeactivate( aResult ); |
|
479 |
|
480 } |
|
481 |
|
482 // --------------------------------------------------------------------------- |
|
483 // CMmPacketContextGsmWcdmaExt::DeleteL |
|
484 // This function starts deletion. |
|
485 // (other items were commented in a header). |
|
486 // --------------------------------------------------------------------------- |
|
487 // |
|
488 TInt CMmPacketContextGsmWcdmaExt::DeleteL() |
|
489 { |
|
490 TFLOGSTRING( "TSY: CMmPacketContextGsmWcdmaExt::DeleteL." ); |
|
491 |
|
492 TInt ret( KErrNotReady ); |
|
493 |
|
494 if ( RPacketContext::EStatusUnknown != |
|
495 iMmPacketContextTsy->ContextStatus() ) |
|
496 { |
|
497 TInfoName contextName = iMmPacketContextTsy->ContextName(); |
|
498 CMmDataPackage data; |
|
499 data.PackData( &contextName ); |
|
500 |
|
501 ret = iMmPacketServiceTsy->MessageManager()->HandleRequestL( |
|
502 EPacketContextDelete, &data ); |
|
503 |
|
504 } |
|
505 |
|
506 return ret; |
|
507 |
|
508 } |
|
509 |
|
510 // --------------------------------------------------------------------------- |
|
511 // CMmPacketContextGsmWcdmaExt::CompleteDelete |
|
512 // Completes the delete request. |
|
513 // (other items were commented in a header). |
|
514 // --------------------------------------------------------------------------- |
|
515 // |
|
516 void CMmPacketContextGsmWcdmaExt::CompleteDelete( |
|
517 TInt const aResult ) |
|
518 { |
|
519 TFLOGSTRING( "TSY: CMmPacketContextGsmWcdmaExt::CompleteDelete." ); |
|
520 |
|
521 if( KErrNone == aResult ) |
|
522 { |
|
523 iContextStatusBeforeDeactivation = RPacketContext::EStatusDeleted; |
|
524 |
|
525 // Notify status change |
|
526 iMmPacketContextTsy->CompleteNotifyStatusChange( |
|
527 RPacketContext::EStatusDeleted ); |
|
528 |
|
529 |
|
530 if ( !iMmPacketContextTsy->IsDialUpContext( NULL ) ) |
|
531 { |
|
532 // Release memory used for context configuration info |
|
533 delete iConfig; |
|
534 iConfig = NULL; |
|
535 } |
|
536 } |
|
537 |
|
538 iMmPacketContextTsy->CompleteDelete( aResult ); |
|
539 |
|
540 } |
|
541 |
|
542 // --------------------------------------------------------------------------- |
|
543 // CMmPacketContextGsmWcdmaExt::GetConfig |
|
544 // Retrieves the current context configuration to the client. |
|
545 // (other items were commented in a header). |
|
546 // --------------------------------------------------------------------------- |
|
547 // |
|
548 TInt CMmPacketContextGsmWcdmaExt::GetConfig( |
|
549 TPacketDataConfigBase* const aConfig ) |
|
550 { |
|
551 TFLOGSTRING( "TSY: CMmPacketContextGsmWcdmaExt::GetConfig." ); |
|
552 |
|
553 TInt ret( KErrNone ); |
|
554 |
|
555 // Check that the mode given in aConfig is GPRS |
|
556 if ( TPacketDataConfigBase::KConfigGPRS == aConfig->ExtensionId() || |
|
557 TPacketDataConfigBase::KConfigRel99Rel4 == aConfig->ExtensionId() ) |
|
558 { |
|
559 if ( NULL != iConfig && |
|
560 TPacketDataConfigBase::KConfigGPRS == aConfig->ExtensionId() ) |
|
561 { |
|
562 // Set configuration data to ETel side memory |
|
563 *( RPacketContext::TContextConfigGPRS* )aConfig = |
|
564 *iConfig; |
|
565 } |
|
566 else if ( NULL != iConfig && |
|
567 TPacketDataConfigBase::KConfigRel99Rel4 == aConfig->ExtensionId() ) |
|
568 { |
|
569 RPacketContext::TContextConfigR99_R4 configR99_R4; |
|
570 |
|
571 configR99_R4.iPdpType = iConfig->iPdpType; |
|
572 configR99_R4.iAccessPointName = iConfig->iAccessPointName; |
|
573 configR99_R4.iPdpAddress = iConfig->iPdpAddress; |
|
574 configR99_R4.iUseEdge = iConfig->iUseEdge; |
|
575 configR99_R4.iProtocolConfigOption = |
|
576 iConfig->iProtocolConfigOption; |
|
577 // Set configuration data to ETel side memory |
|
578 *( RPacketContext::TContextConfigR99_R4* )aConfig = configR99_R4; |
|
579 |
|
580 } |
|
581 else |
|
582 { |
|
583 ret = KErrNotFound; |
|
584 } |
|
585 } |
|
586 else |
|
587 { |
|
588 // Given mode is not supported |
|
589 ret = KErrNotSupported; |
|
590 } |
|
591 |
|
592 return ret; |
|
593 |
|
594 } |
|
595 |
|
596 // --------------------------------------------------------------------------- |
|
597 // CMmPacketContextGsmWcdmaExt::GetDataVolumeTransferred |
|
598 // Gets details of the current amount of data transmitted and |
|
599 // received over the airlink since the context was activated. |
|
600 // (other items were commented in a header). |
|
601 // --------------------------------------------------------------------------- |
|
602 // |
|
603 TInt CMmPacketContextGsmWcdmaExt::GetDataVolumeTransferredL() |
|
604 { |
|
605 TFLOGSTRING( "TSY: CMmPacketContextGsmWcdmaExt::GetDataVolumeTransferredL." ); |
|
606 |
|
607 TInt ret( KErrNone ); |
|
608 TInfoName contextName = iMmPacketContextTsy->ContextName(); |
|
609 |
|
610 if ( contextName.Compare( KNullDesC ) != 0 ) |
|
611 { |
|
612 CMmDataPackage data; |
|
613 data.PackData( &contextName ); |
|
614 ret = iMmPacketServiceTsy->MessageManager()->HandleRequestL( |
|
615 EPacketContextGetDataVolumeTransferred, &data ); |
|
616 } |
|
617 |
|
618 return ret; |
|
619 |
|
620 } |
|
621 |
|
622 // --------------------------------------------------------------------------- |
|
623 // CMmPacketContextGsmWcdmaExt::CompleteGetDataVolumeTransferred |
|
624 // Completes the get data volume transferred request. |
|
625 // (other items were commented in a header). |
|
626 // --------------------------------------------------------------------------- |
|
627 // |
|
628 void CMmPacketContextGsmWcdmaExt::CompleteGetDataVolumeTransferred( |
|
629 const CMmDataPackage* aDataPackage, |
|
630 const TInt aResult ) |
|
631 { |
|
632 TInt errorValue( KErrNone ); |
|
633 |
|
634 if ( KErrNone == aResult ) |
|
635 { |
|
636 TInfoName contextName; |
|
637 RPacketContext::TDataVolume dataVolume; |
|
638 aDataPackage->UnPackData( contextName, dataVolume ); |
|
639 |
|
640 // Set data volume to the tsy |
|
641 iMmPacketContextTsy->SetDataVolume( KErrNone, dataVolume ); |
|
642 } |
|
643 |
|
644 else |
|
645 { |
|
646 errorValue = KErrGeneral; |
|
647 } |
|
648 TFLOGSTRING2( "TSY: CMmPacketContextGsmWcdmaExt::CompleteGetDataVolumeTransferred. Error Value:%d", |
|
649 errorValue ); |
|
650 |
|
651 iMmPacketContextTsy->CompleteGetDataVolumeTransferred( errorValue ); |
|
652 |
|
653 } |
|
654 |
|
655 // --------------------------------------------------------------------------- |
|
656 // CMmPacketContextGsmWcdmaExt::NotifyConfigChanged |
|
657 // Requests notification when configuration of context changes. |
|
658 // Implements the GSM/WCDMA specific functionality for the notification. |
|
659 // (other items were commented in a header). |
|
660 // --------------------------------------------------------------------------- |
|
661 // |
|
662 TInt CMmPacketContextGsmWcdmaExt::NotifyConfigChanged( |
|
663 TPacketDataConfigBase& aConfig ) |
|
664 { |
|
665 TFLOGSTRING( "TSY: CMmPacketContextGsmWcdmaExt::NotifyConfigChanged." ); |
|
666 |
|
667 TInt ret( KErrNone ); |
|
668 |
|
669 // Check that used mode is GPRS |
|
670 if ( ( TPacketDataConfigBase::KConfigGPRS != aConfig.ExtensionId() ) && |
|
671 ( TPacketDataConfigBase::KConfigRel99Rel4 != aConfig.ExtensionId() ) ) |
|
672 { |
|
673 ret = KErrNotSupported; |
|
674 } |
|
675 |
|
676 return ret; |
|
677 } |
|
678 |
|
679 // --------------------------------------------------------------------------- |
|
680 // CMmPacketContextGsmWcdmaExt::CompleteNotifyConfigChanged |
|
681 // Completes notification when the context configuration changes. |
|
682 // (other items were commented in a header). |
|
683 // --------------------------------------------------------------------------- |
|
684 // |
|
685 void CMmPacketContextGsmWcdmaExt::CompleteNotifyConfigChanged() |
|
686 { |
|
687 TFLOGSTRING( "TSY: CMmPacketContextGsmWcdmaExt::CompleteNotifyConfigChanged." ); |
|
688 |
|
689 if ( NULL != iConfig ) |
|
690 { |
|
691 // Check that the configuration has really changed |
|
692 if ( iNotifyConfig.iPdpType != iConfig->iPdpType || |
|
693 iNotifyConfig.iAccessPointName != |
|
694 iConfig->iAccessPointName || |
|
695 iNotifyConfig.iPdpAddress != iConfig->iPdpAddress || |
|
696 iNotifyConfig.iPdpCompression != |
|
697 iConfig->iPdpCompression || |
|
698 iNotifyConfig.iAnonymousAccessReqd != |
|
699 iConfig->iAnonymousAccessReqd || |
|
700 iNotifyConfig.iUseEdge != iConfig->iUseEdge ) |
|
701 { |
|
702 // Store the configuration |
|
703 iNotifyConfig = *iConfig; |
|
704 |
|
705 // Complete notification |
|
706 iMmPacketContextTsy->CompleteNotifyConfigChanged(); |
|
707 } |
|
708 } |
|
709 } |
|
710 |
|
711 // --------------------------------------------------------------------------- |
|
712 // CMmPacketContextGsmWcdmaExt::SetConfigL |
|
713 // This method starts the Context configuration. |
|
714 // (other items were commented in a header). |
|
715 // --------------------------------------------------------------------------- |
|
716 // |
|
717 TInt CMmPacketContextGsmWcdmaExt::SetConfigL( |
|
718 TPacketDataConfigBase* const aConfig ) |
|
719 { |
|
720 TFLOGSTRING( "TSY: CMmPacketContextGsmWcdmaExt::SetConfigL." ); |
|
721 |
|
722 TInt ret( KErrNotSupported ); |
|
723 |
|
724 TInfoName contextName = iMmPacketContextTsy->ContextName(); |
|
725 if ( contextName.Compare( KNullDesC ) != 0 ) |
|
726 { |
|
727 if ( TPacketDataConfigBase::KConfigGPRS == aConfig->ExtensionId() ) |
|
728 { |
|
729 if( !iIsInitialiseAllowed ) |
|
730 { |
|
731 iContextConfigurationType = |
|
732 TPacketDataConfigBase::KConfigGPRS; |
|
733 |
|
734 RPacketContext::TContextConfigGPRS& configGPRS = |
|
735 *( RPacketContext::TContextConfigGPRS* )aConfig; |
|
736 |
|
737 if ( NULL == iTempConfig ) |
|
738 { |
|
739 // Allocate memory for iTempConfig |
|
740 iTempConfig = |
|
741 new ( ELeave ) RPacketContext::TContextConfigGPRS(); |
|
742 } |
|
743 |
|
744 // Temporary store the configGPRS |
|
745 *iTempConfig = configGPRS; |
|
746 |
|
747 TFLOGSTRING2( "TSY: CMmPacketContextGsmWcdmaExt::SetConfigL. NWIContext: %d", configGPRS.iNWIContext ); |
|
748 |
|
749 TInfoName contextName = iMmPacketContextTsy->ContextName(); |
|
750 CMmDataPackage data; |
|
751 data.PackData( &( *aConfig ), &contextName ); |
|
752 |
|
753 ret = iMmPacketServiceTsy->MessageManager()->HandleRequestL( |
|
754 EPacketContextSetConfig, &data ); |
|
755 |
|
756 if ( KErrNone != ret ) |
|
757 { |
|
758 // Release the memory allocated for iTempConfig |
|
759 delete iTempConfig; |
|
760 iTempConfig = NULL; |
|
761 } |
|
762 } |
|
763 else |
|
764 { |
|
765 ret = KErrNotReady; |
|
766 } |
|
767 |
|
768 } |
|
769 else if ( TPacketDataConfigBase::KConfigRel99Rel4 == |
|
770 aConfig->ExtensionId() || |
|
771 TPacketDataConfigBase::KConfigRel5 == aConfig->ExtensionId() ) |
|
772 { |
|
773 if( !iIsInitialiseAllowed ) |
|
774 { |
|
775 iContextConfigurationType = |
|
776 TPacketDataConfigBase::KConfigRel99Rel4; |
|
777 RPacketContext::TContextConfigR99_R4& configR99_R4 = |
|
778 *( RPacketContext::TContextConfigR99_R4* )aConfig; |
|
779 |
|
780 if ( NULL == iTempConfig ) |
|
781 { |
|
782 // Allocate memory for iTempConfig |
|
783 iTempConfig = |
|
784 new ( ELeave ) RPacketContext::TContextConfigGPRS(); |
|
785 } |
|
786 |
|
787 // Temporary store the configR99_R4 to iTempConfig |
|
788 iTempConfig->iPdpType = configR99_R4.iPdpType; |
|
789 iTempConfig->iAccessPointName = configR99_R4.iAccessPointName; |
|
790 iTempConfig->iPdpAddress = configR99_R4.iPdpAddress; |
|
791 iTempConfig->iUseEdge = configR99_R4.iUseEdge; |
|
792 iTempConfig->iProtocolConfigOption = |
|
793 configR99_R4.iProtocolConfigOption; |
|
794 |
|
795 TInt len = |
|
796 iTempConfig->iProtocolConfigOption.iMiscBuffer.Length(); |
|
797 |
|
798 |
|
799 TInfoName contextName = iMmPacketContextTsy->ContextName(); |
|
800 CMmDataPackage data; |
|
801 data.PackData( &( *aConfig ), &contextName ); |
|
802 ret = iMmPacketServiceTsy->MessageManager()->HandleRequestL( |
|
803 EPacketContextSetConfig, &data ); |
|
804 |
|
805 if ( KErrNone != ret ) |
|
806 { |
|
807 // Release the memory allocated for iTempConfig |
|
808 delete iTempConfig; |
|
809 iTempConfig = NULL; |
|
810 } |
|
811 } |
|
812 else |
|
813 { |
|
814 ret = KErrNotReady; |
|
815 } |
|
816 } |
|
817 } |
|
818 return ret; |
|
819 } |
|
820 |
|
821 // --------------------------------------------------------------------------- |
|
822 // CMmPacketContextGsmWcdmaExt::CompleteSetConfig |
|
823 // Completes the SetConfig request. |
|
824 // (other items were commented in a header). |
|
825 // --------------------------------------------------------------------------- |
|
826 // |
|
827 void CMmPacketContextGsmWcdmaExt::CompleteSetConfig( |
|
828 const TInt aResult ) |
|
829 { |
|
830 TFLOGSTRING2( "TSY: CMmPacketContextGsmWcdmaExt::CompleteSetConfig. aStatus:%d", |
|
831 aResult ); |
|
832 |
|
833 |
|
834 if ( NULL != iTempConfig ) |
|
835 { |
|
836 iConfig->iProtocolConfigOption.iMiscBuffer.Zero(); |
|
837 iConfig->iProtocolConfigOption.iMiscBuffer.FillZ(); |
|
838 |
|
839 *iConfig = *iTempConfig; |
|
840 TInt len = iConfig->iProtocolConfigOption.iMiscBuffer.Length(); |
|
841 // Release the memory allocated for iTempConfig |
|
842 delete iTempConfig; |
|
843 iTempConfig = NULL; |
|
844 CompleteNotifyConfigChanged(); |
|
845 } |
|
846 if( isAddMediaAuthorizationCalledFirstTime ) |
|
847 { |
|
848 iMmPacketContextTsy->CompleteSetConfig( aResult, |
|
849 isAddMediaAuthorizationCalledFirstTime ); |
|
850 //Null changed params |
|
851 isAddMediaAuthorizationCalledFirstTime = EFalse; |
|
852 |
|
853 } |
|
854 else |
|
855 { |
|
856 iMmPacketContextTsy->CompleteSetConfig( aResult ) ; |
|
857 } |
|
858 |
|
859 |
|
860 } |
|
861 |
|
862 |
|
863 // --------------------------------------------------------------------------- |
|
864 // CMmPacketContextGsmWcdmaExt::IsContextActivationAllowed |
|
865 // Tells if context activation is allowed. |
|
866 // (other items were commented in a header). |
|
867 // --------------------------------------------------------------------------- |
|
868 // |
|
869 TBool CMmPacketContextGsmWcdmaExt::IsContextActivationAllowed() const |
|
870 { |
|
871 |
|
872 return iIsActivateAllowed; |
|
873 |
|
874 } |
|
875 |
|
876 // --------------------------------------------------------------------------- |
|
877 // CMmPacketContextGsmWcdmaExt::GetConfigurationData |
|
878 // Return the configuration data. |
|
879 // (other items were commented in a header). |
|
880 // --------------------------------------------------------------------------- |
|
881 // |
|
882 TInt CMmPacketContextGsmWcdmaExt::GetConfigurationData( |
|
883 TInfoName& aContextName, |
|
884 RPacketContext::TProtocolType& aPdpType, |
|
885 TBool& aContextType, |
|
886 TInfoName& aPrimaryContextName ) |
|
887 { |
|
888 TFLOGSTRING( "TSY: CMmPacketContextGsmWcdmaExt::GetConfigurationData." ); |
|
889 |
|
890 TInt ret( KErrNotReady ); |
|
891 |
|
892 TInfoName contextName = iMmPacketContextTsy->ContextName(); |
|
893 if ( contextName.Compare( KNullDesC ) != 0 ) |
|
894 { |
|
895 |
|
896 aPdpType = iConfig->iPdpType; |
|
897 aContextName = contextName; |
|
898 aContextType = iConfig->iNWIContext; //iContextType; |
|
899 aPrimaryContextName = iMmPacketContextTsy->HostCID(); |
|
900 ret = KErrNone; |
|
901 } |
|
902 |
|
903 return ret; |
|
904 } |
|
905 |
|
906 // --------------------------------------------------------------------------- |
|
907 // CMmPacketContextGsmWcdmaExt::AddPacketFilterL |
|
908 // Add or modify existing packet filter to specified context |
|
909 // (other items were commented in a header). |
|
910 // --------------------------------------------------------------------------- |
|
911 // |
|
912 TInt CMmPacketContextGsmWcdmaExt::AddPacketFilterL( |
|
913 TDes8* aPacketFilter ) |
|
914 { |
|
915 TInt ret( KErrGeneral ); |
|
916 |
|
917 RPacketContext::TPacketFilterV2Pckg* contextFilterPckg = |
|
918 ( RPacketContext::TPacketFilterV2Pckg* ) aPacketFilter; |
|
919 |
|
920 RPacketContext::TPacketFilterV2& contextFilter = |
|
921 ( *contextFilterPckg )(); |
|
922 |
|
923 TFLOGSTRING2( "TSY: CMmPacketContextGsmWcdmaExt::AddPacketFilterL contextFilterId: %d", contextFilter.iId ); |
|
924 |
|
925 // Check out Tft operation |
|
926 iFilterStatus = EAddPacketFilterStatusAdd; |
|
927 for ( TInt i = 0 ; i < iFilterArray->Count() ; i++ ) |
|
928 { |
|
929 if ( contextFilter.iId == iFilterArray->At( i ).iId ) |
|
930 { |
|
931 iFilterStatus = EAddPacketFilterStatusModify; |
|
932 i = iFilterArray->Count(); |
|
933 } |
|
934 } |
|
935 |
|
936 if ( iPrevFilterStatus == iFilterStatus || |
|
937 EAddPacketFilterStatusUnknown == iPrevFilterStatus ) |
|
938 { |
|
939 // context modification if context status is active or activating |
|
940 if( iMmPacketContextTsy->ContextStatus() == |
|
941 RPacketContext::EStatusActive || |
|
942 iMmPacketContextTsy->ContextStatus() == |
|
943 RPacketContext::EStatusActivating ) |
|
944 { |
|
945 |
|
946 if ( 0 < contextFilter.iId && 8 >= contextFilter.iId ) |
|
947 { |
|
948 // if it's first time to use iFilterTemporaryArray |
|
949 if ( NULL == iFilterTemporaryArray ) |
|
950 { |
|
951 // Eight is max number of TFT filters. If count is less |
|
952 // than eight, we can be sure that there is enough space |
|
953 // for one more filter |
|
954 if ( 8 > iFilterArray->Count() ) |
|
955 { |
|
956 iFilterTemporaryArray = new ( ELeave ) CArrayFixFlat |
|
957 <RPacketContext::TPacketFilterV2>( 1 ); |
|
958 iFilterTemporaryArray->AppendL( contextFilter ); |
|
959 iPrevFilterStatus = iFilterStatus; |
|
960 ret = KErrNone; |
|
961 } |
|
962 } |
|
963 |
|
964 // if iFilterTemporaryArray is already used at least once |
|
965 else |
|
966 { |
|
967 // if previous filter operation was add |
|
968 if ( EAddPacketFilterStatusAdd == iPrevFilterStatus ) |
|
969 { |
|
970 // Eight is max number of TFT filters. If count is |
|
971 // less than eight, we can be sure that there is |
|
972 // enough space for one more filter |
|
973 if ( 8 > ( iFilterArray->Count() + |
|
974 iFilterTemporaryArray->Count() ) ) |
|
975 { |
|
976 // Check that same filter id doesn't appear twice |
|
977 TBool isNewFilter( ETrue ); |
|
978 for ( TInt i = 0; |
|
979 iFilterTemporaryArray->Count() > i; i++ ) |
|
980 { |
|
981 if ( ( iFilterTemporaryArray->At( i ).iId ) == |
|
982 ( contextFilter.iId ) ) |
|
983 { |
|
984 isNewFilter = EFalse; |
|
985 i = iFilterTemporaryArray->Count(); |
|
986 } |
|
987 } |
|
988 |
|
989 // if id doesn't exist already add filter to Array |
|
990 if ( isNewFilter ) |
|
991 { |
|
992 iFilterTemporaryArray-> |
|
993 AppendL ( contextFilter ); |
|
994 iPrevFilterStatus = iFilterStatus; |
|
995 ret = KErrNone; |
|
996 } |
|
997 } |
|
998 } |
|
999 |
|
1000 // if previous filter operation was modify |
|
1001 if ( EAddPacketFilterStatusModify == iPrevFilterStatus ) |
|
1002 { |
|
1003 // Check that same filter id doesn't appear twice |
|
1004 TBool isNewFilter( ETrue ); |
|
1005 for ( TInt i = 0; iFilterTemporaryArray->Count() > i; |
|
1006 i++ ) |
|
1007 { |
|
1008 if ( ( iFilterTemporaryArray->At( i ).iId ) == |
|
1009 ( contextFilter.iId ) ) |
|
1010 { |
|
1011 isNewFilter = EFalse; |
|
1012 i = iFilterTemporaryArray->Count(); |
|
1013 } |
|
1014 } |
|
1015 |
|
1016 // if id doesn't exist already add filter to Array |
|
1017 if ( isNewFilter ) |
|
1018 { |
|
1019 iFilterTemporaryArray->AppendL ( contextFilter ); |
|
1020 iPrevFilterStatus = iFilterStatus; |
|
1021 ret = KErrNone; |
|
1022 } |
|
1023 } |
|
1024 } |
|
1025 } |
|
1026 } |
|
1027 } |
|
1028 // context configuration if context status is unknown or inactive |
|
1029 if ( iMmPacketContextTsy->ContextStatus() == |
|
1030 RPacketContext::EStatusUnknown || |
|
1031 iMmPacketContextTsy->ContextStatus() == |
|
1032 RPacketContext::EStatusInactive ) |
|
1033 { |
|
1034 // Eight is max number of TFT filters. If count is less than eight, |
|
1035 // we can be sure that there is enough space for one more filter |
|
1036 if ( iFilterArray->Count() < 8 && |
|
1037 EAddPacketFilterStatusAdd == iFilterStatus ) |
|
1038 { |
|
1039 // if filter id is allowed value. Allowed value is between 1..8 |
|
1040 if ( 0 < contextFilter.iId && 8 >= contextFilter.iId ) |
|
1041 { |
|
1042 |
|
1043 TBool filterIdAlreadyInArray( EFalse ); |
|
1044 |
|
1045 |
|
1046 if ( NULL == iFilterTemporaryArray ) |
|
1047 { |
|
1048 iFilterTemporaryArray = new ( ELeave ) CArrayFixFlat |
|
1049 <RPacketContext::TPacketFilterV2>( 1 ); |
|
1050 } |
|
1051 |
|
1052 |
|
1053 // if pdp type is Ipv4 8 is max number of TFT |
|
1054 // filters. If count is less than eight, we can be sure |
|
1055 // that there is enough space for one more filter |
|
1056 // if pdp type is Ipv6 4 is max number of TFT |
|
1057 // filters. If count is less than four, we can be sure |
|
1058 // that there is enough space for one more filter |
|
1059 if ( ( 8 > iFilterArray->Count() && |
|
1060 RPacketContext::EPdpTypeIPv4 == iConfig->iPdpType ) || |
|
1061 ( 4 > iFilterArray->Count() && |
|
1062 RPacketContext::EPdpTypeIPv6 == iConfig->iPdpType ) |
|
1063 ) |
|
1064 { |
|
1065 for ( TInt i = 0 ; iFilterArray->Count() > i ; i++ ) |
|
1066 { |
|
1067 if ( contextFilter.iId != |
|
1068 iFilterArray->At(i).iId ) |
|
1069 { |
|
1070 iFilterTemporaryArray->AppendL( |
|
1071 iFilterArray->At(i) ); |
|
1072 } |
|
1073 |
|
1074 else |
|
1075 { |
|
1076 filterIdAlreadyInArray = ETrue; |
|
1077 } |
|
1078 } |
|
1079 |
|
1080 iFilterTemporaryArray->AppendL( contextFilter ); |
|
1081 |
|
1082 TInfoName contextName = |
|
1083 iMmPacketContextTsy->ContextName(); |
|
1084 CMmPacketDataPackage data; |
|
1085 data.SetConfig( iConfig , |
|
1086 iContextConfigurationType ); |
|
1087 data.PackData( &contextName, iFilterTemporaryArray ); |
|
1088 |
|
1089 ret = iMmPacketServiceTsy->MessageManager()-> |
|
1090 HandleRequestL( EPacketContextAddPacketFilter, |
|
1091 &data ); |
|
1092 |
|
1093 } |
|
1094 |
|
1095 else |
|
1096 { |
|
1097 ret = KErrArgument; |
|
1098 } |
|
1099 |
|
1100 // add configured filter to iFilterArray |
|
1101 if ( KErrNone == ret ) |
|
1102 { |
|
1103 if ( !filterIdAlreadyInArray ) |
|
1104 { |
|
1105 iFilterArray->AppendL( contextFilter ); |
|
1106 } |
|
1107 else |
|
1108 { |
|
1109 for ( TInt i = 0 ; iFilterArray->Count() > i ; i++ ) |
|
1110 { |
|
1111 if ( iFilterArray->At(i).iId == |
|
1112 contextFilter.iId ) |
|
1113 { |
|
1114 iFilterArray->At(i) = contextFilter; |
|
1115 } |
|
1116 } |
|
1117 } |
|
1118 |
|
1119 delete iFilterTemporaryArray; |
|
1120 iFilterTemporaryArray = NULL; |
|
1121 } |
|
1122 } |
|
1123 } |
|
1124 } |
|
1125 |
|
1126 // if error occures empty iFilterTemporaryArray |
|
1127 if ( ( KErrNone != ret ) && ( NULL != iFilterTemporaryArray ) ) |
|
1128 { |
|
1129 delete iFilterTemporaryArray; |
|
1130 iFilterTemporaryArray = NULL; |
|
1131 } |
|
1132 |
|
1133 return ret; |
|
1134 } |
|
1135 |
|
1136 // --------------------------------------------------------------------------- |
|
1137 // CMmPacketContextGsmWcdmaExt::RemovePacketFilter |
|
1138 // This method stores Id(s) client wants to remove |
|
1139 // (other items were commented in a header). |
|
1140 // --------------------------------------------------------------------------- |
|
1141 // |
|
1142 TInt CMmPacketContextGsmWcdmaExt::RemovePacketFilter( |
|
1143 const TInt aID ) |
|
1144 { |
|
1145 TFLOGSTRING2( "TSY: CMmPacketContextGsmWcdmaExt::RemovePacketFilter. FilterId:%d", aID ); |
|
1146 |
|
1147 TInt ret( KErrArgument ); |
|
1148 |
|
1149 if ( EAddPacketFilterStatusUnknown == iPrevFilterStatus || |
|
1150 EAddPacketFilterStatusRemove == iPrevFilterStatus ) |
|
1151 { |
|
1152 |
|
1153 // check that aID is in iFilterArray |
|
1154 TBool isRemoveFilterId( EFalse ); |
|
1155 TInt index = 0; |
|
1156 for ( TInt i = 0 ; iFilterArray->Count() > i ; i++ ) |
|
1157 { |
|
1158 if ( iFilterArray->At( i ).iId == aID ) |
|
1159 { |
|
1160 isRemoveFilterId = ETrue; |
|
1161 index = i; |
|
1162 i = iFilterArray->Count(); |
|
1163 } |
|
1164 } |
|
1165 |
|
1166 if ( isRemoveFilterId ) |
|
1167 { |
|
1168 // Find empty place for filter id and set filter id in it |
|
1169 for ( TInt i = 0 ; KMaxNumberOfTftFilters > i ; i++ ) |
|
1170 { |
|
1171 if ( aID == iFilterIdTemporaryArray[i] ) |
|
1172 { |
|
1173 // breaks if id already in array |
|
1174 i = KMaxNumberOfTftFilters; |
|
1175 } |
|
1176 |
|
1177 // 0xFF value is set default to empty cell |
|
1178 else if ( 0xFF == iFilterIdTemporaryArray[i] ) |
|
1179 { |
|
1180 iFilterIdTemporaryArray[i] = aID; |
|
1181 iFilterArray->Delete(index); |
|
1182 |
|
1183 // breaks when empty cell found in array |
|
1184 i = KMaxNumberOfTftFilters; |
|
1185 iPrevFilterStatus = EAddPacketFilterStatusRemove; |
|
1186 ret = KErrNone; |
|
1187 } |
|
1188 } |
|
1189 } |
|
1190 } |
|
1191 |
|
1192 #ifdef USING_CTSY_DISPATCHER |
|
1193 TInfoName contextName = iMmPacketContextTsy->ContextName(); |
|
1194 CMmPacketDataPackage data; |
|
1195 data.PackData( &contextName, const_cast< TInt* >(&aID)); |
|
1196 ret = iMmPacketServiceTsy->MessageManager()-> HandleRequestL( EPacketContextRemovePacketFilter, &data ); |
|
1197 #endif |
|
1198 |
|
1199 if ( KErrNone != ret ) |
|
1200 { |
|
1201 for ( TInt i = 0 ; KMaxNumberOfTftFilters > i ; i++ ) |
|
1202 { |
|
1203 // cell is set 0xFF because of internal check(s) |
|
1204 iFilterIdTemporaryArray[i] = 0xFF; |
|
1205 iPrevFilterStatus = EAddPacketFilterStatusUnknown; |
|
1206 } |
|
1207 } |
|
1208 |
|
1209 return ret; |
|
1210 } |
|
1211 |
|
1212 // --------------------------------------------------------------------------- |
|
1213 // CMmPacketContextGsmWcdmaExt::ModifyActiveContextL |
|
1214 // Method sends modification of an active context to the network. |
|
1215 // (other items were commented in a header). |
|
1216 // --------------------------------------------------------------------------- |
|
1217 // |
|
1218 TInt CMmPacketContextGsmWcdmaExt::ModifyActiveContextL() |
|
1219 { |
|
1220 TFLOGSTRING( "TSY: CMmPacketContextGsmWcdmaExt::ModifyActiveContextL." ); |
|
1221 |
|
1222 TInt ret( KErrArgument ); |
|
1223 |
|
1224 TPacketFilterFilterOperation tftOperation( EDeletePacketFilters ); |
|
1225 |
|
1226 // Get pointer to QosProfile |
|
1227 CMmPacketQoSTsy* qosProfile = iMmPacketContextTsy->PacketQoSTsy(); |
|
1228 RPacketQoS::TQoSGPRSRequested* qosProfile97 = NULL; |
|
1229 RPacketQoS::TQoSR99_R4Requested* qosProfile99 = NULL; |
|
1230 |
|
1231 RPacketQoS::TQoSR5Requested* qosProfileR5 = NULL; |
|
1232 |
|
1233 if ( NULL != qosProfile ) |
|
1234 { |
|
1235 CMmPacketQoSGsmWcdmaExt* pointerToExt = qosProfile-> |
|
1236 PacketQoSGsmWcdmaExt(); |
|
1237 |
|
1238 if ( NULL != pointerToExt ) |
|
1239 { |
|
1240 // Get pointer to qos |
|
1241 TInt configurationType = pointerToExt->ConfigurationType(); |
|
1242 |
|
1243 |
|
1244 switch( configurationType ) |
|
1245 { |
|
1246 case TPacketDataConfigBase::KConfigGPRS: |
|
1247 qosProfile97 = pointerToExt->Requested97(); |
|
1248 break; |
|
1249 case TPacketDataConfigBase::KConfigRel99Rel4: |
|
1250 qosProfile99 = pointerToExt->Requested99(); |
|
1251 break; |
|
1252 case TPacketDataConfigBase::KConfigRel5: |
|
1253 qosProfileR5 = pointerToExt->RequestedR5(); |
|
1254 break; |
|
1255 default: |
|
1256 break; |
|
1257 } |
|
1258 |
|
1259 // If qos includes something |
|
1260 if ( NULL != qosProfile97 || NULL != qosProfile99 |
|
1261 || NULL != qosProfileR5 ) |
|
1262 { |
|
1263 // use 0xFF and index 0 to check if no filter(s) to remove |
|
1264 if ( NULL == iFilterTemporaryArray && |
|
1265 0xFF == iFilterIdTemporaryArray[0] ) |
|
1266 { |
|
1267 //MODIFY QOS PARAMETERS |
|
1268 //Pack configuration and send to messagemanager |
|
1269 TInfoName contextName = iMmPacketContextTsy->ContextName(); |
|
1270 iContextConfiguration.iContextName = contextName; |
|
1271 iContextConfiguration.iQosParams97 = qosProfile97; |
|
1272 iContextConfiguration.iQosParams99 = qosProfile99; |
|
1273 iContextConfiguration.iQosParamsR5 = qosProfileR5; |
|
1274 iContextConfiguration.iConfiguration = iConfig->iPdpType; |
|
1275 iContextConfiguration.iTftFilterArray = iFilterArray; |
|
1276 iContextConfiguration.iTftOperation = tftOperation; |
|
1277 for( TInt i=0; i < KMaxNumberOfTftFilters; i++ ) |
|
1278 { |
|
1279 iContextConfiguration.iFilterIdArray[i] = |
|
1280 iFilterIdTemporaryArray[i]; |
|
1281 } |
|
1282 |
|
1283 CMmDataPackage data; |
|
1284 data.PackData( &iContextConfiguration, |
|
1285 &iTempMediaAuthorizationArray ); |
|
1286 |
|
1287 ret = iMmPacketServiceTsy->MessageManager()-> |
|
1288 HandleRequestL( EPacketContextModifyActiveContext, |
|
1289 &data ); |
|
1290 |
|
1291 } |
|
1292 } |
|
1293 } |
|
1294 } |
|
1295 |
|
1296 // Add or Modify Filters |
|
1297 if( NULL != iFilterTemporaryArray ) |
|
1298 { |
|
1299 if ( 0 < iFilterTemporaryArray->Count() ) |
|
1300 { |
|
1301 // filteroperation is add |
|
1302 if ( EAddPacketFilterStatusAdd == iPrevFilterStatus ) |
|
1303 { |
|
1304 tftOperation = EAddPacketFilters; |
|
1305 TInt beforeFilterCount = iFilterArray->Count(); |
|
1306 TInt filterArrayExpandedSize = ( beforeFilterCount + |
|
1307 ( iFilterTemporaryArray->Count() ) ); |
|
1308 |
|
1309 iFilterArray->ResizeL( filterArrayExpandedSize ); |
|
1310 |
|
1311 for ( ; filterArrayExpandedSize > beforeFilterCount ; |
|
1312 beforeFilterCount++ ) |
|
1313 { |
|
1314 // iId is set 0xFF because of internal check(s) |
|
1315 iFilterArray->At( beforeFilterCount ).iId = 0xFF; |
|
1316 } |
|
1317 } |
|
1318 |
|
1319 // filteroperation is modify |
|
1320 if ( EAddPacketFilterStatusModify == iPrevFilterStatus ) |
|
1321 { |
|
1322 tftOperation = EReplacePacketFilters; |
|
1323 } |
|
1324 |
|
1325 if ( EAddPacketFilterStatusUnknown != iPrevFilterStatus ) |
|
1326 { |
|
1327 |
|
1328 CMmPacketQoSGsmWcdmaExt* pointerToExt = NULL; |
|
1329 if(qosProfile) |
|
1330 { |
|
1331 pointerToExt = qosProfile->PacketQoSGsmWcdmaExt(); |
|
1332 } |
|
1333 |
|
1334 if ( NULL != pointerToExt ) |
|
1335 { |
|
1336 TInt configurationType = pointerToExt->ConfigurationType(); |
|
1337 |
|
1338 switch( configurationType ) |
|
1339 { |
|
1340 case TPacketDataConfigBase::KConfigGPRS: |
|
1341 qosProfile97 = pointerToExt->Requested97(); |
|
1342 break; |
|
1343 case TPacketDataConfigBase::KConfigRel99Rel4: |
|
1344 qosProfile99 = pointerToExt->Requested99(); |
|
1345 break; |
|
1346 case TPacketDataConfigBase::KConfigRel5: |
|
1347 qosProfileR5 = pointerToExt->RequestedR5(); |
|
1348 break; |
|
1349 default: |
|
1350 break; |
|
1351 } |
|
1352 |
|
1353 //Pack configuration and send to messagemanager |
|
1354 TInfoName contextName = iMmPacketContextTsy->ContextName(); |
|
1355 iContextConfiguration.iContextName = contextName; |
|
1356 iContextConfiguration.iQosParams97 = qosProfile97; |
|
1357 iContextConfiguration.iQosParams99 = qosProfile99; |
|
1358 iContextConfiguration.iQosParamsR5 = qosProfileR5; |
|
1359 iContextConfiguration.iConfiguration = iConfig->iPdpType; |
|
1360 iContextConfiguration.iTftFilterArray = iFilterTemporaryArray; |
|
1361 iContextConfiguration.iTftOperation = tftOperation; |
|
1362 |
|
1363 for( TInt i=0; i < KMaxNumberOfTftFilters; i++ ) |
|
1364 { |
|
1365 iContextConfiguration.iFilterIdArray[i] = |
|
1366 iFilterIdTemporaryArray[i]; |
|
1367 } |
|
1368 |
|
1369 CMmDataPackage data; |
|
1370 data.PackData( &iContextConfiguration, &iTempMediaAuthorizationArray ); |
|
1371 |
|
1372 ret = iMmPacketServiceTsy->MessageManager()-> |
|
1373 HandleRequestL( EPacketContextModifyActiveContext, |
|
1374 &data ); |
|
1375 } |
|
1376 } |
|
1377 } |
|
1378 } |
|
1379 |
|
1380 // Check if first cell includes id |
|
1381 if ( 0xFF != iFilterIdTemporaryArray[0] ) |
|
1382 { |
|
1383 |
|
1384 CMmPacketQoSGsmWcdmaExt* pointerToExt = NULL; |
|
1385 if(qosProfile) |
|
1386 { |
|
1387 pointerToExt = qosProfile->PacketQoSGsmWcdmaExt(); |
|
1388 } |
|
1389 |
|
1390 if( NULL != pointerToExt ) |
|
1391 { |
|
1392 TInt configurationType = pointerToExt->ConfigurationType(); |
|
1393 switch( configurationType ) |
|
1394 { |
|
1395 case TPacketDataConfigBase::KConfigGPRS: |
|
1396 qosProfile97 = pointerToExt->Requested97(); |
|
1397 break; |
|
1398 case TPacketDataConfigBase::KConfigRel99Rel4: |
|
1399 qosProfile99 = pointerToExt->Requested99(); |
|
1400 break; |
|
1401 case TPacketDataConfigBase::KConfigRel5: |
|
1402 qosProfileR5 = pointerToExt->RequestedR5(); |
|
1403 break; |
|
1404 default: |
|
1405 break; |
|
1406 } |
|
1407 |
|
1408 //Pack configuration and send to messagemanager |
|
1409 TInfoName contextName = iMmPacketContextTsy->ContextName(); |
|
1410 iContextConfiguration.iContextName = contextName; |
|
1411 iContextConfiguration.iQosParams97 = qosProfile97; |
|
1412 iContextConfiguration.iQosParams99 = qosProfile99; |
|
1413 iContextConfiguration.iQosParamsR5 = qosProfileR5; |
|
1414 iContextConfiguration.iConfiguration = iConfig->iPdpType; |
|
1415 iContextConfiguration.iTftFilterArray = iFilterTemporaryArray; |
|
1416 iContextConfiguration.iTftOperation = tftOperation; |
|
1417 |
|
1418 for(TInt i=0; i < KMaxNumberOfTftFilters; i++ ) |
|
1419 { |
|
1420 iContextConfiguration.iFilterIdArray[i] = |
|
1421 iFilterIdTemporaryArray[i]; |
|
1422 } |
|
1423 |
|
1424 CMmDataPackage data; |
|
1425 data.PackData( &iContextConfiguration, |
|
1426 &iTempMediaAuthorizationArray ); |
|
1427 ret = iMmPacketServiceTsy->MessageManager()->HandleRequestL( |
|
1428 EPacketContextModifyActiveContext, &data ); |
|
1429 } |
|
1430 |
|
1431 } |
|
1432 |
|
1433 return ret; |
|
1434 |
|
1435 } |
|
1436 |
|
1437 // --------------------------------------------------------------------------- |
|
1438 // CMmPacketContextGsmWcdmaExt::CompleteModifyActiveContext |
|
1439 // When modification is done completes to client |
|
1440 // (other items were commented in a header). |
|
1441 // --------------------------------------------------------------------------- |
|
1442 // |
|
1443 void CMmPacketContextGsmWcdmaExt::CompleteModifyActiveContext( |
|
1444 CMmDataPackage* aDataPackage, const TInt aResult ) |
|
1445 { |
|
1446 //Unpack data |
|
1447 TBuf8<1> rejectioncode; |
|
1448 rejectioncode.Zero(); |
|
1449 TInfoName contextName; |
|
1450 aDataPackage->UnPackData( contextName, rejectioncode ); |
|
1451 |
|
1452 |
|
1453 //check result |
|
1454 if ( KErrNone == aResult ) |
|
1455 { |
|
1456 if ( NULL != iFilterTemporaryArray ) |
|
1457 { |
|
1458 if ( EAddPacketFilterStatusAdd == iFilterStatus ) |
|
1459 { |
|
1460 TInt temporaryFilterArrayCount ( 0 ); |
|
1461 for ( TInt i = 0 ; i < iFilterArray->Count() ; i++ ) |
|
1462 { |
|
1463 if ( 0xFF == iFilterArray->At( i ).iId ) |
|
1464 { |
|
1465 iFilterArray->At( i ) = iFilterTemporaryArray-> |
|
1466 At( temporaryFilterArrayCount++ ); |
|
1467 } |
|
1468 } |
|
1469 |
|
1470 delete iFilterTemporaryArray; |
|
1471 iFilterTemporaryArray = NULL; |
|
1472 |
|
1473 } |
|
1474 |
|
1475 else if ( EAddPacketFilterStatusModify == iFilterStatus ) |
|
1476 { |
|
1477 for ( TInt k = 0 ; k < iFilterTemporaryArray->Count() ; k++ ) |
|
1478 { |
|
1479 for ( TInt g = 0 ; g < iFilterArray->Count() ; g++ ) |
|
1480 { |
|
1481 if ( iFilterTemporaryArray->At( k ).iId == |
|
1482 iFilterArray->At( g ).iId ) |
|
1483 { |
|
1484 iFilterArray->At( g ) = |
|
1485 iFilterTemporaryArray->At( k ); |
|
1486 g = iFilterArray->Count(); |
|
1487 } |
|
1488 } |
|
1489 } |
|
1490 |
|
1491 delete iFilterTemporaryArray; |
|
1492 iFilterTemporaryArray = NULL; |
|
1493 } |
|
1494 } |
|
1495 |
|
1496 else if ( 0xFF != iFilterIdTemporaryArray[0] ) |
|
1497 { |
|
1498 for ( TInt g = 0 ; g < KMaxNumberOfTftFilters ; g++ ) |
|
1499 { |
|
1500 for ( TInt i = 0;i < iFilterArray->Count(); i++ ) |
|
1501 { |
|
1502 if( iFilterArray->At( i ).iId == |
|
1503 iFilterIdTemporaryArray[g] ) |
|
1504 { |
|
1505 iFilterArray->Delete( i ); |
|
1506 iFilterIdTemporaryArray[g] = 0xFF; |
|
1507 i = iFilterArray->Count(); |
|
1508 } |
|
1509 } |
|
1510 } |
|
1511 } |
|
1512 } |
|
1513 |
|
1514 //Check if rejection code is received |
|
1515 if( 0 != rejectioncode.Length() && KErrNone != aResult ) |
|
1516 { |
|
1517 |
|
1518 //Append rejection code |
|
1519 TInt length = iConfig->iProtocolConfigOption.iMiscBuffer.MaxLength()-4; |
|
1520 |
|
1521 if( iConfig->iProtocolConfigOption.iMiscBuffer.Length() <= length ) |
|
1522 { |
|
1523 //1st byte of container ID |
|
1524 iConfig->iProtocolConfigOption.iMiscBuffer.Append(0x00); |
|
1525 //2nd byte of container ID |
|
1526 iConfig->iProtocolConfigOption.iMiscBuffer.Append(0x04); |
|
1527 //content length |
|
1528 iConfig->iProtocolConfigOption.iMiscBuffer.Append(0x01); |
|
1529 //content |
|
1530 iConfig->iProtocolConfigOption.iMiscBuffer.Append( rejectioncode ); |
|
1531 } |
|
1532 |
|
1533 } |
|
1534 |
|
1535 |
|
1536 iMmPacketContextTsy->CompleteModifyActiveContext( aResult ); |
|
1537 iPrevFilterStatus = EAddPacketFilterStatusUnknown; |
|
1538 |
|
1539 } |
|
1540 |
|
1541 // --------------------------------------------------------------------------- |
|
1542 // CMmPacketContextGsmWcdmaExt::EnumeratePacketFilters |
|
1543 // Returns number of defined packet filters to client |
|
1544 // (other items were commented in a header). |
|
1545 // --------------------------------------------------------------------------- |
|
1546 // |
|
1547 TInt CMmPacketContextGsmWcdmaExt::EnumeratePacketFilters( |
|
1548 TInt *aCount ) |
|
1549 { |
|
1550 |
|
1551 *aCount = 0; |
|
1552 |
|
1553 if ( NULL != iFilterArray ) |
|
1554 { |
|
1555 *aCount = iFilterArray->Count(); |
|
1556 } |
|
1557 |
|
1558 return KErrNone; |
|
1559 |
|
1560 } |
|
1561 |
|
1562 // --------------------------------------------------------------------------- |
|
1563 // CMmPacketContextGsmWcdmaExt::GetPacketFilterInfo |
|
1564 // Returns the packet filter information specified by aIndex |
|
1565 // (other items were commented in a header). |
|
1566 // --------------------------------------------------------------------------- |
|
1567 // |
|
1568 TInt CMmPacketContextGsmWcdmaExt::GetPacketFilterInfo( |
|
1569 const TInt aIndex, |
|
1570 TPacketBase* aPacketFilterInfo ) |
|
1571 { |
|
1572 TInt ret( KErrArgument ); |
|
1573 |
|
1574 if ( NULL != iFilterArray ) |
|
1575 { |
|
1576 if( iFilterArray->Count() > aIndex ) |
|
1577 { |
|
1578 RPacketContext::TPacketFilterV2& contextFilter = |
|
1579 *( RPacketContext::TPacketFilterV2* )aPacketFilterInfo; |
|
1580 |
|
1581 contextFilter = iFilterArray->At( aIndex ); |
|
1582 ret = KErrNone; |
|
1583 |
|
1584 } |
|
1585 } |
|
1586 |
|
1587 return ret; |
|
1588 |
|
1589 } |
|
1590 |
|
1591 // --------------------------------------------------------------------------- |
|
1592 // CMmPacketContextGsmWcdmaExt::ContextConfig |
|
1593 // Return Context configuration |
|
1594 // (other items were commented in a header). |
|
1595 // --------------------------------------------------------------------------- |
|
1596 // |
|
1597 RPacketContext::TContextConfigGPRS* CMmPacketContextGsmWcdmaExt::ContextConfig |
|
1598 ( |
|
1599 ) const |
|
1600 { |
|
1601 return iConfig; |
|
1602 } |
|
1603 |
|
1604 // --------------------------------------------------------------------------- |
|
1605 // CMmPacketContextGsmWcdmaExt::GetDnsInfoEtel |
|
1606 // This method gets the DNS info |
|
1607 // (other items were commented in a header). |
|
1608 // --------------------------------------------------------------------------- |
|
1609 // |
|
1610 TInt CMmPacketContextGsmWcdmaExt::GetDnsInfoEtel( |
|
1611 TDes8* const aDnsInfo ) |
|
1612 { |
|
1613 TFLOGSTRING( "TSY: CMmPacketContextGsmWcdmaExt::GetDnsInfoEtel." ); |
|
1614 |
|
1615 // Unpack the aDnsInfo |
|
1616 RPacketContext::TTDnsInfoV2Pckg* dnsInfoPckg = |
|
1617 ( RPacketContext::TTDnsInfoV2Pckg* ) aDnsInfo; |
|
1618 RPacketContext::TDnsInfoV2& dnsInfo = ( *dnsInfoPckg )(); |
|
1619 |
|
1620 // Get DNS info |
|
1621 dnsInfo.iPrimaryDns = iConfig-> |
|
1622 iProtocolConfigOption.iDnsAddresses.iPrimaryDns; |
|
1623 dnsInfo.iSecondaryDns = iConfig-> |
|
1624 iProtocolConfigOption.iDnsAddresses.iSecondaryDns; |
|
1625 |
|
1626 return KErrNone; |
|
1627 } |
|
1628 |
|
1629 // --------------------------------------------------------------------------- |
|
1630 // CMmPacketContextGsmWcdmaExt::SetContextStatusBeforeDeactivation |
|
1631 // Sets context status before activation |
|
1632 // (other items were commented in a header). |
|
1633 // --------------------------------------------------------------------------- |
|
1634 // |
|
1635 void CMmPacketContextGsmWcdmaExt::SetContextStatusBeforeDeactivation( |
|
1636 const RPacketContext::TContextStatus aContextStatusBeforeDeactivation ) |
|
1637 { |
|
1638 |
|
1639 iContextStatusBeforeDeactivation = aContextStatusBeforeDeactivation; |
|
1640 |
|
1641 } |
|
1642 |
|
1643 // --------------------------------------------------------------------------- |
|
1644 // CMmPacketContextGsmWcdmaExt::CompleteNotifyStatusChange |
|
1645 // Routes completion to tsy and sets last error cause |
|
1646 // (other items were commented in a header). |
|
1647 // --------------------------------------------------------------------------- |
|
1648 // |
|
1649 void CMmPacketContextGsmWcdmaExt::CompleteNotifyStatusChange( |
|
1650 const CMmDataPackage* aDataPackage, |
|
1651 const TInt aResult ) |
|
1652 { |
|
1653 |
|
1654 TInfoName* null= NULL; |
|
1655 RPacketContext::TContextStatus contextStatus; |
|
1656 |
|
1657 //initialise struct for completion params |
|
1658 TContextMisc misc; |
|
1659 |
|
1660 aDataPackage->UnPackData( null, misc ); |
|
1661 contextStatus = misc.iStatus; |
|
1662 |
|
1663 if( KErrNone != aResult ) |
|
1664 { |
|
1665 |
|
1666 iMmPacketContextTsy->SetLastErrorCause( aResult ); |
|
1667 |
|
1668 } |
|
1669 |
|
1670 //Check if rejection cause is included |
|
1671 if( 0 != misc.iRejectionCause.Length() && KErrNone != aResult ) |
|
1672 { |
|
1673 |
|
1674 //Append rejection code |
|
1675 TInt length = iConfig->iProtocolConfigOption.iMiscBuffer.MaxLength()-4; |
|
1676 if( iConfig->iProtocolConfigOption.iMiscBuffer.Length() <= length ) |
|
1677 { |
|
1678 //1st byte of container ID |
|
1679 iConfig->iProtocolConfigOption.iMiscBuffer.Append(0x00); |
|
1680 //2nd byte of container ID |
|
1681 iConfig->iProtocolConfigOption.iMiscBuffer.Append(0x04); |
|
1682 //content length |
|
1683 iConfig->iProtocolConfigOption.iMiscBuffer.Append(0x01); |
|
1684 //content |
|
1685 iConfig->iProtocolConfigOption.iMiscBuffer.Append( |
|
1686 misc.iRejectionCause ); |
|
1687 } |
|
1688 } |
|
1689 |
|
1690 iMmPacketContextTsy->CompleteNotifyStatusChange( contextStatus ); |
|
1691 |
|
1692 } |
|
1693 |
|
1694 //---------------------------------------------------------------------------- |
|
1695 // CMmPacketContextGsmWcdmaExt::AddMediaAuthorizationL makes request for |
|
1696 // licensee specific tsy for adding authorization params |
|
1697 //---------------------------------------------------------------------------- |
|
1698 |
|
1699 TInt CMmPacketContextGsmWcdmaExt::AddMediaAuthorizationL( |
|
1700 RPacketContext::CTFTMediaAuthorizationV3* const aMediaAuthorization, TBool &aHasMediaAuthorizationBeenCached ) |
|
1701 { |
|
1702 |
|
1703 TInt ret ( KErrGeneral ); |
|
1704 CMmPacketDataPackage data; |
|
1705 TInfoName contextName = iMmPacketContextTsy->ContextName(); |
|
1706 |
|
1707 //take copy and store locally |
|
1708 RPacketContext::CTFTMediaAuthorizationV3* mediaAuthorization = |
|
1709 aMediaAuthorization; |
|
1710 |
|
1711 |
|
1712 if ( NULL == iTempMediaAuthorizationArray ) |
|
1713 { |
|
1714 iTempMediaAuthorizationArray = new ( ELeave ) CArrayFixFlat |
|
1715 <RPacketContext::CTFTMediaAuthorizationV3>( 8 ); |
|
1716 //Reset Array |
|
1717 iTempMediaAuthorizationArray->Reset(); |
|
1718 } |
|
1719 |
|
1720 |
|
1721 //Store request locally |
|
1722 if ( 3 > iTempMediaAuthorizationArray->Count() ) |
|
1723 { |
|
1724 |
|
1725 iTempMediaAuthorizationArray->AppendL( *mediaAuthorization ); |
|
1726 aHasMediaAuthorizationBeenCached=ETrue; |
|
1727 ret = KErrNone; |
|
1728 } |
|
1729 else |
|
1730 { |
|
1731 aHasMediaAuthorizationBeenCached=EFalse; |
|
1732 } |
|
1733 |
|
1734 // context configuration if context status is unknown or inactive request |
|
1735 // will be sended first time to Licensee Tsy |
|
1736 |
|
1737 if ( iMmPacketContextTsy->ContextStatus() == |
|
1738 RPacketContext::EStatusUnknown ||iMmPacketContextTsy->ContextStatus() |
|
1739 == RPacketContext::EStatusInactive ) |
|
1740 { |
|
1741 |
|
1742 data.SetConfig( iConfig , iContextConfigurationType ); |
|
1743 data.PackData( &contextName, aMediaAuthorization ); |
|
1744 |
|
1745 |
|
1746 //Send request to licensee Tsy |
|
1747 ret = iMmPacketServiceTsy->MessageManager()->HandleRequestL( |
|
1748 EPacketAddMediaAuthorization, &data ); |
|
1749 |
|
1750 isAddMediaAuthorizationCalledFirstTime = ETrue; |
|
1751 } |
|
1752 |
|
1753 return ret; |
|
1754 } |
|
1755 |
|
1756 |
|
1757 //---------------------------------------------------------------------------- |
|
1758 // TInt CMmPacketContextGsmWcdmaExt::RemoveMediaAuthorization |
|
1759 // removes authoriazation params |
|
1760 //---------------------------------------------------------------------------- |
|
1761 |
|
1762 TInt CMmPacketContextGsmWcdmaExt::RemoveMediaAuthorization( |
|
1763 RPacketContext::TAuthorizationToken* const aAuthorizationToken ) |
|
1764 { |
|
1765 |
|
1766 TInt ret( KErrNotFound ); |
|
1767 RPacketContext::CTFTMediaAuthorizationV3* mediaAuthorization = NULL; |
|
1768 |
|
1769 for( TInt index (0); index < iTempMediaAuthorizationArray->Count(); index++ ) |
|
1770 { |
|
1771 //get pointer from array by index |
|
1772 mediaAuthorization = &( iTempMediaAuthorizationArray->At( index ) ); |
|
1773 |
|
1774 if( NULL != mediaAuthorization ) |
|
1775 { |
|
1776 //Check if authorizationtoken is the one to be removed |
|
1777 if ( *aAuthorizationToken == mediaAuthorization->iAuthorizationToken ) |
|
1778 { |
|
1779 iTempMediaAuthorizationArray->Delete( index ); |
|
1780 |
|
1781 //break if found |
|
1782 index = iTempMediaAuthorizationArray->Count(); |
|
1783 ret = KErrNone; |
|
1784 } |
|
1785 } |
|
1786 //make sure that pointer will be renewed |
|
1787 mediaAuthorization = NULL; |
|
1788 |
|
1789 } |
|
1790 |
|
1791 return ret; |
|
1792 |
|
1793 } |
|
1794 |
|
1795 // ================= OTHER EXPORTED FUNCTIONS =============================== |
|
1796 |
|
1797 // End of File |