testexecfw/statsrv/device/source/statapi/inc/activeconnection.h
changeset 0 3e07fef1e154
equal deleted inserted replaced
-1:000000000000 0:3e07fef1e154
       
     1 /*
       
     2 * Copyright (c) 2005-2009 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: 
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #include <e32base.h> 
       
    21 #include <in_sock.h>
       
    22 #include <commdbconnpref.h>
       
    23 #include <commdb.h>
       
    24 
       
    25 //micro seconds to wait before attempting to connect
       
    26 //to allow NTRAS connection to be initialised (2 sec)
       
    27 #define KDelay 2000000
       
    28 
       
    29 class CActiveConnection : public CActive
       
    30 	{
       
    31 public:
       
    32 	enum TActiveConnectionMode { EModeIAP, EModeSnap };
       
    33 	 // Construction
       
    34 	static CActiveConnection* NewL(const TDesC& ipAddress, TInt port);
       
    35 	 // Destruction
       
    36 	~CActiveConnection();
       
    37 	void Start(TActiveConnectionMode aConnMode = EModeIAP, TInt aConnIndex = 0);
       
    38 	void DoCancel();
       
    39 	void CloseSocket();
       
    40 
       
    41 private:
       
    42 	CActiveConnection();
       
    43 	void ConstructL(const TDesC& ipAddress, TInt port);
       
    44 	void RunL();
       
    45 	void Connect(TActiveConnectionMode aConnMode = EModeIAP, TInt aConnIndex = 0);
       
    46 
       
    47 private:
       
    48 	RSocketServ iSocketServer;
       
    49 	RSocket iSocket; 
       
    50 	TInetAddr iDstAddr;
       
    51 	};