devicediagnostics/diagplugins/diagdatanetworkplugin/inc/diagdatanetworktestpdpengine.h
branchRCL_3
changeset 25 5b858729772b
equal deleted inserted replaced
24:6757f1e2efd2 25:5b858729772b
       
     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 if RunL leaves
       
   163     */
       
   164     TInt RunError( TInt aError );
       
   165 
       
   166     /**
       
   167     * Handle cancel
       
   168     */
       
   169     void DoCancel();
       
   170 
       
   171 private: // from MProgressDialogCallback
       
   172         
       
   173     /**
       
   174     * Called when the progress dialog is dismissed.
       
   175     *
       
   176     * @param aButtonId - indicate which button made dialog to dismiss
       
   177     */
       
   178     virtual void DialogDismissedL( TInt aButtonId );
       
   179         
       
   180 private: // from MDiagNetworkRegStatusObserver
       
   181 
       
   182     /**
       
   183     * This function is used to inform the intial network registration status
       
   184     *
       
   185     * @param aRegistered. 
       
   186     *  ETrue :The device is currently registered on the network
       
   187     *  EFalse:The device is currently not registered on the network.
       
   188     */
       
   189     void InitialNetworkRegistrationStatusL( const TBool& aRegistered );
       
   190 
       
   191     /**
       
   192     * This interface is used to inform the clients of any changes in the network registration
       
   193     * status
       
   194     *
       
   195     * @param aRegistered
       
   196     * ETrue :The device has now changed to registered status.
       
   197     * EFalse:The device has now lost network coverage.
       
   198     */    
       
   199     void NetworkRegistrationStatusChangeL( const TBool& aRegistered );            
       
   200         
       
   201         
       
   202 private: // from MDiagLogEventEraserObserver
       
   203 
       
   204     /**
       
   205     * This callback interface is used to determine if the log event is
       
   206     * to be deleted or not.
       
   207     * @param aEvent is the event which has to be deleted
       
   208     * @return ETrue if the event is to be deleted and EFalse if the event is
       
   209     * not to be deleted
       
   210     */
       
   211     TBool IsEventToBeDeleted( const CLogEvent& aEvent );
       
   212     
       
   213     /**
       
   214     * This callback interface is used to notify that log events are erased
       
   215     */
       
   216     void CompleteEventEraseL( TInt aError );
       
   217         
       
   218         
       
   219 private: // private data
       
   220 
       
   221 
       
   222     /**
       
   223     * State of the Data network test engine
       
   224     */        
       
   225     TPDPEngineState iEngineState;       
       
   226     TPDPEngineState iPrevState;     
       
   227     
       
   228     /**
       
   229     * UTC time recorded just before starting the process of PDP connection
       
   230     * establishment. This time is used to filter the log events for deletion
       
   231     */
       
   232     TTime iStartTime;
       
   233                                   
       
   234     /**
       
   235     * Flag to remember the result of the test prior to erasing of logs
       
   236     */
       
   237     TBool iTestResult;
       
   238         
       
   239     /**
       
   240     * Callback interface used by the engine class to report the progress of the test
       
   241     * and result of the test
       
   242     */
       
   243     MDiagDataNetworkTestCallBackInterface& iInterface;
       
   244     
       
   245     
       
   246     /**
       
   247     * This index is used to store the current index of IAP array on which 
       
   248     * asynchrouns RConnection::Start() has been issued.
       
   249     */ 
       
   250     TInt iCurrentIndex;
       
   251     
       
   252     /**
       
   253     * This enum is used to store the current IAP array (primary or secondary) on which 
       
   254     * asynchrouns RConnection::Start() has been issued.        
       
   255     */
       
   256     TIapArray iCurrentArray;
       
   257     
       
   258     /**
       
   259     * For providing prefernce about how to set up the connection
       
   260     */
       
   261     TCommDbConnPref iPref;
       
   262     
       
   263     /**
       
   264     * Instance of the Diagnostics network registration status watcher
       
   265     * Owned by this class
       
   266     */
       
   267     CDiagNetworkRegStatusWatcher* iNetRegStatusWatcher;
       
   268     
       
   269     /**
       
   270     * Instance of the Diagnostics Log event eraser    
       
   271     * Owned by this class
       
   272     */
       
   273     CDiagLogEventEraser* iLogEventEraser;    
       
   274     /**
       
   275     *
       
   276     * Wait Dialog
       
   277     *
       
   278     */
       
   279     CAknWaitDialog*      iWaitDialog;
       
   280     
       
   281 	TBool idialogOn, idialogDismissed;
       
   282     };
       
   283 
       
   284 #endif //DIAGDATANETWORKTESTPDPENGINE_H
       
   285 
       
   286 // End of File