MIP_SDK
latest-2-g34f3e39
MicroStrain Communications Library for embedded systems
|
Go to the documentation of this file.
24 static constexpr
const char*
TYPE =
"Serial";
30 bool sendToDevice(
const uint8_t* data,
size_t length)
final;
42 uint32_t
baudrate()
const {
return mBaudrate; }
48 std::string mPortName;
52 const char*
interfaceName()
const override {
return mPortName.c_str(); }
53 uint32_t
parameter()
const override {
return mBaudrate; }
62 static constexpr
const char*
TYPE =
"USB";
const char * mType
Definition: connection.hpp:58
SerialConnection(std::string portName, uint32_t baudrate)
Creates a Serial Connection that will communicate with a device over serial.
Definition: serial_connection.cpp:21
const char * interfaceName() const override
Definition: serial_connection.hpp:52
bool connect() override
Connect to the port.
Definition: serial_connection.cpp:49
Definition: serial_port.h:42
A serial connection but indicates that it's actually a USB connection.
Definition: serial_connection.hpp:59
static constexpr const char * TYPE
Definition: serial_connection.hpp:62
bool setBaudrate(uint32_t baud)
Change the baudrate.
Definition: serial_connection.cpp:71
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.
Definition: serial_connection.cpp:82
~SerialConnection() override
Closes the underlying serial port.
Definition: serial_connection.cpp:33
Can be used on Windows, OSX, or linux to communicate with a MIP device over serial.
Definition: serial_connection.hpp:21
uint32_t baudrate() const
Definition: serial_connection.hpp:42
C::microstrain_embedded_timestamp EmbeddedTimestamp
Definition: embedded_time.hpp:9
bool sendToDevice(const uint8_t *data, size_t length) final
Sends bytes to the device.
Definition: serial_connection.cpp:90
static constexpr const char * TYPE
Definition: serial_connection.hpp:24
Represents a type of connection.
Definition: connection.hpp:24
void connectionInfo(std::string &name, uint32_t &baudrate) const
Definition: serial_connection.hpp:36
bool isConnected() const override
Check if the port is connected.
Definition: serial_connection.cpp:41
UsbSerialConnection(const std::string &portName, uint32_t baudrate)
Definition: serial_connection.hpp:64
bool disconnect() override
Disconnect from the port.
Definition: serial_connection.cpp:60
uint32_t parameter() const override
Definition: serial_connection.hpp:53
Definition: embedded_time.h:8