Garmin Fleet Management Controller  2.19.0
TcpIpPort.h
Go to the documentation of this file.
1 /*********************************************************************
2 *
3 * HEADER NAME:
4 * TcpIpPort.h
5 *
6 * Copyright 2016 by Garmin Ltd. or its subsidiaries.
7 *---------------------------------------------------------------------
8 * $NoKeywords$
9 *********************************************************************/
10 #ifndef TcpIpPort_H
11 #define TcpIpPort_H
12 
13 class SerialPort;
14 
15 #include <list>
16 #include <afxsock.h>
17 
18 #include "stdafx.h"
19 #include "garmin_types.h"
20 #include "TimerListener.h"
21 #include "PhysicalLayer.h"
22 #include "SerialPort.h"
23 
24 class LinkLayer;
25 
26 //----------------------------------------------------------------------
28 //----------------------------------------------------------------------
29 class TcpIpPort : protected SerialPort
30 {
31 public:
32  static bool initTcpPort();
33 
34  virtual bool setBaudRate
35  (
36  uint32 aBaudRate
37  );
38 
39  virtual uint32 getBaudRate() const;
40 
41  virtual const CString& getPortName() const;
42 
43  virtual bool isOpen() const;
44 
45  virtual bool tx
46  (
47  uint8 * aData,
48  uint16 aSize
49  );
50 
51 protected:
52  TcpIpPort();
53  virtual ~TcpIpPort();
54 
55  bool init();
56 
57  virtual void pumpRx();
58 
59  virtual void close();
60 
61 private:
62 
64  CString mPortName;
65 
68 
69  CSocket clientSocket;
70 
72 };
73 
74 #endif
Physical layer implementation for a serial port.
Definition: TcpIpPort.h:29
TcpIpPort()
Constructor.
Definition: TcpIpPort.cpp:68
virtual bool isOpen() const
Indicate whether the port is open.
Definition: TcpIpPort.cpp:176
virtual bool tx(uint8 *aData, uint16 aSize)
Transmit bytes on the serial port.
Definition: TcpIpPort.cpp:141
Abstract base class for link Layers in the OSI model.
Definition: LinkLayer.h:26
bool init()
Definition: TcpIpPort.cpp:48
uint32 mBaudRate
The last successfully applied baud rate.
Definition: TcpIpPort.h:67
virtual ~TcpIpPort()
Destructor. Close the serial port.
Definition: TcpIpPort.cpp:75
bool socketIsOpen
Definition: TcpIpPort.h:71
unsigned short int uint16
16-bit unsigned integer
Definition: garmin_types.h:64
static bool initTcpPort()
Definition: TcpIpPort.cpp:23
virtual const CString & getPortName() const
Get the name of the serial port that is open.
Definition: TcpIpPort.cpp:167
unsigned char uint8
8-bit unsigned integer
Definition: garmin_types.h:62
virtual void close()
Close the TCP virtual COM port if one is in use.
Definition: TcpIpPort.cpp:125
CString mPortName
Display name of the serial port being used for communication.
Definition: TcpIpPort.h:64
virtual bool setBaudRate(uint32 aBaudRate)
Set the baud rate.
Definition: TcpIpPort.cpp:187
unsigned long int uint32
32-bit unsigned integer
Definition: garmin_types.h:66
CSocket clientSocket
Definition: TcpIpPort.h:69
Physical layer implementation for a serial port.
Definition: SerialPort.h:30
virtual uint32 getBaudRate() const
Return the last successfully applied baud rate .
Definition: TcpIpPort.cpp:198
virtual void pumpRx()
Receive and process any data.
Definition: TcpIpPort.cpp:87