videoutils_plat/videoconnutility_api/tsrc/VCXTestCommon/inc/TestUtilConnection.h
branchRCL_3
changeset 23 13a33d82ad98
parent 0 822a42b6c3f1
equal deleted inserted replaced
22:826cea16efd9 23:13a33d82ad98
       
     1 /*
       
     2 * Copyright (c) 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 the License "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: 
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef TESTUTILCONNECTION_H
       
    20 #define TESTUTILCONNECTION_H
       
    21 
       
    22 #include <e32base.h>
       
    23 #include <CommDbConnPref.h>
       
    24 #include <es_sock.h>
       
    25 #include <e32std.h>
       
    26 #include "MTestUtilConnectionObserver.h"
       
    27 
       
    28 // FORWARD DECLARATIONS;
       
    29 //class CCommDbOverrideSettings;
       
    30 
       
    31 // CONSTANTS
       
    32 const TUint32 KUndefinedIAPid = 0x00;
       
    33 const TUint32 KTimeout = 1000000;
       
    34 
       
    35 // CLASS DECLARATION
       
    36 
       
    37 
       
    38 /**
       
    39 * CTestUtilConnection  Controls the internet connection initiation and shutdown
       
    40 */
       
    41 class CTestUtilConnection : public CActive
       
    42     {
       
    43 public:
       
    44 
       
    45     enum TConnectionState
       
    46     	{
       
    47     	EIdle = 0, EConnecting, EFailed, EConnected
       
    48     	};
       
    49 
       
    50     /*
       
    51      * NewL()
       
    52      */
       
    53     IMPORT_C static CTestUtilConnection* NewL(MTestUtilConnectionObserver* aObserver);
       
    54 
       
    55     /*
       
    56      * NewL()
       
    57      */
       
    58     IMPORT_C static CTestUtilConnection* NewLC(MTestUtilConnectionObserver* aObserver);
       
    59 
       
    60     /*
       
    61      * ~CTestUtilConnection()
       
    62      */
       
    63     IMPORT_C virtual ~CTestUtilConnection();
       
    64 
       
    65     /*
       
    66      * ConnectL()
       
    67      *
       
    68      * Creates a connection to IAP. ASYNC.
       
    69      *
       
    70      */
       
    71     IMPORT_C void ConnectL();
       
    72 
       
    73     /*
       
    74      * TerminateConnectionL()
       
    75      *
       
    76      * Terminate an active connection
       
    77      *
       
    78      */
       
    79     IMPORT_C void TerminateConnectionL();
       
    80 
       
    81     /*
       
    82      * SetConnectionPreferences()
       
    83      *
       
    84      * Sets connection preferences
       
    85      *
       
    86      * Params:
       
    87      * TUint aBearer    Bearer type
       
    88      * TUint32 aIapId   IAP to be connected, default KUndefinedIAPid
       
    89      *
       
    90      */
       
    91     IMPORT_C void SetConnectionPreferences(TUint aBearer, TUint32 aIapId = KUndefinedIAPid);
       
    92 
       
    93     /*
       
    94      * AttachL()
       
    95      *
       
    96      * Attach to active connection.
       
    97      *
       
    98      */
       
    99     IMPORT_C void AttachL();
       
   100 
       
   101     /*
       
   102      * GetState()
       
   103      *
       
   104      * Get connection state
       
   105      *
       
   106      * Params:
       
   107      *
       
   108      */
       
   109     IMPORT_C TConnectionState GetState();
       
   110 
       
   111 protected: // from CActive
       
   112 
       
   113     /*
       
   114      * RunL()
       
   115      *
       
   116      * Handle request completion events
       
   117      *
       
   118      */
       
   119     void RunL();
       
   120 
       
   121     /*
       
   122      * DoCancel()
       
   123      *
       
   124      * Cancel any outstanding requests
       
   125      *
       
   126      */
       
   127     void DoCancel();
       
   128 
       
   129     // From MTestUtilConnectionObserver
       
   130 
       
   131 private:
       
   132 
       
   133     /*
       
   134      * CTestUtilConnection()
       
   135      */
       
   136     CTestUtilConnection(MTestUtilConnectionObserver* aObserver);
       
   137 
       
   138     /*
       
   139      * ConstructL()
       
   140      */
       
   141     void ConstructL();
       
   142 
       
   143 private:
       
   144 
       
   145     TCommDbConnPref iPref;
       
   146 
       
   147     // Owns
       
   148     RConnection iConnect;
       
   149     RSocketServ iSocketServ;
       
   150 
       
   151     TRequestStatus iTimerStatus;
       
   152 
       
   153     TConnectionState iConnectionState;
       
   154 
       
   155     MTestUtilConnectionObserver* iObserver;
       
   156 
       
   157     };
       
   158 
       
   159 
       
   160 #endif // IAPCONNECT_V20ENGINE_H