cellular/telephonysettings/inc/PSetCallDivertingBase.h
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:  Divert base class.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef CPSETCALLDIVERTINGBASE_H
       
    20 #define CPSETCALLDIVERTINGBASE_H
       
    21 
       
    22 //  INCLUDES
       
    23 #include <e32base.h>
       
    24 #include <badesca.h>
       
    25 #include <mmretrieve.h>
       
    26 #include <ctsydomaincrkeys.h>
       
    27 #include "mcalldiverting.h" 
       
    28 #include "msssettingsobserver.h" 
       
    29 #include "nwdefs.h"             
       
    30 #include "psetconstants.h" 
       
    31 
       
    32 // CLASS DECLARATION
       
    33 class MPsetDivertObserver;
       
    34 
       
    35 /**
       
    36  * CPSetCallDivertingBase is base class for different type of
       
    37  * call divert implementations
       
    38  *
       
    39  *  @lib phonesettings
       
    40  *  @since S60 v5.1
       
    41  */
       
    42 NONSHARABLE_CLASS( CPSetCallDivertingBase ) : public CActive,
       
    43                                               public MSSSettingsObserver,
       
    44                                               public MCallDiverting
       
    45     {
       
    46     public: // Constructors and destructors.
       
    47 
       
    48         /**
       
    49         * Two-phased constructor.
       
    50         *
       
    51         * @return new instance of the class.
       
    52         * @param aObserver Call divert observer.
       
    53         * @param aPhone Provides client access to 
       
    54         *               mobile phone functionality provided by TSY.
       
    55         * @param aDivert provides access to CPsetCallDiverting.
       
    56         * @return Created CPSetCallDivertingBase object.
       
    57         */
       
    58         static CPSetCallDivertingBase* NewL(
       
    59                 MPsetDivertObserver& aObserver, 
       
    60                 RMobilePhone& aPhone,
       
    61                 CPsetCallDiverting* aDivert );
       
    62 
       
    63         /**
       
    64         * Destructor.
       
    65         */
       
    66         ~CPSetCallDivertingBase();
       
    67    
       
    68     public: // From base class.
       
    69         /**
       
    70          * @see MCallDiverting.
       
    71          */
       
    72         void SetRequestObserver( MPsetRequestObserver* aObs );
       
    73 
       
    74         /**
       
    75         * @see MCallDiverting.
       
    76         */ 
       
    77         void SetDivertingL( const TCallDivertSetting& aDivert,  
       
    78                             TBasicServiceGroups aBsc );        
       
    79         
       
    80         /**
       
    81         * @see MCallDiverting.
       
    82         */ 
       
    83         void GetDivertingStatusL( const TServiceGroup aServiceGroup, 
       
    84                                   const TCallDivertingCondition aCondition, 
       
    85                                   TBasicServiceGroups aBsc );
       
    86         /**
       
    87         * @see MCallDiverting.
       
    88         */ 
       
    89         TInt CancelCurrentRequest();
       
    90         
       
    91         /**
       
    92         * @see MCallDiverting.
       
    93         */ 
       
    94         TInt SetNewDefaultNumberL( TDes& aNumber );
       
    95         
       
    96         /**
       
    97         * @see MCallDiverting.
       
    98         */ 
       
    99         TInt GetTimerValueL();
       
   100         
       
   101         /**
       
   102         * @see MCallDiverting.
       
   103         */ 
       
   104         TInt SetTimerValueL( const TInt& aValue );
       
   105         
       
   106         /**
       
   107         * @see MCallDiverting.
       
   108         */ 
       
   109         void SwapDefaultNumberL( const TInt& aLocation );
       
   110         
       
   111         /**
       
   112         * @see MCallDiverting.
       
   113         */ 
       
   114         TInt SaveKey( TUint32 aKeyId, const TDesC& aKeyValue );
       
   115         
       
   116         /**
       
   117         * @see MCallDiverting.
       
   118         */
       
   119         TInt GetNumbersFromSharedDataL( TInt aType, 
       
   120                                 CDesC16ArrayFlat& aArray );        
       
   121     protected:
       
   122         
       
   123         /**
       
   124         * Gets Als status.
       
   125         * 
       
   126         * @return used ALS line.
       
   127         */
       
   128         TSelectedLine GetSAAls();
       
   129         
       
   130         /** 
       
   131         * Creates param list for NotifySADivertChange method.
       
   132         */ 
       
   133         TCallDivertNotifySetting CreateDivertNotifySetting( 
       
   134                     TUnconditionalCFStatus aCurrentDivert, 
       
   135                     TBool aDivertChanged,
       
   136                     TBool aVoiceMbxDivert, 
       
   137                     TInt aBasic );
       
   138         
       
   139         /**
       
   140         * If unconditional voice divert is activated/cancelled, notifies observer, 
       
   141         * so that it can set on/off indicators.
       
   142         * 
       
   143         * @param aVmbxDivert vmbx number.
       
   144         * @param TDivertingStatus call forwarding status.
       
   145         */
       
   146         void HandleSANotificationL( TBool aVmbxDivert, TDivertingStatus& aCfStatus );
       
   147         
       
   148         /**
       
   149         * Verifies whether the divert-to number is to voice mail box.
       
   150         *
       
   151         * @param aTelNumber divert number.
       
   152         * @return ETrue if used number is vmbx number
       
   153         *       otherwise EFalse.
       
   154         */
       
   155         TBool IsVMBXDivertL( TDesC& aTelNumber );       
       
   156         
       
   157         /**
       
   158         * If divert activation/cancellation/etc. affects more than one bsc, 
       
   159         * inform PSUI about it.
       
   160         * 
       
   161         * @param aDivert contains forwarding information.
       
   162         * @param aBsc used basic service.
       
   163         * @return ETrue if divert is multiaffecting
       
   164         *       otherwise EFalse.
       
   165         */
       
   166         TBool IsMultiAffectingDivert( 
       
   167                         const TCallDivertSetting& aDivert, 
       
   168                         TBasicServiceGroups aBsc );
       
   169         
       
   170         /**
       
   171         * Validates used bsc, if EUnknown, updates to real value.
       
   172         * 
       
   173         * @param aBsc used basic service.
       
   174         */ 
       
   175         void ValidateBsc( TBasicServiceGroups& aBsc );
       
   176         
       
   177         /**
       
   178         * Currently active request that is handled by this class.
       
   179         */ 
       
   180         enum TPSetDivertRequest
       
   181             {
       
   182             EPSetNone, 
       
   183             EPSetChangeDivert,
       
   184             EPSetGetDivertStatus
       
   185             };
       
   186         
       
   187         /**
       
   188         * Starts new request.
       
   189         * 
       
   190         * @param aRequest defines request type.
       
   191         */ 
       
   192         void StartRequestingL( const TInt& aRequest );
       
   193         
       
   194         /**
       
   195         * Inform request observer that request status has changed.
       
   196         * 
       
   197         * @param aStatus request type.
       
   198         */
       
   199         void SetRequestStatus( TPSetDivertRequest aStatus );
       
   200         
       
   201         /**
       
   202         * Inform the request observer that request has been completed.
       
   203         *
       
   204         * @param aError request status.
       
   205         */
       
   206         void RequestCompleted( const TInt& aError );
       
   207         
       
   208     private:
       
   209         
       
   210         /**
       
   211         * Push object into cleanupstack to catch leaving.
       
   212         */
       
   213         void CleanupLeavePushL();
       
   214         
       
   215         /**
       
   216         * Object has caused a leave.
       
   217         */
       
   218         static void DoHandleLeave( TAny* aAny );
       
   219         
       
   220         /**
       
   221         * Handles leave.
       
   222         */
       
   223         void HandleLeave();
       
   224         
       
   225         /**
       
   226         * Verifies that delay time is divisible by five.
       
   227         */ 
       
   228         TBool VerifyDelayTime( const TInt& aDelayTime );
       
   229         
       
   230     protected:
       
   231 
       
   232         /**
       
   233         * C++ constructor.
       
   234         */
       
   235         CPSetCallDivertingBase( RMobilePhone& aPhone, CPsetCallDiverting* aDivert  );
       
   236         /**
       
   237         * Symbian OS constructor.
       
   238         */
       
   239         void ConstructL( MPsetDivertObserver& aObserver );
       
   240        
       
   241     private: //from base clases.
       
   242 
       
   243         /**
       
   244         * @see CActive::RunL().
       
   245         */
       
   246         void RunL();
       
   247            
       
   248         /**
       
   249         * @see CActive::DoCancel().
       
   250         */
       
   251         void DoCancel();
       
   252            
       
   253         /**
       
   254         * @see MSSSettingsObserver::PhoneSettingChanged().
       
   255         */
       
   256         void PhoneSettingChanged( TSSSettingsSetting aSetting, TInt aNewValue );
       
   257         
       
   258     protected:
       
   259         
       
   260         // Provides client access to mobile phone functionality provided by TSY.
       
   261         RMobilePhone& iPhone;
       
   262         
       
   263         // Provides client access to mobile line functionality provided by TSY.
       
   264         RMobileLine* iLine;
       
   265         
       
   266         // Observer for Call divert requests
       
   267         MPsetDivertObserver* iObserver;
       
   268        
       
   269         // Call divert instance.
       
   270         CPsetCallDiverting* iDivert;
       
   271        
       
   272         // Current, active request
       
   273         TPSetDivertRequest iCurrentReq;
       
   274        
       
   275         // Value of Alternative Line Selection setting
       
   276         TSSSettingsAlsValue iAls;
       
   277        
       
   278         // SsSettings pointer, accesses supplementary services on SIM
       
   279         RSSSettings* iSsSettings;
       
   280        
       
   281         // Plural notes are shown when operations affect several groups.
       
   282         TBool iPluralNotes;
       
   283        
       
   284         // Request observer
       
   285         MPsetRequestObserver* iReqObserver;
       
   286        
       
   287         // Call forwarding reason.
       
   288         RMobilePhone::TMobilePhoneCFCondition iReason;
       
   289        
       
   290         // Divert condition
       
   291         RMobilePhone::TMobilePhoneCFInfoEntryV1 iDivertInfo;
       
   292        
       
   293         // Call divert settings
       
   294         RMobilePhone::TMobilePhoneCFChangeV1 iChangeInfo;
       
   295        
       
   296         // Retrieves the Call Forwarding status list from the phone.
       
   297         CRetrieveMobilePhoneCFList* iCfInterrogator;
       
   298     
       
   299         // Central repository.
       
   300         CRepository* iRepository;
       
   301     
       
   302         // Status check.
       
   303         TBool iCFStatusCheck;
       
   304        
       
   305         // Basic service code.
       
   306         TInt iBsc;
       
   307        
       
   308         // Call forwarding settings.
       
   309         TCallDivertSetting iDivertStatus;
       
   310        
       
   311         // Is request connected to video diverts.
       
   312         TBool iVideoDivert;
       
   313        
       
   314         // Is request connected to voice diverts.
       
   315         TBool iVoiceDivert;
       
   316        
       
   317         // Is feature manager intialized. 
       
   318         TBool iFeatureManagerInitialized;
       
   319     };
       
   320 
       
   321 
       
   322 #endif      // CPSETCALLDIVERTINGBASE_H 
       
   323 
       
   324 // End of File