cellular/telephonysettings/src/PSetCallDivertingDualAffectImpl.cpp
changeset 46 2fa1fa551b0b
parent 42 35488577e233
child 48 78df25012fda
equal deleted inserted replaced
42:35488577e233 46:2fa1fa551b0b
     1 /*
       
     2 * Copyright (c) 2008-2008 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: Implementation of CPSetCallDivertingDualAffectImpl class.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 // INCLUDE FILES
       
    20 #include "psetcalldivertingdualaffectimpl.h" 
       
    21 #include "psetsubscriberidcheck.h" 
       
    22 
       
    23 #include <badesca.h>
       
    24 #include <etelmm.h>
       
    25 #include <e32math.h>
       
    26 #include <e32svr.h>
       
    27 #include <featmgr.h>
       
    28 #include <centralrepository.h>
       
    29 #include <settingsinternalcrkeys.h> 
       
    30 
       
    31 #include "psetcalldiverting.h" 
       
    32 #include "psetcontainer.h" 
       
    33 #include "mpsetdivertobs.h" 
       
    34 #include "psettelephony.h" 
       
    35 #include "psetpanic.h" 
       
    36 #include "mpsetrequestobs.h" 
       
    37 #include "psetutility.h" 
       
    38 #include "phonesettingslogger.h" 
       
    39 #include "psetsaobserver.h" 
       
    40 
       
    41 //  LOCAL CONSTANTS AND MACROS
       
    42 _LIT( KPSetIntNbr, "+" );
       
    43 _LIT( KPSNameOfClass, "CPsetCallDiverting" );
       
    44 _LIT( KPhone, "Telephone" );
       
    45 
       
    46 // ============================ MEMBER FUNCTIONS ===============================
       
    47 
       
    48 // -----------------------------------------------------------------------------
       
    49 // CPSetCallDivertingDualAffectImpl::NewL
       
    50 // Two-phased constructor.
       
    51 // -----------------------------------------------------------------------------
       
    52 //
       
    53 CPSetCallDivertingDualAffectImpl* CPSetCallDivertingDualAffectImpl::NewL( 
       
    54         MPsetDivertObserver& aObserver, 
       
    55         RMobilePhone& aPhone,
       
    56         CPsetCallDiverting* aDivert )
       
    57     {
       
    58     CPSetCallDivertingDualAffectImpl* self = new ( ELeave ) CPSetCallDivertingDualAffectImpl( aPhone, aDivert );
       
    59     CleanupStack::PushL( self );
       
    60     self->ConstructL( aObserver );
       
    61     CleanupStack::Pop( self );
       
    62     return self;
       
    63     }
       
    64 
       
    65 // ---------------------------------------------------------------------------
       
    66 // CPSetCallDivertingDualAffectImpl::~CPSetCallDivertingDualAffectImpl
       
    67 // ---------------------------------------------------------------------------
       
    68 //
       
    69 CPSetCallDivertingDualAffectImpl::~CPSetCallDivertingDualAffectImpl()
       
    70     {
       
    71     delete iIdCheck;
       
    72     }
       
    73 
       
    74 // -----------------------------------------------------------------------------
       
    75 // CPSetCallDivertingDualAffectImpl::CPSetCallDivertingDualAffectImpl
       
    76 // C++ constructor can NOT contain any code, that
       
    77 // might leave.
       
    78 // -----------------------------------------------------------------------------
       
    79 //
       
    80 CPSetCallDivertingDualAffectImpl::CPSetCallDivertingDualAffectImpl( 
       
    81                     RMobilePhone& aPhone, CPsetCallDiverting* aDivert ) : 
       
    82                     CPSetCallDivertingBase( aPhone, aDivert )
       
    83     {
       
    84     }
       
    85 
       
    86 // -----------------------------------------------------------------------------
       
    87 // CPSetCallDivertingDualAffectImpl::ConstructL
       
    88 // Symbian 2nd phase constructor can leave.
       
    89 // -----------------------------------------------------------------------------
       
    90 //
       
    91 void CPSetCallDivertingDualAffectImpl::ConstructL( MPsetDivertObserver& aObserver )
       
    92     {
       
    93     CPSetCallDivertingBase::ConstructL( aObserver );
       
    94     
       
    95     iIdCheck = CPSetSubscriberIdCheck::NewL();
       
    96     }
       
    97 
       
    98 // -----------------------------------------------------------------------------
       
    99 // CPSetCallDivertingDualAffectImpl::ConstructL
       
   100 // Symbian 2nd phase constructor can leave.
       
   101 // -----------------------------------------------------------------------------
       
   102 //
       
   103 void CPSetCallDivertingDualAffectImpl::SetDivertingL( const TCallDivertSetting& aDivert,  TBasicServiceGroups aBsc )
       
   104     { __PHSLOGSTRING("[PHS]--> CPSetCallDivertingDualAffectImpl::SetDivertingL");
       
   105     __PHSLOGSTRING1("[PHS]    CPSetCallDivertingDualAffectImpl::SetDivertingL: aBsc: %d", aBsc );
       
   106     if ( IsActive() )
       
   107         {
       
   108         User::Leave( KErrInUse );
       
   109         } 
       
   110     CPsetTelephony::CheckLineModeL( aDivert.iServiceGroup, &iPhone, iLine );
       
   111     if ( !iLine->SubSessionHandle() )
       
   112         {
       
   113         User::Leave( KErrBadHandle );
       
   114         }
       
   115         
       
   116     SetRequestStatus( EPSetChangeDivert );
       
   117     iReason = PSetUtility::GetDivertReason ( aDivert.iCondition );
       
   118     iVoiceDivert = SetVoiceDivert( aDivert, aBsc );
       
   119 
       
   120     /* In case of SIM support dual activation and * -command has been issued from ALS 
       
   121     * line 2 we need to change the SS service 
       
   122     * code from SS_GSM_AUX_TELEPHONY to the SS_ALL_TELE_AND_BEARER 
       
   123     * at SS_SERVICE_REQ -message.
       
   124     */
       
   125     if ( ( aBsc == EAllTeleAndBearer ) &&                // Command affects to both lines
       
   126        ( iAls == ESSSettingsAlsAlternate ) &&            // Command given at ALS line 2
       
   127        ( (RThread().Name()).Compare( KPhone ) == 0 ) &&  // *# -commands are given only from Phone thread
       
   128        ( aDivert.iSetting != ECheckStatus ) &&           // Not interrogating
       
   129        ( iIdCheck->DoesSIMSupportDualActivation() ) )    // Check SIM/IMSI
       
   130         {
       
   131         // Set iBsc to same value as aBsc so that correct alsValue 
       
   132         // can be determined in GetSAAls() method.
       
   133         iBsc = aBsc;
       
   134         }
       
   135     else
       
   136         {
       
   137         // Set iBsc to same value as aBsc so that correct alsValue 
       
   138         // can be determined in GetSAAls() method.
       
   139         iBsc = aBsc;
       
   140         ValidateBsc( aBsc );
       
   141         }
       
   142 
       
   143     iPluralNotes = IsMultiAffectingDivert( aDivert, aBsc );
       
   144 
       
   145     //Copy data to member variable
       
   146     iChangeInfo.iNumber.iTelNumber.Copy( aDivert.iNumber );
       
   147     iChangeInfo.iTimeout = KPSetDefaultDelayTimeValue;
       
   148     if ( aBsc == EAltTele )
       
   149         {
       
   150         iChangeInfo.iServiceGroup = PSetUtility::VerifyAltLineUseL();
       
   151         }
       
   152     iChangeInfo.iServiceGroup = PSetUtility::ChangeToEtelInternal( aBsc ); 
       
   153     iChangeInfo.iNumber.iNumberPlan = RMobilePhone::EIsdnNumberPlan;
       
   154     iChangeInfo.iNumber.iTypeOfNumber = RMobilePhone::EUnknownNumber;
       
   155     if ( iChangeInfo.iNumber.iTelNumber.Length() > 0 )
       
   156         {
       
   157         if ( iChangeInfo.iNumber.iTelNumber.Left(1) == KPSetIntNbr )
       
   158             {
       
   159             iChangeInfo.iNumber.iTypeOfNumber = 
       
   160                 RMobilePhone::EInternationalNumber;
       
   161             }
       
   162         }
       
   163 
       
   164     switch ( aDivert.iSetting )
       
   165         {
       
   166         case ERegisterDiverting:
       
   167             iChangeInfo.iAction = RMobilePhone::EServiceActionRegister;
       
   168             iChangeInfo.iTimeout = aDivert.iNoReplyTimer;
       
   169             __PHSLOGSTRING("[PHS]    CPSetCallDivertingDualAffectImpl::SetDivertingL: ERegisterDiverting" );
       
   170             break;
       
   171         case EEraseDiverting:
       
   172             iChangeInfo.iAction = RMobilePhone::EServiceActionErase;
       
   173             __PHSLOGSTRING("[PHS]    CPSetCallDivertingDualAffectImpl::SetDivertingL: EEraseDiverting" );
       
   174             break;
       
   175         case EActivateDiverting:
       
   176             iChangeInfo.iAction = RMobilePhone::EServiceActionActivate;
       
   177             iChangeInfo.iTimeout = aDivert.iNoReplyTimer;
       
   178             __PHSLOGSTRING("[PHS]    CPSetCallDivertingDualAffectImpl::SetDivertingL: EActivateDiverting" );
       
   179             break;
       
   180         case ECancelDiverting:
       
   181             iChangeInfo.iAction = RMobilePhone::EServiceActionDeactivate;
       
   182             __PHSLOGSTRING("[PHS]    CPSetCallDivertingDualAffectImpl::SetDivertingL: ECancelDiverting" );
       
   183             break;
       
   184         default:
       
   185             User::Leave( KErrArgument );
       
   186             break;
       
   187         }
       
   188 
       
   189     //Start requesting for setting Divert.
       
   190     iPhone.SetCallForwardingStatus( iStatus, iReason, iChangeInfo );
       
   191     StartRequestingL( KPsetRequestAlreadySet );    
       
   192     __PHSLOGSTRING("[PHS] <--CPSetCallDivertingDualAffectImpl::SetDivertingL" );
       
   193    }
       
   194 
       
   195 // ---------------------------------------------------------------------------
       
   196 // RunL
       
   197 // ---------------------------------------------------------------------------
       
   198 //
       
   199 void CPSetCallDivertingDualAffectImpl::RunL()
       
   200     {
       
   201     __PHSLOGSTRING("[PHS]--> CPSetCallDivertingDualAffectImpl::RunL" );
       
   202     
       
   203     __ASSERT_ALWAYS( 
       
   204         iObserver != NULL, Panic( KPSNameOfClass, ECDRequestPanicNoObserver ) );
       
   205 
       
   206     //Hide requesting note - does not leave when deleting a note.
       
   207     iObserver->SetEngineContact( iDivert );
       
   208     iObserver->HandleCFRequestingL( EFalse, EFalse );
       
   209 
       
   210     //Handle error case.
       
   211     if ( iStatus != KErrNone )
       
   212         {
       
   213         iObserver->HandleDivertingErrorL( iStatus.Int() );
       
   214         RequestCompleted( iStatus.Int() );
       
   215         return;
       
   216         }
       
   217         
       
   218     iDivertStatus.Initialize();
       
   219     switch ( iCurrentReq )
       
   220         {
       
   221         case EPSetChangeDivert:
       
   222             {
       
   223             __PHSLOGSTRING("[PHS]--> CPSetCallDivertingDualAffectImpl::RunL: EPSetChangeDivert" );
       
   224             //Notify Observer            
       
   225             iDivertStatus.iStatus = PSetUtility::GetChangeInfoStatus( iChangeInfo.iAction );
       
   226             
       
   227              // Check is done because of VOIP notification functionality(PSetNotesUI).
       
   228             if ( iVoiceDivert )
       
   229                 {
       
   230                 iDivertStatus.iServiceGroup = EServiceGroupVoice;
       
   231                 }
       
   232             
       
   233             iObserver->HandleDivertingChangedL( iDivertStatus, iPluralNotes );
       
   234             
       
   235             //Notify observer.
       
   236             HandleSANotificationL( 
       
   237                 IsVMBXDivertL( iChangeInfo.iNumber.iTelNumber ), 
       
   238                 iDivertStatus.iStatus );
       
   239             break;
       
   240             }
       
   241         case EPSetGetDivertStatus:
       
   242             {
       
   243             __PHSLOGSTRING("[PHS]--> CPSetCallDivertingDualAffectImpl::RunL: EPSetGetDivertStatus" );
       
   244 
       
   245             CMobilePhoneCFList* cfList = iCfInterrogator->RetrieveListL();
       
   246             CleanupStack::PushL( cfList );
       
   247             CMobilePhoneCFList* cleanedList = CMobilePhoneCFList::NewL();            
       
   248             CleanupStack::PushL( cleanedList );
       
   249             
       
   250             TInt numOfItems = cfList->Enumerate();
       
   251             TInt index = 0;
       
   252             RMobilePhone::TMobilePhoneCFInfoEntryV1 cfEntry;
       
   253             RMobilePhone::TMobilePhoneCFInfoEntryV1 copy;
       
   254             iDivertStatus.iStatus = EDivertingStatusNotRegistered;
       
   255             while( index < numOfItems )
       
   256                 {
       
   257                 cfEntry = cfList->GetEntryL( index );
       
   258                 iBsc = PSetUtility::ChangeToGSM( cfEntry.iServiceGroup );
       
   259 
       
   260                 if ( cfEntry.iStatus == RMobilePhone::ECallForwardingStatusActive )
       
   261                     {
       
   262                     copy.iServiceGroup = cfEntry.iServiceGroup;
       
   263                     copy.iCondition = cfEntry.iCondition;
       
   264                     copy.iStatus = cfEntry.iStatus;
       
   265                     copy.iNumber = cfEntry.iNumber;
       
   266                     copy.iTimeout = cfEntry.iTimeout;
       
   267                     cleanedList->AddEntryL( copy );
       
   268                     }
       
   269                  __PHSLOGSTRING1("[PHS] CPSetCallDivertingDualAffectImpl::RunL: EPSetGetDivertStatus     iBsc: %d", iBsc );
       
   270                  __PHSLOGSTRING1("[PHS] CPSetCallDivertingDualAffectImpl::RunL: EPSetGetDivertStatus iStatus: %d", cfEntry.iStatus );
       
   271                  
       
   272                 /* Basic Service Codes above were removed from "if" statement below because they would 
       
   273                 * cause divert indicator to appear with Data services. Dual activation SIM doesnt want to show 
       
   274                 * Divert indication for video service.*/                
       
   275                 if ( iBsc == EAllTeleAndBearer || iBsc == EAllTele || iBsc == ETelephony || iBsc == EAltTele )
       
   276                     {
       
   277                     // iVoiceDivert is set to true to ensure that the icons are updated in every case.
       
   278                     iVoiceDivert = ETrue;
       
   279                     if ( ( cfEntry.iStatus != RMobilePhone::ECallForwardingStatusNotRegistered )
       
   280                         && ( cfEntry.iStatus != RMobilePhone::ECallForwardingStatusNotActive )
       
   281                         && ( cfEntry.iStatus != RMobilePhone::ECallForwardingStatusNotProvisioned ) )
       
   282                         {
       
   283                         iDivertStatus.iStatus = EDivertingStatusActive;
       
   284                         }
       
   285                     else
       
   286                         {
       
   287                         iDivertStatus.iStatus = EDivertingStatusNotRegistered;
       
   288                         }
       
   289                     
       
   290                     HandleSANotificationL( 
       
   291                             IsVMBXDivertL( cfEntry.iNumber.iTelNumber ), 
       
   292                             iDivertStatus.iStatus );
       
   293                     }
       
   294                 index++;
       
   295                 }
       
   296             if ( cleanedList->Enumerate() == 0 )
       
   297                 {
       
   298                 iObserver->HandleDivertingStatusL( *cfList, iPluralNotes );
       
   299                 }
       
   300             else
       
   301                 {
       
   302                 iObserver->HandleDivertingStatusL( *cleanedList, iPluralNotes );
       
   303                 }
       
   304             CleanupStack::PopAndDestroy( 2 ); //cleanedList, cfList
       
   305             cfList = NULL;
       
   306             cleanedList = NULL;
       
   307             iCFStatusCheck = EFalse; 
       
   308             break;
       
   309             }
       
   310         default:
       
   311             Panic( KPSNameOfClass, ECDRequestPanicIncorrectRequest );
       
   312             break;
       
   313         } 
       
   314     RequestCompleted( KErrNone );
       
   315     __PHSLOGSTRING("[PHS] <--CPSetCallDivertingDualAffectImpl::RunL" );
       
   316     }    
       
   317 
       
   318 // ---------------------------------------------------------------------------
       
   319 // DoCancel
       
   320 // ---------------------------------------------------------------------------
       
   321 //
       
   322 void CPSetCallDivertingDualAffectImpl::DoCancel()
       
   323     {
       
   324     __PHSLOGSTRING("[PHS]--> CPSetCallDivertingDualAffectImpl::DoCancel" );
       
   325     //Decide which request to cancel.
       
   326     switch( iCurrentReq )
       
   327         {
       
   328         case EPSetChangeDivert:
       
   329             __PHSLOGSTRING("[PHS]   DoCancel - EPSetChangeDivert" );
       
   330             iPhone.CancelAsyncRequest( EMobilePhoneSetCallForwardingStatus );
       
   331             break;
       
   332         case EPSetGetDivertStatus:
       
   333             __PHSLOGSTRING("[PHS]   DoCancel - EPSetGetDivertStatus" );
       
   334             iCfInterrogator->Cancel();
       
   335             delete iCfInterrogator;
       
   336             iCfInterrogator = NULL;
       
   337             break;
       
   338         default:
       
   339             break;
       
   340         }
       
   341     
       
   342     //Set current request to none.
       
   343     iCurrentReq = EPSetNone;
       
   344     iVoiceDivert = EFalse;
       
   345     __PHSLOGSTRING("[PHS]<-- CPSetCallDivertingDualAffectImpl::DoCancel" );
       
   346     }
       
   347 
       
   348 // -----------------------------------------------------------------------------
       
   349 // Called if RunL Leaves
       
   350 // -----------------------------------------------------------------------------
       
   351 //
       
   352 TInt CPSetCallDivertingDualAffectImpl::RunError( TInt aError )
       
   353     {
       
   354     __PHSLOGSTRING1("[PHS]--> CPSetCallDivertingDualAffectImpl::RunError aError: %d", aError );
       
   355     if ( ( iCurrentReq == EPSetGetDivertStatus || iCurrentReq == EPSetChangeDivert)
       
   356          && iVoiceDivert )
       
   357         {
       
   358         __PHSLOGSTRING("[PHS]   RunError - HandleSANotificationL" );
       
   359         TRAP_IGNORE( HandleSANotificationL( EFalse, iDivertStatus.iStatus ) );
       
   360         }
       
   361         
       
   362     if ( iCurrentReq == EPSetGetDivertStatus )
       
   363         {
       
   364         iCFStatusCheck = EFalse;
       
   365         }   
       
   366     aError = KErrNone;
       
   367         
       
   368     //Set current request to none.
       
   369     iCurrentReq = EPSetNone;    
       
   370     iVoiceDivert = EFalse;
       
   371     __PHSLOGSTRING("[PHS]<-- CPSetCallDivertingDualAffectImpl::RunError" );
       
   372     return aError;  
       
   373     }
       
   374 
       
   375 // ---------------------------------------------------------------------------
       
   376 //  If unconditional voice divert is activated/cancelled, notifies observer, 
       
   377 //  so that it can set on/off indicators.
       
   378 // ---------------------------------------------------------------------------
       
   379 //
       
   380 void CPSetCallDivertingDualAffectImpl::HandleSANotificationL( 
       
   381     TBool aVmbxDivert, TDivertingStatus& aCfStatus )
       
   382     {
       
   383     __PHSLOGSTRING2("[PHS]--> CPSetCallDivertingDualAffectImpl::HandleSANotificationL aVmbxDivert: %d, aCfStatus: %d", aVmbxDivert, aCfStatus );
       
   384     TBool divertChanged = EFalse;
       
   385     //If divert is not with voice, do not touch indicators.
       
   386     if ( !iVoiceDivert )
       
   387         {
       
   388         return;
       
   389         }
       
   390 
       
   391     //Unconditional divert and all diverts
       
   392     if ( iReason == RMobilePhone::ECallForwardingUnconditional ||
       
   393         iReason == RMobilePhone::ECallForwardingAllCases )
       
   394         {
       
   395         if ( iCurrentReq == EPSetChangeDivert )
       
   396             {
       
   397             //show indicator if, activation/registration, else hide it
       
   398             //these are probably incorrect....
       
   399             divertChanged = 
       
   400                 ( iChangeInfo.iAction == RMobilePhone::EServiceActionRegister ||
       
   401                   iChangeInfo.iAction == RMobilePhone::EServiceActionActivate);
       
   402             }
       
   403         else
       
   404             {
       
   405             //show indicator if status is activated, hide for cancelled.
       
   406             divertChanged = ( aCfStatus == EDivertingStatusActive );
       
   407             }
       
   408         }
       
   409     else
       
   410         {
       
   411         //if not unconditional, do not touch indicators.
       
   412         return;
       
   413         }
       
   414         
       
   415     CPsetSAObserver* systemObserver = CPsetSAObserver::NewL();
       
   416     CleanupStack::PushL( systemObserver );
       
   417     
       
   418     TUnconditionalCFStatus status(KCFIndicatorUnknown);
       
   419     
       
   420     User::LeaveIfError( systemObserver->GetCurrentDivertStatus( status ) );
       
   421     
       
   422     // If used SIM support dual activation and ALS is supported then do the check for
       
   423     // current divert information. 
       
   424     if ( ( iIdCheck->DoesSIMSupportDualActivation()  ) && 
       
   425          ( iAls != ( ENotSupportedLine ) ) ) 
       
   426         {
       
   427         SetCurrentDivertInformation( status, divertChanged );
       
   428         }
       
   429     
       
   430     TCallDivertNotifySetting setting = CreateDivertNotifySetting(
       
   431         status, divertChanged, aVmbxDivert, iBsc );
       
   432     
       
   433     // Notify observer that Diverts have changed.
       
   434     systemObserver->NotifyDivertChange( GetSAAls(), 
       
   435         setting,
       
   436         -1 );
       
   437         
       
   438     CleanupStack::PopAndDestroy( systemObserver );
       
   439     
       
   440     __PHSLOGSTRING("[PHS] <--CPSetCallDivertingDualAffectImpl::HandleSANotificationL" );
       
   441     }
       
   442 
       
   443 // ---------------------------------------------------------------------------
       
   444 // Sets current divert information if used used SIM supports dual activation.
       
   445 // ---------------------------------------------------------------------------
       
   446 //
       
   447 void CPSetCallDivertingDualAffectImpl::SetCurrentDivertInformation( 
       
   448     TUnconditionalCFStatus& aStatus, 
       
   449     const TBool aDivertChanged )
       
   450     {
       
   451     TUnconditionalCFStatus previousDivertStatus = aStatus;
       
   452     TSelectedLine alsLine = GetSAAls();
       
   453     
       
   454     if (( iChangeInfo.iServiceGroup == RMobilePhone::EAllServices) &&    // - Service Code is All tele and bearer.
       
   455         ( iCurrentReq == EPSetChangeDivert) && (                         // - Change divert command issued.
       
   456         ( iReason == RMobilePhone::ECallForwardingUnconditional ) ||     // - CallForwardingCondition is: CFU or 
       
   457         ( iReason == RMobilePhone::ECallForwardingAllCases ) )  )        // CFA.                                           
       
   458         {
       
   459         switch ( alsLine )
       
   460             {
       
   461             case EPrimaryLine:
       
   462                 {
       
   463                 if( aDivertChanged )     // ON
       
   464                     {
       
   465                     if(( previousDivertStatus == KCFNoCallsForwarded ) ||      // None/Line1 -> Line2 -> Both
       
   466                        ( previousDivertStatus == ( KCFVoiceForwarded | KCFForwardedOnLine1 ) ))
       
   467                         {
       
   468                         aStatus = KCFForwardedOnLine2;
       
   469                         }
       
   470                     }
       
   471                 else                    // OFF
       
   472                     {
       
   473                     if(( previousDivertStatus == ( KCFVoiceForwarded | KCFForwardedOnLine1 | KCFForwardedOnLine2 ) ) ||  // Both/Line2 -> Line1 -> None
       
   474                        ( previousDivertStatus == KCFForwardedOnLine2 ))
       
   475                         {
       
   476                         aStatus = static_cast<TUnconditionalCFStatus>( KCFVoiceForwarded | KCFForwardedOnLine1 );
       
   477                         }
       
   478                     }
       
   479                 break;
       
   480                 }
       
   481 
       
   482             case EAuxiliaryLine:
       
   483                 {
       
   484                 if( aDivertChanged )     // ON
       
   485                     {
       
   486                     if(( previousDivertStatus == KCFNoCallsForwarded ) ||      // None/Line2 -> Line 1 -> Both
       
   487                        ( previousDivertStatus == KCFForwardedOnLine2 ))
       
   488                         {
       
   489                         aStatus = static_cast<TUnconditionalCFStatus>( KCFVoiceForwarded | KCFForwardedOnLine1 );
       
   490                         }
       
   491                     }
       
   492                 else                    // OFF
       
   493                     {
       
   494                     if(( previousDivertStatus == ( KCFVoiceForwarded | KCFForwardedOnLine1 | KCFForwardedOnLine2 ) ) ||  // Both/Line1 -> Line 2 -> None
       
   495                        ( previousDivertStatus == ( KCFVoiceForwarded | KCFForwardedOnLine1 ) ))
       
   496                         {
       
   497                         aStatus = KCFForwardedOnLine2;
       
   498                         }
       
   499                     }
       
   500                 break;
       
   501                 }
       
   502 
       
   503             default:
       
   504                 break;
       
   505             }
       
   506         }    
       
   507     }
       
   508 
       
   509 // ---------------------------------------------------------------------------
       
   510 // Returns ETrue if divert operation is to voice or to all operations.
       
   511 // ---------------------------------------------------------------------------
       
   512 //
       
   513 TBool CPSetCallDivertingDualAffectImpl::SetVoiceDivert( 
       
   514         const TCallDivertSetting& aDivert,
       
   515         const TBasicServiceGroups /*aBsc*/ )
       
   516     {
       
   517     TBool retValue(EFalse);
       
   518     if ( aDivert.iServiceGroup == EServiceGroupVoice ||
       
   519          aDivert.iServiceGroup == EServiceGroupAllTeleservices)
       
   520         {
       
   521         retValue = ETrue;
       
   522         }
       
   523     return retValue;
       
   524     }
       
   525 
       
   526 // ---------------------------------------------------------------------------
       
   527 // Gets Als information.
       
   528 // ---------------------------------------------------------------------------
       
   529 //
       
   530 TSelectedLine CPSetCallDivertingDualAffectImpl::GetSAAls()
       
   531     {
       
   532     __PHSLOGSTRING("[PHS]--> CPSetCallDivertingDualAffectImpl::GetSAAls" );
       
   533     __PHSLOGSTRING2("[PHS] iAls: %d iBsc: %d", iAls, iBsc  );
       
   534     TSelectedLine alsValue = ENotSupportedLine;
       
   535     switch ( iAls )
       
   536         {
       
   537         case ESSSettingsAlsNotSupported:
       
   538             alsValue = ENotSupportedLine;
       
   539             break;
       
   540         case ESSSettingsAlsPrimary:
       
   541             iChangeInfo.iServiceGroup == RMobilePhone::EAuxVoiceService 
       
   542                 ? ( alsValue = EAuxiliaryLine )  
       
   543                 : ( alsValue = EPrimaryLine );
       
   544             break;
       
   545         case ESSSettingsAlsAlternate:
       
   546             iChangeInfo.iServiceGroup == RMobilePhone::EAuxVoiceService 
       
   547                 ? ( alsValue = EAuxiliaryLine )  
       
   548                 : ( alsValue = EPrimaryLine );
       
   549             break;
       
   550         default:
       
   551             alsValue = ENotSupportedLine;
       
   552             break;
       
   553         }
       
   554     
       
   555     // If user checks/activates divert to line which is not selected currently than we have
       
   556     // to change returned alsvalue accordinly, if this is not done divert icon status is updated to wrong status.
       
   557     // Example case: Line 2 active user activates divert to line 1: **21*phonenumber*11#.
       
   558     if ( iBsc == EAltTele && iAls == ESSSettingsAlsPrimary )
       
   559         {
       
   560         __PHSLOGSTRING("[PHS]    CPSetCallDivertingDualAffectImpl::GetSAAls - Line 2 divert activation/check from Line 1" );
       
   561         alsValue = EAuxiliaryLine;
       
   562         }
       
   563     else if ( iBsc == ETelephony && iAls == ESSSettingsAlsAlternate )
       
   564         {
       
   565         __PHSLOGSTRING("[PHS]    CPSetCallDivertingDualAffectImpl::GetSAAls - Line 1 divert activation/check from Line 2" );
       
   566         alsValue = EPrimaryLine;
       
   567         }
       
   568     
       
   569     __PHSLOGSTRING1("[PHS]    CPSetCallDivertingDualAffectImpl::GetSAAls: alsValue: %d", alsValue );
       
   570     __PHSLOGSTRING("[PHS] <--CPSetCallDivertingDualAffectImpl::GetSAAls" );
       
   571     return alsValue;
       
   572     }
       
   573 
       
   574 // End of File