Garmin Fleet Management Controller
2.19.0
|
Physical layer implementation for a serial port. More...
#include <TcpIpPort.h>
Public Member Functions | |
virtual uint32 | getBaudRate () const |
Return the last successfully applied baud rate . More... | |
virtual const CString & | getPortName () const |
Get the name of the serial port that is open. More... | |
virtual bool | isOpen () const |
Indicate whether the port is open. More... | |
virtual bool | setBaudRate (uint32 aBaudRate) |
Set the baud rate. More... | |
virtual bool | tx (uint8 *aData, uint16 aSize) |
Transmit bytes on the serial port. More... | |
Static Public Member Functions | |
static bool | initTcpPort () |
Protected Member Functions | |
TcpIpPort () | |
Constructor. More... | |
virtual | ~TcpIpPort () |
Destructor. Close the serial port. More... | |
virtual void | close () |
Close the TCP virtual COM port if one is in use. More... | |
const CString & | getLastError () const |
Return a description of the last error that occurred. More... | |
bool | init (const CString &aPortName) |
Initializes the port passed in. More... | |
bool | init () |
void | onTimer () |
Timer callback. More... | |
virtual void | pumpRx () |
Receive and process any data. More... | |
void | recordErrorText (const CString &aOperation) |
Store a textual description of the last error that occurred. More... | |
virtual void | setLinkLayer (LinkLayer *aLinkLayer) |
Change the link layer that receives bytes from this SerialPort. More... | |
Static Protected Member Functions | |
static void | destroyInstance () |
Destroy the one and only serial port object. More... | |
static SerialPort * | getInstance () |
Get the one and only serial port object. More... | |
static void | getPortList (std::list< CString > &aList) |
Get the list of serial ports. More... | |
static void | getPortListEnum (std::list< CString > &aList) |
Find the COM ports on the system by opening each in turn. More... | |
static bool | getPortListFromRegistry (std::list< CString > &aList) |
Get the list of com ports on the system by enumerating the device map in the Windows registry. More... | |
static bool | initSerialPort (const CString &aPortName) |
Initializes the port passed in. More... | |
Protected Attributes | |
LinkLayer * | mLinkLayer |
The link layer that is one level up from this serial port. More... | |
Static Protected Attributes | |
static SerialPort * | sInstance = NULL |
The one and only instance of this object. More... | |
Private Attributes | |
CSocket | clientSocket |
uint32 | mBaudRate |
The last successfully applied baud rate. More... | |
CString | mPortName |
Display name of the serial port being used for communication. More... | |
bool | socketIsOpen |
Physical layer implementation for a serial port.
Definition at line 29 of file TcpIpPort.h.
|
protected |
|
protectedvirtual |
Destructor. Close the serial port.
Definition at line 75 of file TcpIpPort.cpp.
References close(), PhysicalLayer::mLinkLayer, and LinkLayer::setPhysicalLayer().
|
protectedvirtual |
Close the TCP virtual COM port if one is in use.
Reimplemented from SerialPort.
Definition at line 125 of file TcpIpPort.cpp.
References clientSocket, isOpen(), socketIsOpen, and tx().
Referenced by pumpRx(), tx(), and ~TcpIpPort().
|
staticinherited |
Destroy the one and only serial port object.
Definition at line 50 of file SerialPort.cpp.
References SerialPort::sInstance.
Referenced by SerialPort::getInstance().
|
virtual |
Return the last successfully applied baud rate .
Reimplemented from SerialPort.
Definition at line 198 of file TcpIpPort.cpp.
References mBaudRate.
|
staticinherited |
Get the one and only serial port object.
Definition at line 36 of file SerialPort.cpp.
References SerialPort::destroyInstance(), SerialPort::SerialPort(), and SerialPort::sInstance.
Referenced by GarminLinkLayer::GarminLinkLayer(), SerialPort::getPortListEnum(), CSelectCommPortDlg::OnBnClickedOk(), CLogViewerDlg::OnLbnSelchangeLog(), FmiApplicationLayer::rx(), and CFmiPcAppDlg::tryNextCommRate().
|
inherited |
Return a description of the last error that occurred.
Definition at line 423 of file SerialPort.cpp.
References SerialPort::mLastErrorText.
|
staticinherited |
Get the list of serial ports.
aList | The list to store the port names. |
Definition at line 60 of file SerialPort.cpp.
References SerialPort::getPortListEnum(), SerialPort::getPortListFromRegistry(), and TCP_PORT_NAME.
Referenced by CSelectCommPortDlg::OnInitDialog().
|
staticprotectedinherited |
Find the COM ports on the system by opening each in turn.
aList | The list to append port names to. |
Definition at line 382 of file SerialPort.cpp.
References SerialPort::close(), and SerialPort::getInstance().
Referenced by SerialPort::getPortList(), and SerialPort::getPortListFromRegistry().
|
staticprotectedinherited |
Get the list of com ports on the system by enumerating the device map in the Windows registry.
aList | The list of port names to append to |
Definition at line 293 of file SerialPort.cpp.
References SerialPort::getPortListEnum().
Referenced by SerialPort::getPortList(), and SerialPort::tx().
|
virtual |
Get the name of the serial port that is open.
Reimplemented from SerialPort.
Definition at line 167 of file TcpIpPort.cpp.
References mPortName.
|
inherited |
Initializes the port passed in.
port | Null-terminated string containing the friendly name of the port (e.g., "COM1") |
Definition at line 124 of file SerialPort.cpp.
References SerialPort::close(), DEFAULT_BAUD_RATE, SerialPort::mComPortHandle, SerialPort::mPortName, SerialPort::recordErrorText(), RX_QUEUE_SIZE, SerialPort::setBaudRate(), and TX_QUEUE_SIZE.
Referenced by SerialPort::initSerialPort().
|
protected |
Definition at line 48 of file TcpIpPort.cpp.
References clientSocket, SerialPort::recordErrorText(), and socketIsOpen.
|
staticinherited |
Initializes the port passed in.
port | Null-terminated string containing the friendly name of the port (e.g., "COM1") |
Definition at line 96 of file SerialPort.cpp.
References Logger::clearLog(), SerialPort::close(), GarminLinkLayer::getInstance(), SerialPort::init(), Logger::isLogOpen(), GarminLinkLayer::resetPhysicalLayer(), SerialPort::SerialPort(), and SerialPort::sInstance.
Referenced by CSelectCommPortDlg::OnBnClickedOk(), and SerialPort::SerialPort().
|
static |
Definition at line 23 of file TcpIpPort.cpp.
References Logger::clearLog(), SerialPort::close(), FALSE, GarminLinkLayer::getInstance(), Logger::isLogOpen(), SerialPort::recordErrorText(), GarminLinkLayer::resetPhysicalLayer(), SerialPort::sInstance, and TcpIpPort().
Referenced by CSelectCommPortDlg::OnBnClickedOk().
|
virtual |
Indicate whether the port is open.
Reimplemented from SerialPort.
Definition at line 176 of file TcpIpPort.cpp.
References setBaudRate(), and socketIsOpen.
Referenced by close().
|
virtualinherited |
Timer callback.
If the serial port is open, receive (and process) anything that is ready to receive.
Implements TimerListener.
Definition at line 433 of file SerialPort.cpp.
References SerialPort::isOpen(), and SerialPort::pumpRx().
|
protectedvirtual |
Receive and process any data.
Reimplemented from SerialPort.
Definition at line 87 of file TcpIpPort.cpp.
References clientSocket, close(), PhysicalLayer::mLinkLayer, SerialPort::recordErrorText(), LinkLayer::rx(), RX_BUFFER_SIZE, and socketIsOpen.
|
protectedinherited |
Store a textual description of the last error that occurred.
aOperation | The name of the operation that caused the error |
Definition at line 456 of file SerialPort.cpp.
References SerialPort::mLastErrorText.
Referenced by SerialPort::init(), init(), initTcpPort(), pumpRx(), SerialPort::setBaudRate(), tx(), and SerialPort::~SerialPort().
|
virtual |
Set the baud rate.
aBaudRate | The new baud rate for the port, in bps. \ |
Reimplemented from SerialPort.
Definition at line 187 of file TcpIpPort.cpp.
References mBaudRate.
Referenced by isOpen().
|
virtualinherited |
Change the link layer that receives bytes from this SerialPort.
aLinkLayer | The LinkLayer object that receives bytes, or NULL if no LinkLayer should receive data from this port. |
Definition at line 19 of file PhysicalLayer.cpp.
References PhysicalLayer::mLinkLayer.
Referenced by GarminLinkLayer::GarminLinkLayer(), GarminLinkLayer::resetPhysicalLayer(), and LinkLayer::~LinkLayer().
Transmit bytes on the serial port.
aData | The bytes to transmit |
aSize | The number of bytes to transmit |
Reimplemented from SerialPort.
Definition at line 141 of file TcpIpPort.cpp.
References clientSocket, close(), SerialPort::recordErrorText(), and socketIsOpen.
Referenced by close().
|
private |
|
private |
The last successfully applied baud rate.
Definition at line 67 of file TcpIpPort.h.
Referenced by getBaudRate(), and setBaudRate().
|
protectedinherited |
The link layer that is one level up from this serial port.
Definition at line 47 of file PhysicalLayer.h.
Referenced by pumpRx(), SerialPort::pumpRx(), SerialPort::SerialPort(), PhysicalLayer::setLinkLayer(), SerialPort::~SerialPort(), and ~TcpIpPort().
|
private |
Display name of the serial port being used for communication.
Definition at line 64 of file TcpIpPort.h.
Referenced by getPortName().
|
staticprotectedinherited |
The one and only instance of this object.
Definition at line 95 of file SerialPort.h.
Referenced by SerialPort::destroyInstance(), SerialPort::getInstance(), SerialPort::initSerialPort(), and initTcpPort().
|
private |