dbgagents/trkagent/engine/TrkSocketCommPort.h
changeset 0 c6b0df440bee
equal deleted inserted replaced
-1:000000000000 0:c6b0df440bee
       
     1 /*
       
     2 * Copyright (c) 2004 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 #ifndef __TRKSOCKETCOMMPORT_H__
       
    20 #define __TRKSOCKETCOMMPORT_H__
       
    21 
       
    22 #include <in_sock.h>
       
    23 #include "TrkCommPort.h"
       
    24 
       
    25 
       
    26 _LIT8(KSocketComm, "[SOCKETCOMM]");
       
    27 
       
    28 //
       
    29 // class CTrkSocketCommPort
       
    30 //
       
    31 // Defines an interface to a socket type communications port
       
    32 //
       
    33 
       
    34 class CTrkSocketCommPort : public CTrkCommPort
       
    35 {
       
    36 public:
       
    37 		
       
    38 	static CTrkSocketCommPort* NewL(const TDesC& aInitFilePath, TDes& aErrorMessage);
       
    39 	~CTrkSocketCommPort();
       
    40 
       
    41 	void OpenPortL();
       
    42 	void ClosePort();
       
    43 
       
    44 	void SendDataL(const TDesC8& aBuffer);
       
    45 	void Listen(CTrkFramingLayer *aFramingLayer);
       
    46 	void StopListening();
       
    47 
       
    48 protected:
       
    49 
       
    50 	void DoCancel();
       
    51 	void RunL();
       
    52 
       
    53 private:
       
    54 
       
    55 	CTrkSocketCommPort();
       
    56 	void ConstructL(const TDesC &aInitFilePath, TDes& aErrorMessage);
       
    57 	void ConnectL();
       
    58 	void IssueReadRequest();
       
    59 
       
    60 private:
       
    61 
       
    62 	RSocket iSocket;
       
    63 	RSocketServ iSocketServ;
       
    64 
       
    65 	TBool iConnected;
       
    66 	TBool iListening;
       
    67 
       
    68 	TBuf8<MAXMESSAGESIZE> iReceivedChars;
       
    69 	TInt iNextReadChar;
       
    70 
       
    71 	CTrkFramingLayer* iFramingLayer;
       
    72 	
       
    73 	TInt iLineNumber;
       
    74 };
       
    75 
       
    76 #endif // __TRKSOCKETCOMMPORT_H__