dbgagents/trkagent/engine/TrkSerialCommPort.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 __TRKSERIALCOMMPORT_H__
       
    20 #define __TRKSERIALCOMMPORT_H__
       
    21 
       
    22 #include <c32comm.h>
       
    23 #include "TrkCommPort.h"
       
    24 
       
    25 
       
    26 //
       
    27 // class CTrkSerialCommPort
       
    28 //
       
    29 // Defines an interface to a serial type communications port
       
    30 //
       
    31 class CTrkSerialCommPort : public CTrkCommPort
       
    32 {
       
    33 public:
       
    34 
       
    35 	static CTrkSerialCommPort* NewL(TTrkConnData& aTrkConnData, TDes& aErrorMessage);
       
    36 	~CTrkSerialCommPort();
       
    37 
       
    38 	void OpenPortL();
       
    39 	void ClosePort();
       
    40 
       
    41 	void SendDataL(const TDesC8& aData);
       
    42 	void Listen(CTrkFramingLayer *aFramingLayer);
       
    43 	void StopListening();
       
    44 	
       
    45 protected:
       
    46 
       
    47 	void DoCancel();
       
    48 	void RunL();
       
    49 
       
    50 private:
       
    51 
       
    52 	CTrkSerialCommPort();
       
    53 	void ConstructL(TTrkConnData& aTrkConnData, TDes& aErrorMessage);
       
    54 	void IssueReadRequest();
       
    55 	void ReportAndLeaveIfErrorL(TInt aError, const TDesC& aDesc);
       
    56 	void PrintMessage(const TDesC8& aPrefix, const TDesC8& aBinaryData) const;
       
    57 	
       
    58 private:
       
    59 
       
    60 	TBuf<32> iPDD;
       
    61 	TBuf<32> iPDD2;
       
    62 	TBuf<32> iLDD;
       
    63 	TBuf<32> iCSY;
       
    64 	TUint iUnitNumber;
       
    65 	TUint iRate;
       
    66 
       
    67 	RCommServ iServer;
       
    68 	RComm  iPort;
       
    69 
       
    70 	TBool iServerStarted;
       
    71 	TBool iConnected;
       
    72 	TBool iListening;
       
    73 
       
    74 	TBuf8<MAXMESSAGESIZE> iReceivedChars;
       
    75 	TInt iNextReadChar;
       
    76 
       
    77 	CTrkFramingLayer* iFramingLayer;
       
    78 	
       
    79 	TInt iLineNumber;
       
    80 };
       
    81 
       
    82 #endif // __TRKSERIALCOMMPORT_H__