diff -r 826cea16efd9 -r 13a33d82ad98 videoutils_plat/videoconnutility_api/tsrc/VCXTestCommon/inc/TestUtilConnection.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/videoutils_plat/videoconnutility_api/tsrc/VCXTestCommon/inc/TestUtilConnection.h Wed Sep 01 12:20:37 2010 +0100 @@ -0,0 +1,160 @@ +/* +* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + + +#ifndef TESTUTILCONNECTION_H +#define TESTUTILCONNECTION_H + +#include +#include +#include +#include +#include "MTestUtilConnectionObserver.h" + +// FORWARD DECLARATIONS; +//class CCommDbOverrideSettings; + +// CONSTANTS +const TUint32 KUndefinedIAPid = 0x00; +const TUint32 KTimeout = 1000000; + +// CLASS DECLARATION + + +/** +* CTestUtilConnection Controls the internet connection initiation and shutdown +*/ +class CTestUtilConnection : public CActive + { +public: + + enum TConnectionState + { + EIdle = 0, EConnecting, EFailed, EConnected + }; + + /* + * NewL() + */ + IMPORT_C static CTestUtilConnection* NewL(MTestUtilConnectionObserver* aObserver); + + /* + * NewL() + */ + IMPORT_C static CTestUtilConnection* NewLC(MTestUtilConnectionObserver* aObserver); + + /* + * ~CTestUtilConnection() + */ + IMPORT_C virtual ~CTestUtilConnection(); + + /* + * ConnectL() + * + * Creates a connection to IAP. ASYNC. + * + */ + IMPORT_C void ConnectL(); + + /* + * TerminateConnectionL() + * + * Terminate an active connection + * + */ + IMPORT_C void TerminateConnectionL(); + + /* + * SetConnectionPreferences() + * + * Sets connection preferences + * + * Params: + * TUint aBearer Bearer type + * TUint32 aIapId IAP to be connected, default KUndefinedIAPid + * + */ + IMPORT_C void SetConnectionPreferences(TUint aBearer, TUint32 aIapId = KUndefinedIAPid); + + /* + * AttachL() + * + * Attach to active connection. + * + */ + IMPORT_C void AttachL(); + + /* + * GetState() + * + * Get connection state + * + * Params: + * + */ + IMPORT_C TConnectionState GetState(); + +protected: // from CActive + + /* + * RunL() + * + * Handle request completion events + * + */ + void RunL(); + + /* + * DoCancel() + * + * Cancel any outstanding requests + * + */ + void DoCancel(); + + // From MTestUtilConnectionObserver + +private: + + /* + * CTestUtilConnection() + */ + CTestUtilConnection(MTestUtilConnectionObserver* aObserver); + + /* + * ConstructL() + */ + void ConstructL(); + +private: + + TCommDbConnPref iPref; + + // Owns + RConnection iConnect; + RSocketServ iSocketServ; + + TRequestStatus iTimerStatus; + + TConnectionState iConnectionState; + + MTestUtilConnectionObserver* iObserver; + + }; + + +#endif // IAPCONNECT_V20ENGINE_H