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