The SerXInterface is a cross-plaform serial port.
More...
#include <serxinterface.h>
|
virtual int | open (const char *pszPort, const unsigned long &dwBaudRate=9600, const Parity &parity=B_NOPARITY, const char *pszSession=0)=0 |
|
virtual int | close ()=0 |
|
virtual bool | isConnected (void) const =0 |
|
virtual int | flushTx (void)=0 |
|
virtual int | purgeTxRx (void)=0 |
|
virtual int | waitForBytesRx (const int &nNumber, const int &nTimeOutMilli)=0 |
|
virtual int | readFile (void *lpBuf, const unsigned long dwTot, unsigned long &dwRed, const unsigned long &dwTimeOut=1000)=0 |
|
virtual int | writeFile (void *lpBuf, const unsigned long &dwTot, unsigned long &dwRote)=0 |
|
virtual int | bytesWaitingRx (int &nBytesWaiting)=0 |
|
virtual void | abortTimeout () |
|
virtual bool | didAbortTimeout () const |
|
virtual void | setAbortTimeout (const bool &bYes) |
|
The SerXInterface is a cross-plaform serial port.
The SerXInterface represents a cross-platform serial port interface passed to X2 implementors. It provides X2 implementors an operating system agnostic way of using a serial port to hopefully make it easy to write X2 drivers for serial devices. Tested and works on Windows, Mac, Ubuntu Linux. Copyright (c) 2005 Software Bisque
◆ Parity
Parity
Enumerator |
---|
B_NOPARITY | No parity
|
B_ODDPARITY | Odd parity
|
B_EVENPARITY | Even parity
|
B_MARKPARITY | Mark parity
|
B_SPACEPARITY | Space parity
|
◆ abortTimeout()
virtual void SerXInterface::abortTimeout |
( |
| ) |
|
|
inlinevirtual |
Software Bisque only. For operations that may time out (WaitForBytesRx and ReadFile) calling abortTimeout will cause these operations to quickly return ERR_ABORTEDPROCESS instead of having to wait for them to time out. Implementation of timeout operations intially set this flag to false so clients don't have that responsibility
◆ bytesWaitingRx()
virtual int SerXInterface::bytesWaitingRx |
( |
int & |
nBytesWaiting | ) |
|
|
pure virtual |
Returns the number bytes in the receive port.
◆ close()
virtual int SerXInterface::close |
( |
| ) |
|
|
pure virtual |
◆ didAbortTimeout()
virtual bool SerXInterface::didAbortTimeout |
( |
| ) |
const |
|
inlinevirtual |
◆ flushTx()
virtual int SerXInterface::flushTx |
( |
void |
| ) |
|
|
pure virtual |
Force the OS to push the transmit packet out the port in case the operating system buffer's writes.
◆ isConnected()
virtual bool SerXInterface::isConnected |
( |
void |
| ) |
const |
|
pure virtual |
Returns non zero if the port is connected (open) or zero if not connected.
◆ open()
virtual int SerXInterface::open |
( |
const char * |
pszPort, |
|
|
const unsigned long & |
dwBaudRate = 9600 , |
|
|
const Parity & |
parity = B_NOPARITY , |
|
|
const char * |
pszSession = 0 |
|
) |
| |
|
pure virtual |
Open the port.
- Parameters
-
pszPort | is a string specifiing the name of the port to open. |
dwBaudRate | is optional baud rate that defaults to 9600. |
parity | is the optional parity that defaults to no parity. |
pszSession | can be used to set the data bits to something other than the default, 8 data bits. This is new to TheSkyX 10.1.11 (technically, build 4635 and later). For example, if pszSession = "-Databits 7", data bits will be set to 7 on the serial port. This argument can also be used to set the DTR, for example "-DTR_CONTROL 1" will cause DTR to be on. |
◆ purgeTxRx()
virtual int SerXInterface::purgeTxRx |
( |
void |
| ) |
|
|
pure virtual |
Purge both send and receive queues.
◆ readFile()
virtual int SerXInterface::readFile |
( |
void * |
lpBuf, |
|
|
const unsigned long |
dwTot, |
|
|
unsigned long & |
dwRed, |
|
|
const unsigned long & |
dwTimeOut = 1000 |
|
) |
| |
|
pure virtual |
Read dwTot bytes from the receive port, or timeout.
- Parameters
-
lpBuf | pointer to the data. |
dwTot | the total number of bytes to read. |
dwRed | (sic) the total number of bytes actually read. |
◆ setAbortTimeout()
virtual void SerXInterface::setAbortTimeout |
( |
const bool & |
bYes | ) |
|
|
inlinevirtual |
◆ waitForBytesRx()
virtual int SerXInterface::waitForBytesRx |
( |
const int & |
nNumber, |
|
|
const int & |
nTimeOutMilli |
|
) |
| |
|
pure virtual |
Wait for nNumber of bytes to appear in the receive port or timeout.
- Parameters
-
nNumber | number of bytes. |
nTimeOutMilli | timeout in to wait in milliseconds. |
◆ writeFile()
virtual int SerXInterface::writeFile |
( |
void * |
lpBuf, |
|
|
const unsigned long & |
dwTot, |
|
|
unsigned long & |
dwRote |
|
) |
| |
|
pure virtual |
Write dwTot bytes out the transmit port.
- Parameters
-
lpBuf | pointer to the data. |
dwTot | the total number of bytes to write. |
dwRote | (sic) the total number of bytes actually written. |
The documentation for this class was generated from the following file: