Can be used on Windows, OSX, or linux to communicate with a MIP device over serial.
More...
#include <serial_connection.hpp>
|
| | SerialConnection (std::string portName, uint32_t baudrate) |
| | Creates a Serial Connection that will communicate with a device over serial. More...
|
| |
| | ~SerialConnection () override |
| | Closes the underlying serial port. More...
|
| |
| bool | recvFromDevice (uint8_t *buffer, size_t max_length, unsigned int wait_time_ms, size_t *length_out, EmbeddedTimestamp *timestamp_out) final |
| | Receives bytes from the device. More...
|
| |
| bool | sendToDevice (const uint8_t *data, size_t length) final |
| | Sends bytes to the device. More...
|
| |
| bool | isConnected () const override |
| | Check if the port is connected. More...
|
| |
| bool | connect () override |
| | Connect to the port. More...
|
| |
| bool | disconnect () override |
| | Disconnect from the port. More...
|
| |
| void | connectionInfo (std::string &name, uint32_t &baudrate) const |
| |
| uint32_t | baudrate () const |
| |
| bool | setBaudrate (uint32_t baud) |
| | Change the baudrate. More...
|
| |
| const char * | interfaceName () const override |
| |
| uint32_t | parameter () const override |
| |
| | Connection () |
| |
| virtual | ~Connection () |
| |
| bool | sendBufferToDevice (microstrain::ConstU8ArrayView data) |
| |
| bool | recvBufferFromDevice (microstrain::U8ArrayView buffer, unsigned int wait_time_ms, size_t *length_out, EmbeddedTimestamp *timestamp_out) |
| |
| bool | recvFromDeviceAndUpdateUint8ArrayView (microstrain::U8ArrayView &buffer, unsigned int wait_time_ms, EmbeddedTimestamp *timestamp_out) |
| |
| const char * | type () const |
| |
|
| static constexpr const char * | TYPE = "Serial" |
| |
| static constexpr const char * | TYPE = "None" |
| |
◆ SerialConnection()
| microstrain::connections::SerialConnection::SerialConnection |
( |
std::string |
portName, |
|
|
uint32_t |
baudrate |
|
) |
| |
- 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 |
◆ 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 |
- 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 |
◆ isConnected()
| bool microstrain::connections::SerialConnection::isConnected |
( |
| ) |
const |
|
overridevirtual |
◆ connect()
| bool microstrain::connections::SerialConnection::connect |
( |
| ) |
|
|
overridevirtual |
◆ disconnect()
| bool microstrain::connections::SerialConnection::disconnect |
( |
| ) |
|
|
overridevirtual |
◆ connectionInfo()
| void microstrain::connections::SerialConnection::connectionInfo |
( |
std::string & |
name, |
|
|
uint32_t & |
baudrate |
|
) |
| const |
|
inline |
◆ baudrate()
| uint32_t microstrain::connections::SerialConnection::baudrate |
( |
| ) |
const |
|
inline |
◆ setBaudrate()
| bool microstrain::connections::SerialConnection::setBaudrate |
( |
uint32_t |
baud | ) |
|
◆ interfaceName()
| const char* microstrain::connections::SerialConnection::interfaceName |
( |
| ) |
const |
|
inlineoverridevirtual |
◆ parameter()
| uint32_t microstrain::connections::SerialConnection::parameter |
( |
| ) |
const |
|
inlineoverridevirtual |
◆ TYPE
| constexpr const char* microstrain::connections::SerialConnection::TYPE = "Serial" |
|
staticconstexpr |
The documentation for this class was generated from the following files: