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