3177 |
3211 |
3178 //Complete the client request |
3212 //Complete the client request |
3179 iMmPhoneTsy->ReqCompleted( reqHandle, aErrorValue ); |
3213 iMmPhoneTsy->ReqCompleted( reqHandle, aErrorValue ); |
3180 } |
3214 } |
3181 } |
3215 } |
3182 |
3216 |
|
3217 // --------------------------------------------------------------------------- |
|
3218 // CMmNetTsy::GetPreferredNetworksListPhase1L |
|
3219 // Returns minimum size of a buffer to retreive the current Preferred Networks List from SIM |
|
3220 // (other items were commented in a header). |
|
3221 // --------------------------------------------------------------------------- |
|
3222 // |
|
3223 TInt CMmNetTsy::GetPreferredNetworksListPhase1L(const TTsyReqHandle /*aTsyReqHandle*/, |
|
3224 RMobilePhone::TClientId const* aId, TInt* aBufSize) |
|
3225 { |
|
3226 TFLOGSTRING("TSY: CMmNetTsy::GetPreferredNetworksListPhase1"); |
|
3227 TTsyReqHandle getPrefPLMNHandle = iMmPhoneTsy->iTsyReqHandleStore->GetTsyReqHandle |
|
3228 (CMmPhoneTsy::EMultimodePhoneGetPreferredNetworksPhase1); |
|
3229 |
|
3230 if(CMmPhoneTsy::EMultimodePhoneReqHandleUnknown != getPrefPLMNHandle) |
|
3231 { |
|
3232 // The request is already processing because of previous request |
|
3233 // Complete request with status value informing the client about |
|
3234 // the situation. |
|
3235 TFLOGSTRING("TSY GetPreferredNetworksListPhase1: the request is already processing because previous request."); |
|
3236 return KErrServerBusy; |
|
3237 } |
|
3238 else |
|
3239 { |
|
3240 TInt ret = iMmPhoneTsy->iMessageManager->HandleRequestL(ECtsyPhoneGetPreferredNetworksReq); |
|
3241 |
|
3242 if(KErrNone == ret) |
|
3243 { |
|
3244 TFLOGSTRING("TSY: Successfully send IPC EMobilePhoneGetPreferredNetworksPhase1 to LTSY"); |
|
3245 |
|
3246 iMmPhoneTsy->iReqHandleType = CMmPhoneTsy::EMultimodePhoneGetPreferredNetworksPhase1; |
|
3247 |
|
3248 // if iGetPrefPLMNList, iClientIdGetPrefPLMN, and/or iBufSizeGetPrefPLMN are not NULL, phase 1 is called twice without calling phase 2. |
|
3249 // In this case, we should ignore the previous phase 1 and delete buffers. |
|
3250 if(iGetPrefPLMNList != NULL) |
|
3251 { |
|
3252 delete iGetPrefPLMNList; |
|
3253 iGetPrefPLMNList = NULL; |
|
3254 } |
|
3255 iBufSizeGetPrefPLMN = aBufSize; |
|
3256 if(iClientIdGetPrefPLMN != NULL) |
|
3257 { |
|
3258 delete iClientIdGetPrefPLMN; |
|
3259 iClientIdGetPrefPLMN = NULL; |
|
3260 } |
|
3261 // Copy client id (session and subsession handle). it's used for |
|
3262 // matching phase 1 and 2 of a request |
|
3263 iClientIdGetPrefPLMN = new ( ELeave ) RMobilePhone::TClientId( *aId ); |
|
3264 |
|
3265 } |
|
3266 else |
|
3267 { |
|
3268 TFLOGSTRING2("TSY: GetPreferredNetworksListPhase1L LTSY returns error=%d", ret); |
|
3269 return ret; |
|
3270 } |
|
3271 } |
|
3272 return KErrNone; |
|
3273 |
|
3274 } |
|
3275 |
|
3276 // --------------------------------------------------------------------------- |
|
3277 // CMmNetTsy::GetPreferredNetworksListPhase2 |
|
3278 // Copies the current Preferred Networks List in the given buffer |
|
3279 // (other items were commented in a header). |
|
3280 // --------------------------------------------------------------------------- |
|
3281 // |
|
3282 TInt CMmNetTsy::GetPreferredNetworksListPhase2(const TTsyReqHandle aTsyReqHandle, |
|
3283 RMobilePhone::TClientId const* aId, TDes8* aBuffer) |
|
3284 { |
|
3285 TFLOGSTRING2("TSY: CMmNetTsy::GetPreferredNetworksListPhase2: aTsyReqHandle=%d", aTsyReqHandle); |
|
3286 TInt ret = KErrNone; |
|
3287 |
|
3288 if( ( iClientIdGetPrefPLMN->iSessionHandle == aId->iSessionHandle ) && |
|
3289 ( iClientIdGetPrefPLMN->iSubSessionHandle == aId->iSubSessionHandle ) ) |
|
3290 { |
|
3291 TFLOGSTRING3("TSY GetPreferredNetworksListPhase2: Phase 1 and Phase 2 client ID matched, Copy the streamed list to client buffer. session %d, subsession %d.", |
|
3292 iClientIdGetPrefPLMN->iSessionHandle, iClientIdGetPrefPLMN->iSubSessionHandle); |
|
3293 if(iGetPrefPLMNList != NULL) |
|
3294 { |
|
3295 aBuffer->Copy( iGetPrefPLMNList->Ptr( 0 ) ); |
|
3296 // MmPhoneTsy completes the request only if return an error |
|
3297 // so the request without error code has to complete here |
|
3298 iMmPhoneTsy->ReqCompleted(aTsyReqHandle, KErrNone); |
|
3299 } |
|
3300 else |
|
3301 { |
|
3302 ret = KErrNotReady; |
|
3303 } |
|
3304 } |
|
3305 else |
|
3306 { |
|
3307 TFLOGSTRING("TSY GetPreferredNetworksListPhase2: Phase 1 and Phase 2 client ID not matched, complete request with KErrCorrupt"); |
|
3308 ret = KErrCorrupt; |
|
3309 } |
|
3310 |
|
3311 delete iClientIdGetPrefPLMN; |
|
3312 iClientIdGetPrefPLMN = NULL; |
|
3313 |
|
3314 delete iGetPrefPLMNList; |
|
3315 iGetPrefPLMNList = NULL; |
|
3316 |
|
3317 iBufSizeGetPrefPLMN = NULL; |
|
3318 |
|
3319 return ret; |
|
3320 } |
|
3321 |
|
3322 // --------------------------------------------------------------------------- |
|
3323 // CMmNetTsy::StorePreferredNetworksListL |
|
3324 // Stores the Preferred Networks List into the SIM |
|
3325 // (other items were commented in a header). |
|
3326 // --------------------------------------------------------------------------- |
|
3327 // |
|
3328 TInt CMmNetTsy::StorePreferredNetworksListL(const TTsyReqHandle /*aTsyReqHandle*/, TDes8* aBuffer) |
|
3329 { |
|
3330 TFLOGSTRING("TSY: CMmNetTsy::StorePreferredNetworksList"); |
|
3331 |
|
3332 TTsyReqHandle storePrefPLMNHandle = |
|
3333 iMmPhoneTsy->iTsyReqHandleStore->GetTsyReqHandle( CMmPhoneTsy::EMultimodePhoneStorePreferredNetworksList ); |
|
3334 |
|
3335 if(CMmPhoneTsy::EMultimodePhoneReqHandleUnknown != storePrefPLMNHandle) |
|
3336 { |
|
3337 // The request is already processing because of previous request. |
|
3338 // Complete request with status value informing the client about |
|
3339 // the situation. |
|
3340 TFLOGSTRING("TSY StorePreferredNetworksListL: the request is already processing because previous request."); |
|
3341 return KErrServerBusy; |
|
3342 } |
|
3343 else |
|
3344 { |
|
3345 iMmPhoneTsy->iReqHandleType = CMmPhoneTsy::EMultimodePhoneStorePreferredNetworksList; |
|
3346 delete iStorePrefPLMNList; |
|
3347 iStorePrefPLMNList = NULL; |
|
3348 iStorePrefPLMNList = CMobilePhoneStoredNetworkList::NewL(); |
|
3349 iStorePrefPLMNList->RestoreL(*aBuffer); |
|
3350 |
|
3351 CMmDataPackage package; |
|
3352 package.PackData(iStorePrefPLMNList); |
|
3353 TInt ret = iMmPhoneTsy->iMessageManager->HandleRequestL(ECtsyPhoneStorePreferredNetworksListReq, &package); |
|
3354 if(KErrNone == ret) |
|
3355 { |
|
3356 TFLOGSTRING("TSY StorePreferredNetworksListL: Successfully send IPC EMobilePhoneStorePreferredNetworksList to LTSY"); |
|
3357 |
|
3358 } |
|
3359 else |
|
3360 { |
|
3361 TFLOGSTRING2("TSY StorePreferredNetworksListL: LTSY returns error=%d", ret); |
|
3362 delete iStorePrefPLMNList; |
|
3363 iStorePrefPLMNList = NULL; |
|
3364 return ret; |
|
3365 } |
|
3366 } |
|
3367 |
|
3368 return KErrNone; |
|
3369 } |
|
3370 |
|
3371 |
|
3372 // --------------------------------------------------------------------------- |
|
3373 // CMmNetTsy::GetPreferredNetworksListCancel |
|
3374 // Cancels the request for Getting Preferred Networks List |
|
3375 // (other items were commented in a header). |
|
3376 // --------------------------------------------------------------------------- |
|
3377 // |
|
3378 TInt CMmNetTsy::GetPreferredNetworksListCancel(const TTsyReqHandle /*aTsyReqHandle*/) |
|
3379 { |
|
3380 TFLOGSTRING("TSY: CMmPhoneTsy::GetPreferredNetworksListCancel"); |
|
3381 |
|
3382 TTsyReqHandle reqHandle = iMmPhoneTsy->iTsyReqHandleStore->ResetTsyReqHandle(CMmPhoneTsy::EMultimodePhoneGetPreferredNetworksPhase1); |
|
3383 |
|
3384 if(CMmPhoneTsy::EMultimodePhoneReqHandleUnknown != reqHandle) |
|
3385 { |
|
3386 iBufSizeGetPrefPLMN = NULL; |
|
3387 if(iClientIdGetPrefPLMN) |
|
3388 { |
|
3389 delete iClientIdGetPrefPLMN; |
|
3390 iClientIdGetPrefPLMN = NULL; |
|
3391 } |
|
3392 if(iGetPrefPLMNList) |
|
3393 { |
|
3394 delete iGetPrefPLMNList; |
|
3395 iGetPrefPLMNList = NULL; |
|
3396 } |
|
3397 iMmPhoneTsy->ReqCompleted( reqHandle, KErrCancel ); |
|
3398 } |
|
3399 //if reqHandle is 0, it means phase 1 has completed and the list retrieval cannot be cancelled |
|
3400 return KErrNone; |
|
3401 } |
|
3402 |
|
3403 // --------------------------------------------------------------------------- |
|
3404 // CMmNetTsy::NotifyStorePreferredNetworksListChange |
|
3405 // Subscribes the notification for storing Preferred networks List |
|
3406 // (other items were commented in a header). |
|
3407 // --------------------------------------------------------------------------- |
|
3408 // |
|
3409 TInt CMmNetTsy::NotifyStorePreferredNetworksListChange() |
|
3410 { |
|
3411 TFLOGSTRING("TSY: CMmPhoneTsy::NotifyStorePreferredNetworksListChange"); |
|
3412 iMmPhoneTsy->iReqHandleType = CMmPhoneTsy::EMultimodePhoneNotifyStorePreferredNetworksListChange; |
|
3413 |
|
3414 return KErrNone; |
|
3415 } |
|
3416 |
|
3417 // --------------------------------------------------------------------------- |
|
3418 // CMmNetTsy::NotifyStorePreferredNetworksListChangeCancel |
|
3419 // Cancels the notification request for storing Preferred Networks List |
|
3420 // (other items were commented in a header). |
|
3421 // --------------------------------------------------------------------------- |
|
3422 // |
|
3423 TInt CMmNetTsy::NotifyStorePreferredNetworksListChangeCancel(const TTsyReqHandle aTsyReqHandle) |
|
3424 { |
|
3425 TFLOGSTRING2("TSY: CMmNetTsy::NotifyStorePreferredNetworksListChangeCancel: aTsyReqHandle=%d", aTsyReqHandle); |
|
3426 TTsyReqHandle reqHandle = iMmPhoneTsy->iTsyReqHandleStore->ResetTsyReqHandle |
|
3427 (CMmPhoneTsy::EMultimodePhoneNotifyStorePreferredNetworksListChange); |
|
3428 |
|
3429 if(CMmPhoneTsy::EMultimodePhoneReqHandleUnknown != reqHandle) |
|
3430 { |
|
3431 iMmPhoneTsy->ReqCompleted( aTsyReqHandle, KErrCancel ); |
|
3432 } |
|
3433 return KErrNone; |
|
3434 } |
|
3435 |
|
3436 // --------------------------------------------------------------------------- |
|
3437 // CMmNetTsy::CompleteGetPreferredNetworksListPhase1 |
|
3438 // Completes the notification request for storing Preferred Networks List |
|
3439 // (other items were commented in a header). |
|
3440 // --------------------------------------------------------------------------- |
|
3441 // |
|
3442 void CMmNetTsy::CompleteGetPreferredNetworksListPhase1(TInt aError, CMmDataPackage* aDataPackage) |
|
3443 { |
|
3444 TFLOGSTRING2("TSY: CMmNetTsy::CompleteGetPreferredNetworksListPhase1: aError=%d", aError); |
|
3445 |
|
3446 TTsyReqHandle reqHandle = iMmPhoneTsy->iTsyReqHandleStore->ResetTsyReqHandle( CMmPhoneTsy::EMultimodePhoneGetPreferredNetworksPhase1 ); |
|
3447 |
|
3448 TFLOGSTRING2("TSY CompleteGetPreferredNetworksListPhase1: EMobilePhoneGetPreferredNetworksPhase1 reqHandle=%d", reqHandle); |
|
3449 |
|
3450 TInt completeError = KErrNone; |
|
3451 |
|
3452 if(CMmPhoneTsy::EMultimodePhoneReqHandleUnknown == reqHandle) |
|
3453 { |
|
3454 TFLOGSTRING("TSY CompleteGetPreferredNetworksListPhase1: reqHandle is 0, cannot complete Phase1 list retrieval request!!"); |
|
3455 if(iClientIdGetPrefPLMN) |
|
3456 { |
|
3457 delete iClientIdGetPrefPLMN; |
|
3458 iClientIdGetPrefPLMN = NULL; |
|
3459 } |
|
3460 } |
|
3461 else if(KErrNone == aError) |
|
3462 { |
|
3463 if(iGetPrefPLMNList == NULL) |
|
3464 { |
|
3465 TFLOGSTRING("TSY CompleteGetPreferredNetworksListPhase1: LTSY successfully retrieved the preferred networks list, unpack it"); |
|
3466 CMobilePhoneStoredNetworkList* list; |
|
3467 aDataPackage->UnPackData(&list); |
|
3468 |
|
3469 TRAPD(trapError, iGetPrefPLMNList = list->StoreLC(); CleanupStack::Pop();); // pop the CBufBase * allocated by StoreLC |
|
3470 if(KErrNone == trapError) |
|
3471 { |
|
3472 *iBufSizeGetPrefPLMN = iGetPrefPLMNList->Size(); |
|
3473 TFLOGSTRING2("TSY CompleteGetPreferredNetworksListPhase1: first phase list retrieval is OK!!, client buffer = %d", *iBufSizeGetPrefPLMN); |
|
3474 iMmPhoneTsy->ReqCompleted( reqHandle, KErrNone ); |
|
3475 |
|
3476 } |
|
3477 else |
|
3478 { |
|
3479 TFLOGSTRING2("TSY CompleteGetPreferredNetworksListPhase1: failed to stream the list into the buffer, error = %d!!", trapError); |
|
3480 completeError = trapError; |
|
3481 } |
|
3482 delete list; |
|
3483 } |
|
3484 else |
|
3485 { |
|
3486 TFLOGSTRING("TSY CompleteGetPreferredNetworksListPhase1: iGetPrefPLMNList is not null"); |
|
3487 completeError = KErrServerBusy; |
|
3488 } |
|
3489 } |
|
3490 else |
|
3491 { |
|
3492 TFLOGSTRING2("TSY CompleteGetPreferredNetworksListPhase1: LTSY failed to retrieve preferred network list!! error = %d", aError); |
|
3493 completeError = aError; |
|
3494 } |
|
3495 |
|
3496 if(completeError != KErrNone) |
|
3497 { |
|
3498 iMmPhoneTsy->ReqCompleted( reqHandle, aError ); |
|
3499 if(iClientIdGetPrefPLMN) |
|
3500 { |
|
3501 delete iClientIdGetPrefPLMN; |
|
3502 iClientIdGetPrefPLMN = NULL; |
|
3503 } |
|
3504 } |
|
3505 |
|
3506 iBufSizeGetPrefPLMN = NULL; |
|
3507 } |
|
3508 |
|
3509 // --------------------------------------------------------------------------- |
|
3510 // CMmNetTsy::CompleteStorePreferredNetworksList |
|
3511 // Completes an outstanding StorePreferredNetworksListL, which stores Preferred Networks List to LTSY layer |
|
3512 // (other items were commented in a header). |
|
3513 // --------------------------------------------------------------------------- |
|
3514 // |
|
3515 void CMmNetTsy::CompleteStorePreferredNetworksList(TInt aError) |
|
3516 { |
|
3517 TFLOGSTRING2("TSY: CMmPhoneTsy::CompleteStorePreferredNetworksList: aError=%d", aError); |
|
3518 |
|
3519 TTsyReqHandle reqHandle = iMmPhoneTsy->iTsyReqHandleStore->ResetTsyReqHandle( CMmPhoneTsy::EMultimodePhoneStorePreferredNetworksList ); |
|
3520 |
|
3521 TFLOGSTRING2("TSY CompleteStorePreferredNetworksList: EMobilePhoneStorePreferredNetworksList reqHandle=%d", reqHandle); |
|
3522 |
|
3523 if(iStorePrefPLMNList != NULL) |
|
3524 { |
|
3525 delete iStorePrefPLMNList; |
|
3526 iStorePrefPLMNList = NULL; |
|
3527 |
|
3528 } |
|
3529 |
|
3530 if(KErrNone == aError) |
|
3531 { |
|
3532 if(CMmPhoneTsy::EMultimodePhoneReqHandleUnknown == reqHandle) |
|
3533 { |
|
3534 // we cannot complete the store request but complete the notifier. |
|
3535 TFLOGSTRING("TSY CompleteStorePreferredNetworksList: reqHandle is 0, cannot complete store list request!!"); |
|
3536 } |
|
3537 else |
|
3538 { |
|
3539 TFLOGSTRING("TSY CompleteStorePreferredNetworksList: LTSY successfully stored the preferred networks list"); |
|
3540 iMmPhoneTsy->ReqCompleted( reqHandle, KErrNone ); |
|
3541 } |
|
3542 CompleteNotifyStorePreferredNetworksListChange(); |
|
3543 } |
|
3544 else |
|
3545 { |
|
3546 TFLOGSTRING("TSY CompleteStorePreferredNetworksList: LTSY failed to store the preferred networks list"); |
|
3547 iMmPhoneTsy->ReqCompleted( reqHandle, aError ); |
|
3548 } |
|
3549 } |
|
3550 |
|
3551 // --------------------------------------------------------------------------- |
|
3552 // CMmNetTsy::CompleteNotifyStorePreferredNetworksListChange |
|
3553 // Completes the notification request for storing Preferred Networks List |
|
3554 // (other items were commented in a header). |
|
3555 // --------------------------------------------------------------------------- |
|
3556 // |
|
3557 void CMmNetTsy::CompleteNotifyStorePreferredNetworksListChange() |
|
3558 { |
|
3559 TFLOGSTRING("TSY: CMmPhoneTsy::CompleteNotifyStorePreferredNetworksListChange"); |
|
3560 |
|
3561 TTsyReqHandle reqHandle = iMmPhoneTsy->iTsyReqHandleStore->ResetTsyReqHandle |
|
3562 ( CMmPhoneTsy::EMultimodePhoneNotifyStorePreferredNetworksListChange ); |
|
3563 if (CMmPhoneTsy::EMultimodePhoneReqHandleUnknown != reqHandle ) |
|
3564 { |
|
3565 iMmPhoneTsy->ReqCompleted( reqHandle, KErrNone); |
|
3566 } |
|
3567 else |
|
3568 { |
|
3569 TFLOGSTRING("TSY CompleteNotifyStorePreferredNetworksListChange: reqHandle is 0, cannot complete request for IPC EMobilePhoneNotifyStorePreferredNetworksListChange!!"); |
|
3570 |
|
3571 } |
|
3572 } |
|
3573 |
3183 // End of File |
3574 // End of File |
3184 |
3575 |
3185 |
3576 |
3186 |
3577 |