Can be used on Windows, OSX, or linux to communicate with a MIP device over serial.
More...
#include <serial_connection.hpp>
|
static constexpr const char * | TYPE = "Serial" |
|
static constexpr const char * | TYPE = "None" |
|
Can be used on Windows, OSX, or linux to communicate with a MIP device over serial.
◆ SerialConnection()
microstrain::connections::SerialConnection::SerialConnection |
( |
std::string |
portName, |
|
|
uint32_t |
baudrate |
|
) |
| |
Creates a Serial Connection that will communicate with a device over serial.
- Parameters
-
portName | Path to the port to connect to. On Windows, this usually looks like "COM<N>", on linux, "/dev/tty<N>" |
baudrate | Baud rate to open the device at. Note that the device needs to be configured to |
◆ ~SerialConnection()
microstrain::connections::SerialConnection::~SerialConnection |
( |
| ) |
|
|
override |
Closes the underlying serial port.
◆ baudrate()
uint32_t microstrain::connections::SerialConnection::baudrate |
( |
| ) |
const |
|
inline |
◆ connect()
bool microstrain::connections::SerialConnection::connect |
( |
| ) |
|
|
overridevirtual |
◆ connectionInfo()
void microstrain::connections::SerialConnection::connectionInfo |
( |
std::string & |
name, |
|
|
uint32_t & |
baudrate |
|
) |
| const |
|
inline |
◆ disconnect()
bool microstrain::connections::SerialConnection::disconnect |
( |
| ) |
|
|
overridevirtual |
◆ interfaceName()
const char* microstrain::connections::SerialConnection::interfaceName |
( |
| ) |
const |
|
inlineoverridevirtual |
◆ isConnected()
bool microstrain::connections::SerialConnection::isConnected |
( |
| ) |
const |
|
overridevirtual |
◆ parameter()
uint32_t microstrain::connections::SerialConnection::parameter |
( |
| ) |
const |
|
inlineoverridevirtual |
◆ recvFromDevice()
bool microstrain::connections::SerialConnection::recvFromDevice |
( |
uint8_t * |
buffer, |
|
|
size_t |
max_length, |
|
|
unsigned int |
wait_time_ms, |
|
|
size_t * |
length_out, |
|
|
EmbeddedTimestamp * |
timestamp_out |
|
) |
| |
|
finalvirtual |
Receives bytes from the device.
- Parameters
-
buffer | Buffer to store the received data in |
max_length | Max number of bytes that can be read. Should be at most the length of buffer. |
wait_time_ms | Time to wait for data in milliseconds. |
length_out | Number of bytes actually read. |
timestamp_out | Timestamp of when the data was received |
Implements microstrain::Connection.
◆ sendToDevice()
bool microstrain::connections::SerialConnection::sendToDevice |
( |
const uint8_t * |
data, |
|
|
size_t |
length |
|
) |
| |
|
finalvirtual |
Sends bytes to the device.
- Parameters
-
data | The data to send to the device |
length | Length of data in bytes |
Implements microstrain::Connection.
◆ setBaudrate()
bool microstrain::connections::SerialConnection::setBaudrate |
( |
uint32_t |
baud | ) |
|
◆ TYPE
constexpr const char* microstrain::connections::SerialConnection::TYPE = "Serial" |
|
staticconstexpr |
The documentation for this class was generated from the following files: