Aria
2.8.0
|
Utility for connecting to and communicating with devices through a serial port. More...
#include <ArSerialConnection.h>
Inherits ArDeviceConnection.
Public Types | |
enum | Open { OPEN_COULD_NOT_OPEN_PORT = 1, OPEN_COULD_NOT_SET_UP_PORT, OPEN_INVALID_BAUD_RATE, OPEN_COULD_NOT_SET_BAUD, OPEN_ALREADY_OPEN } |
Public Types inherited from ArDeviceConnection | |
enum | Status { STATUS_NEVER_OPENED = 1, STATUS_OPEN, STATUS_OPEN_FAILED, STATUS_CLOSED_NORMALLY, STATUS_CLOSED_ERROR } |
Public Member Functions | |
ArSerialConnection (bool is422=false) | |
Constructor. | |
virtual bool | close (void) |
int | getBaud (void) |
Gets what the current baud rate is set to. More... | |
bool | getCTS (void) |
Sees how the CTS line is set (true = high) | |
bool | getDCD (void) |
Sees how the DCD line is set (true = high) | |
bool | getDSR (void) |
Sees how the DSR line is set (true = high) | |
bool | getHardwareControl (void) |
Gets whether the hardware control lines are enabled or disabled. More... | |
virtual const char * | getOpenMessage (int messageNumber) |
const char * | getPort (void) |
Gets the port this is using. More... | |
bool | getRing (void) |
Sees how the Ring line is set (true = high) | |
virtual int | getStatus (void) |
virtual ArTime | getTimeRead (int index) |
int | internalOpen (void) |
virtual bool | isTimeStamping (void) |
int | open (const char *port=NULL) |
Opens the serial port. More... | |
virtual bool | openSimple (void) |
virtual int | read (const char *data, unsigned int size, unsigned int msWait=0) |
bool | setBaud (int baud) |
Sets the BAUD rate to use when connection is opened, or change the baud rate if already opened. More... | |
bool | setHardwareControl (bool hardwareControl) |
Sets whether to enable or disable the hardware control lines. More... | |
void | setPort (const char *port=NULL) |
Sets the port this connection will use. More... | |
virtual int | write (const char *data, unsigned int size) |
virtual | ~ArSerialConnection () |
Destructor also closes the connection. | |
Public Member Functions inherited from ArDeviceConnection | |
ArDeviceConnection () | |
constructor More... | |
void | debugBytesRead (int bytesRead) |
Notifies the device connection that some bytes were read (should call with 0 if it read but got no bytes) | |
void | debugEndPacket (bool goodPacket, int type=0) |
Notifies the device connection that the end of a packet was read, which will cause log messages if set to do so. | |
void | debugStartPacket (void) |
Notifies the device connection that the start of a packet is trying to be read. | |
const char * | getDeviceName (void) const |
Gets the device type (what this is connecting to) | |
const char * | getPortName (void) const |
Gets the port name. | |
const char * | getPortType (void) const |
Gets the port type. | |
const char * | getStatusMessage (int messageNumber) const |
Gets the description string associated with the status. More... | |
void | setDeviceName (const char *deviceName) |
Sets the device type (what this is connecting to) | |
virtual int | writePacket (ArBasePacket *packet) |
Writes data to connection. More... | |
virtual | ~ArDeviceConnection () |
destructor also forces a close on the connection | |
Protected Member Functions | |
int | baudToRate (int baud) |
void | buildStrMap (void) |
int | rateToBaud (int rate) |
void | startTimeStamping (void) |
Protected Member Functions inherited from ArDeviceConnection | |
void | buildStrMap (void) |
void | setPortName (const char *portName) |
Sets the port name. | |
void | setPortType (const char *portType) |
Sets the port type. | |
Protected Attributes | |
int | myBaudRate |
bool | myHardwareControl |
bool | myIs422 |
int | myPort |
std::string | myPortName |
int | myStatus |
ArStrMap | myStrMap |
bool | myTakingTimeStamps |
Protected Attributes inherited from ArDeviceConnection | |
int | myDCDebugBytesRead |
ArTime | myDCDebugFirstByteTime |
ArTime | myDCDebugLastByteTime |
long long | myDCDebugNumBadPackets |
long long | myDCDebugNumGoodPackets |
bool | myDCDebugPacketStarted |
ArTime | myDCDebugStartTime |
int | myDCDebugTimesRead |
std::string | myDCDeviceName |
std::string | myDCPortName |
std::string | myDCPortType |
Additional Inherited Members | |
Static Public Member Functions inherited from ArDeviceConnection | |
static bool | debugShouldLog (bool shouldLog) |
Makes all device connections so that they'll dump data. | |
Static Protected Attributes inherited from ArDeviceConnection | |
static ArTime | ourDCDebugFirstTime |
static bool | ourDCDebugShouldLog = false |
static ArStrMap | ourStrMap |
static bool | ourStrMapInited = false |
Utility for connecting to and communicating with devices through a serial port.
int ArSerialConnection::getBaud | ( | void | ) |
Gets what the current baud rate is set to.
bool ArSerialConnection::getHardwareControl | ( | void | ) |
Gets whether the hardware control lines are enabled or disabled.
const char * ArSerialConnection::getPort | ( | void | ) |
Gets the port this is using.
int ArSerialConnection::open | ( | const char * | port = NULL | ) |
Opens the serial port.
port | The serial port to connect to, or NULL which defaults to COM1 for windows and /dev/ttyS0 for linux |
bool ArSerialConnection::setBaud | ( | int | baud | ) |
Sets the BAUD rate to use when connection is opened, or change the baud rate if already opened.
baud | the baud rate to set the connection to |
bool ArSerialConnection::setHardwareControl | ( | bool | hardwareControl | ) |
Sets whether to enable or disable the hardware control lines.
hardwareControl | true to enable hardware control of lines |
void ArSerialConnection::setPort | ( | const char * | port = NULL | ) |
Sets the port this connection will use.
port | The serial port to connect to, or NULL which defaults to COM1 for windows and /dev/ttyS0 for linux |
port | The serial port to connect to, or NULL which defaults to COM1 for windows and /dev/ttyS0 for linux |