devicediagnostics/diagplugins/diagpdptestengine/inc/diagpdptestengine.h
changeset 0 3ce708148e4d
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 PDP Test Engine
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef DIAGPDPTESTENGINE_H 
       
    20 #define DIAGPDPTESTENGINE_H
       
    21 
       
    22 // INCLUDES
       
    23 #include <e32base.h>
       
    24 #include <commdb.h>
       
    25 #include <cmmanager.h>                      // RCmManager
       
    26 #include <cmdestination.h>                  // RCmDestination
       
    27 #include <cmconnectionmethod.h>             // RCmConnectionMethod
       
    28 #include <es_sock.h> // for RSocketServ
       
    29 #include <es_enum.h> //for TConnectionInfoV2
       
    30 #include <commdbconnpref.h> //for TCommDbConnPref 
       
    31 #include <ApDataHandler.h> 
       
    32 
       
    33 //CONSTANTS
       
    34 
       
    35 // MACROS
       
    36 
       
    37 // DATA TYPES
       
    38 
       
    39 // FUNCTION PROTOTYPES
       
    40 
       
    41 // FORWARD DECLARATIONS
       
    42 
       
    43 
       
    44 // CLASS DEFINITION
       
    45 class CDiagPDPTestEngine : public CActive
       
    46     {
       
    47     protected:
       
    48 
       
    49         // Enumerations
       
    50             
       
    51         /**
       
    52         * This enum is used to identify primary IAP array or secondary IAP array
       
    53         */    
       
    54         enum TIapArray
       
    55             {
       
    56             EPrimaryAPNIapArray,
       
    57             ESecondaryAPNIapArray        
       
    58             };
       
    59             
       
    60         /**
       
    61         * C++ default constructor.
       
    62         */    
       
    63         CDiagPDPTestEngine();
       
    64         
       
    65         /**
       
    66         * C++ default virtual destructor.
       
    67         */    
       
    68         virtual ~CDiagPDPTestEngine();        
       
    69         
       
    70         /**
       
    71         * Any derived PDP engine must provide a concrete implementation of this function
       
    72         * and read the APNs from the cenrep in this function.
       
    73         * If function is able to read APNs successfully, argument aError is set as KErrNone
       
    74         */       
       
    75         virtual void ReadAPNsFromCenrepL(TInt& aError) = 0;
       
    76         
       
    77         /**
       
    78         * This function checks if the APNs read from the cenrep are visible and available to the 
       
    79         * Connection manager. After calling this function, the arrays iPrimaryAPNIapIdArray and
       
    80         * iSecondaryAPNIapIdArray contain the IAP Ids of Access Points which match the primary and
       
    81         * secondary APNs. It returns EFalse, if both the arrays are still empty, else it returns ETrue.
       
    82         */ 
       
    83         TBool CheckAPNsInConnectionManagerL();
       
    84         
       
    85         /**
       
    86         * This function checks the provided connection methods and checks if it matches the primary or
       
    87         * secondary APN. If so it adds the IAP ids of the connection method to the Primary or secondary 
       
    88         * IAP array.
       
    89         */
       
    90         void  CheckConnectionMatchL( const RCmConnectionMethod& aMethod);
       
    91         
       
    92         /**
       
    93         * This function returns ETrue if an already active connection is found using the IAP ids which
       
    94         * match with the APNs in primary or secondary IAP array, else return EFalse
       
    95         */
       
    96         TBool FindActiveConnectionsL();
       
    97     
       
    98     protected:    // from CActive
       
    99         /**
       
   100         * Handle active object completion event
       
   101         */
       
   102         void RunL();
       
   103     
       
   104         /**
       
   105         * Handle cancel
       
   106         */
       
   107         void DoCancel();
       
   108             
       
   109     protected:               
       
   110                
       
   111         // buffer to read the APNs from cenrep
       
   112         TBuf<KCommsDbSvrMaxFieldLength> iCenrepPrimaryAPN;
       
   113         TBuf<KCommsDbSvrMaxFieldLength> iCenrepSecondaryAPN;
       
   114         
       
   115         // arrays to hold the IAP Ids which have APNs as specified in the cenrep
       
   116         RArray<TUint32> iPrimaryAPNIapIdArray;
       
   117         RArray<TUint32> iSecondaryAPNIapIdArray;
       
   118         TUint32 iIAPiddefault;
       
   119         // used for iterating through active connections and establishing PDP context
       
   120         RSocketServ iSocketServ;
       
   121         RConnection iConnection;
       
   122     
       
   123     };
       
   124 
       
   125 #endif //DIAGPDPTESTENGINE_H
       
   126 
       
   127 // End of File