The Connection object that is used for communication.
static Connection Serial( |
| ) |
A static function for creating a Connection object with a <SerialConnection> implementation. A connection with the specified port will be established.
port const std::string& | The actual string name of the COM port (ex. "COM26") |
baudRate uint32 | The baud rate at which to open the COM port (default of 921600) |
A Connection object created with a <SerialConnection> implementation.
Error_InvalidSerialPort: the specified com port is invalid
Error_Connection: failed to get or set com port parameters
static Connection TcpIp( |
| ) |
A static function for creating a Connection object with a <TcpIpConnection> implementation. A connection with the specified address/port will be established.
serverAddress const std::string& | The server address (domain name or ip address) to connect to. |
serverPort uint16 | The server port to connect to. |
A Connection object created with a <TcpIpConnection> implementation.
Error_InvalidTcpServer: the specified server address and/or server port is invalid.
static Connection UnixSocket( |
| ) |
A generator function for Connection objects with a <UnixSocketConnection> implementation (Unix builds only). A connection with the specified path will be established.
path const std::string& | The a path to the unix socket |
The generated Connection object.
Error_InvalidUnixSocket: failed to connect to the specified unix socket path.
Gets a description of the connection as a string.
A description of the connection.
Closes the current connection.
Reopens a connection that has been disconnected.
Error_InvalidSerialPort | the specified com port is invalid. |
Error_InvalidTcpServer | the specified server address and/or server port is invalid. |
Error_InvalidUnixSocket | failed to connect to the specified unix socket path. |
Error_Connection | failed to get or set com port parameters |
void write( |
| ) |
Writes the given bytes to the connection.
bytes const Bytes& | The bytes to write. |
Error_Connection: a connection error has occurred, such as the device being unplugged.
void writeStr( |
| ) |
Writes the given string (containing bytes) to the connection.
bytes const std::string& | The string of bytes to write. |
Error_Connection: a connection error has occurred, such as the device being unplugged.
void rawByteMode( |
| ) |
Puts the connection into "Raw Byte Mode." "Raw Byte Mode" stops the data from being sent/parsed from any attached devices (BaseStation, InertialNode, etc.) and instead sends all data into a raw circular data buffer that can be accessed by calling getRawBytes on this Connection object. Disabling this mode will start sending all data back to the previous attached device, if still available.
enable bool | whether to enable raw byte mode (true), or disable raw byte mode (false). |
Error_Connection: The connection has been disconnected.
Bytes getRawBytes( |
| ) |
Gets the raw bytes that are available that have been collected when the Connection is in "Raw Byte Mode." If the Connection has not been put into "Raw Byte Mode" by calling rawByteMode, no data can be retrieved from this function.
timeout uint32 | the timeout, in milliseconds, to wait for the data if necessary (default of 0). |
maxBytes uint32 | The maximum number of bytes to return. If this is 0 (default), all bytes will be returned. |
A Bytes vector containing all of the raw bytes that are available.
Error_Connection: a connection error has occurred, such as the device being unplugged.
std::string getRawBytesStr( |
| ) |
Gets the raw bytes that are available that have been collected when the Connection is in "Raw Byte Mode" as a string. If the Connection has not been put into "Raw Byte Mode" by calling rawByteMode, no data can be retrieved from this function.
timeout uint32 | the timeout, in milliseconds, to wait for the data if necessary (default of 0). |
maxBytes uint32 | The maximum number of bytes to return. If this is 0 (default), all bytes will be returned. |
A string containing all of the raw bytes that are available.
Error_Connection: a connection error has occurred, such as the device being unplugged.