21 #define RX_BUFFER_SIZE ( 1024 ) 25 if( AfxSocketInit() ==
FALSE)
53 CString localHost(
"127.0.0.1");
60 recordErrorText( _T(
"Error calling clientSocket.Connect(localHost, 6000)" ) );
95 DWORD availableBytes = 0;
96 if(
clientSocket.IOCtl( FIONREAD, &availableBytes) == 0 )
103 if( availableBytes > 0 )
109 readSize =
clientSocket.Receive(readBuffer, availableBytes);
Physical layer implementation for a serial port.
void recordErrorText(const CString &aOperation)
Store a textual description of the last error that occurred.
virtual void close()
Close the COM port if one is in use.
static void clearLog()
Empties the packet log.
virtual bool isOpen() const
Indicate whether the port is open.
static SerialPort * sInstance
The one and only instance of this object.
static GarminLinkLayer * getInstance()
Get the one and only link layer object.
virtual bool tx(uint8 *aData, uint16 aSize)
Transmit bytes on the serial port.
uint32 mBaudRate
The last successfully applied baud rate.
virtual ~TcpIpPort()
Destructor. Close the serial port.
void resetPhysicalLayer(PhysicalLayer *aPort)
Reset the physical layer.
LinkLayer * mLinkLayer
The link layer that is one level up from this serial port.
unsigned short int uint16
16-bit unsigned integer
static bool initTcpPort()
virtual void rx(uint8 const *const aData, uint32 const aSize)=0
Receive data from the physical layer.
virtual const CString & getPortName() const
Get the name of the serial port that is open.
unsigned char uint8
8-bit unsigned integer
void setPhysicalLayer(PhysicalLayer *aPort)
Set the physical layer.
virtual void close()
Close the TCP virtual COM port if one is in use.
CString mPortName
Display name of the serial port being used for communication.
virtual bool setBaudRate(uint32 aBaudRate)
Set the baud rate.
static bool isLogOpen()
Returns true if the log file is open.
unsigned long int uint32
32-bit unsigned integer
virtual uint32 getBaudRate() const
Return the last successfully applied baud rate .
virtual void pumpRx()
Receive and process any data.