devicediagnostics/diagplugins/diagdatanetworkplugin/inc/diagdatanetworktestpdpengine.h
changeset 0 3ce708148e4d
child 54 9360ca28b668
equal deleted inserted replaced
-1:000000000000 0:3ce708148e4d
       
     1 /*
       
     2 * Copyright (c) 2007 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:  This is the header for the Diagnostics Data Network Test 
       
    15 *                 PDP-Engine class
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 #ifndef DIAGDATANETWORKTESTPDPENGINE_H 
       
    21 #define DIAGDATANETWORKTESTPDPENGINE_H
       
    22 
       
    23 // INCLUDES
       
    24 
       
    25 
       
    26 #include "diagpdptestengine.h"                      // CDiagPDPTestEngine
       
    27 #include <DiagNetworkRegStatusObserver.h>           // MDiagNetworkRegStatusObserver
       
    28 #include <diaglogeventeraserobserver.h>             // MDiagLogEventEraserObserver
       
    29 #include <AknWaitDialog.h> 
       
    30 #include "diagdatanetworktestcallbackinterface.h"   // MDiagDataNetworkTestCallBackInterface
       
    31 
       
    32 //CONSTANTS
       
    33 
       
    34 // MACROS
       
    35 
       
    36 // DATA TYPES
       
    37 
       
    38 // FUNCTION PROTOTYPES
       
    39 
       
    40 // FORWARD DECLARATIONS
       
    41 class CDiagNetworkRegStatusWatcher;
       
    42 class CDiagPluginWaitingDialogWrapper;
       
    43 class CDiagLogEventEraser;
       
    44 
       
    45 // CLASS DEFINITION  
       
    46 class CDiagDataNetworkTestPDPEngine 
       
    47     : public CDiagPDPTestEngine,
       
    48       public MDiagNetworkRegStatusObserver, 
       
    49       public MDiagLogEventEraserObserver,
       
    50       public MProgressDialogCallback
       
    51     {    
       
    52 public: 
       
    53     /**
       
    54     * Symbian OS two-phased constructor
       
    55     * @return DataNetwork Test PDP Engine
       
    56     */       
       
    57     static CDiagDataNetworkTestPDPEngine* NewL(
       
    58         MDiagDataNetworkTestCallBackInterface& aInterface);
       
    59     
       
    60     /**
       
    61     * Destructor
       
    62     */        
       
    63     ~CDiagDataNetworkTestPDPEngine();
       
    64 
       
    65 public:    
       
    66     
       
    67     /**
       
    68     * The plugin calls this function of engine to start the Data Network test
       
    69     */              
       
    70     void RunDataNetworkTestL(); 
       
    71     
       
    72     /**
       
    73     * This function return the total steps of the Data network test
       
    74     */
       
    75     static TUint TotalSteps();
       
    76 
       
    77 private: // private data-type
       
    78             
       
    79     /**
       
    80     * States of the PDP test engine
       
    81     */
       
    82     enum TPDPEngineState
       
    83         {
       
    84         EStateUnknown,                
       
    85         EStateWaitForInitialNetworkRegStatus,
       
    86         EStateCheckingConnecitonParams,
       
    87         EStateWaitForConnectionCompletion,
       
    88         EStateWaitForLogErase,
       
    89         EStateCancelTest,
       
    90         EStateWaitDialogOn,
       
    91         EStateDialogDismissed,
       
    92         EStateMax            
       
    93         };
       
    94                   
       
    95 private: // private functions
       
    96     
       
    97     /**
       
    98     * C++ default constructor.
       
    99     */        
       
   100     CDiagDataNetworkTestPDPEngine(MDiagDataNetworkTestCallBackInterface& aInterface);
       
   101     
       
   102     /**
       
   103     * Symbian OS default constructor.
       
   104     *
       
   105     */        
       
   106     void ConstructL(); 
       
   107     
       
   108     /**
       
   109     * @see CDiagPDPTestEngine::ReadAPNsFromCenrepL()
       
   110     */
       
   111     void ReadAPNsFromCenrepL(TInt& aError);
       
   112     
       
   113     
       
   114     /**
       
   115     * This function is the entry point to start establishing PDP context
       
   116     */         
       
   117     void EstablishPDPContextL();
       
   118             
       
   119     
       
   120     /**
       
   121     * @see CDiagPDPTestEngine::ReportResultToPluginL()
       
   122     */          
       
   123     void ReportResultToPluginL(TBool aResult);
       
   124     
       
   125     
       
   126     /**
       
   127     * This function is the handles the process of ongoing connection request
       
   128     */
       
   129     void HandleOngoingConnectionRequestL();    
       
   130     
       
   131     /**
       
   132     * This function starts the process of PDP establishment
       
   133     */
       
   134     void StartPdpEstablishmentL();
       
   135     
       
   136     /**
       
   137     * This function sets the state of the engine and reports the progress of the
       
   138     * test to the plugin class 
       
   139     */
       
   140     void SetStateL(TPDPEngineState aState);
       
   141     
       
   142     /**
       
   143     * This function starts the process of erasing logs.
       
   144     * 
       
   145     */
       
   146     void StartLogEraseOperationL(TBool aTestResult);
       
   147     
       
   148     /**
       
   149     * Progress Note
       
   150     *
       
   151     */
       
   152     TBool ShowProgressNoteL(TInt);
       
   153         
       
   154 private: // from CActive
       
   155     
       
   156     /**
       
   157     * Handle active object completion event
       
   158     */
       
   159     void RunL();
       
   160 
       
   161     /**
       
   162     * Handle cancel
       
   163     */
       
   164     void DoCancel();
       
   165 
       
   166 private: // from MProgressDialogCallback
       
   167         
       
   168     /**
       
   169     * Called when the progress dialog is dismissed.
       
   170     *
       
   171     * @param aButtonId - indicate which button made dialog to dismiss
       
   172     */
       
   173     virtual void DialogDismissedL( TInt aButtonId );
       
   174         
       
   175 private: // from MDiagNetworkRegStatusObserver
       
   176 
       
   177     /**
       
   178     * This function is used to inform the intial network registration status
       
   179     *
       
   180     * @param aRegistered. 
       
   181     *  ETrue :The device is currently registered on the network
       
   182     *  EFalse:The device is currently not registered on the network.
       
   183     */
       
   184     void InitialNetworkRegistrationStatusL( const TBool& aRegistered );
       
   185 
       
   186     /**
       
   187     * This interface is used to inform the clients of any changes in the network registration
       
   188     * status
       
   189     *
       
   190     * @param aRegistered
       
   191     * ETrue :The device has now changed to registered status.
       
   192     * EFalse:The device has now lost network coverage.
       
   193     */    
       
   194     void NetworkRegistrationStatusChangeL( const TBool& aRegistered );            
       
   195         
       
   196         
       
   197 private: // from MDiagLogEventEraserObserver
       
   198 
       
   199     /**
       
   200     * This callback interface is used to determine if the log event is
       
   201     * to be deleted or not.
       
   202     * @param aEvent is the event which has to be deleted
       
   203     * @return ETrue if the event is to be deleted and EFalse if the event is
       
   204     * not to be deleted
       
   205     */
       
   206     TBool IsEventToBeDeleted( const CLogEvent& aEvent );
       
   207     
       
   208     /**
       
   209     * This callback interface is used to notify that log events are erased
       
   210     */
       
   211     void CompleteEventEraseL( TInt aError );
       
   212         
       
   213         
       
   214 private: // private data
       
   215 
       
   216 
       
   217     /**
       
   218     * State of the Data network test engine
       
   219     */        
       
   220     TPDPEngineState iEngineState;       
       
   221     TPDPEngineState iPrevState;     
       
   222     
       
   223     /**
       
   224     * UTC time recorded just before starting the process of PDP connection
       
   225     * establishment. This time is used to filter the log events for deletion
       
   226     */
       
   227     TTime iStartTime;
       
   228                                   
       
   229     /**
       
   230     * Flag to remember the result of the test prior to erasing of logs
       
   231     */
       
   232     TBool iTestResult;
       
   233         
       
   234     /**
       
   235     * Callback interface used by the engine class to report the progress of the test
       
   236     * and result of the test
       
   237     */
       
   238     MDiagDataNetworkTestCallBackInterface& iInterface;
       
   239     
       
   240     
       
   241     /**
       
   242     * This index is used to store the current index of IAP array on which 
       
   243     * asynchrouns RConnection::Start() has been issued.
       
   244     */ 
       
   245     TInt iCurrentIndex;
       
   246     
       
   247     /**
       
   248     * This enum is used to store the current IAP array (primary or secondary) on which 
       
   249     * asynchrouns RConnection::Start() has been issued.        
       
   250     */
       
   251     TIapArray iCurrentArray;
       
   252     
       
   253     /**
       
   254     * For providing prefernce about how to set up the connection
       
   255     */
       
   256     TCommDbConnPref iPref;
       
   257     
       
   258     /**
       
   259     * Instance of the Diagnostics network registration status watcher
       
   260     * Owned by this class
       
   261     */
       
   262     CDiagNetworkRegStatusWatcher* iNetRegStatusWatcher;
       
   263     
       
   264     /**
       
   265     * Instance of the Diagnostics Log event eraser    
       
   266     * Owned by this class
       
   267     */
       
   268     CDiagLogEventEraser* iLogEventEraser;    
       
   269     /**
       
   270     *
       
   271     * Wait Dialog
       
   272     *
       
   273     */
       
   274     CAknWaitDialog*      iWaitDialog;
       
   275     
       
   276 	TBool idialogOn, idialogDismissed;
       
   277     };
       
   278 
       
   279 #endif //DIAGDATANETWORKTESTPDPENGINE_H
       
   280 
       
   281 // End of File