MIP_SDK
latest-2-g34f3e39
MicroStrain Communications Library for embedded systems
|
Represents a type of connection. More...
#include <connection.hpp>
Public Member Functions | |
Connection () | |
virtual | ~Connection () |
virtual bool | sendToDevice (const uint8_t *data, size_t length)=0 |
Sends bytes to the device. More... | |
virtual bool | recvFromDevice (uint8_t *buffer, size_t max_length, unsigned int wait_time_ms, size_t *length_out, EmbeddedTimestamp *timestamp_out)=0 |
Receives bytes from the device. More... | |
virtual bool | isConnected () const =0 |
virtual bool | connect ()=0 |
virtual bool | disconnect ()=0 |
const char * | type () const |
virtual const char * | interfaceName () const =0 |
virtual uint32_t | parameter () const =0 |
Static Public Attributes | |
static constexpr const char * | TYPE = "None" |
Protected Attributes | |
const char * | mType |
Represents a type of connection.
The following methods are pure virtual and must be implemented by a derived class:
bool sendToDevice(const uint8_t* data, size_t length)
bool recvFromDevice(uint8_t* buffer, size_t maxLength, unsigned int wait_time_ms, size_t* lengthOut, EmbeddedTimestamp* timestampOut)
|
inline |
|
inlinevirtual |
|
pure virtual |
|
pure virtual |
|
pure virtual |
|
pure virtual |
|
pure virtual |
|
pure virtual |
Receives bytes from the device.
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 |
Implemented in microstrain::connections::TcpConnection, microstrain::connections::RecordingConnection, and microstrain::connections::SerialConnection.
|
pure virtual |
Sends bytes to the device.
data | The data to send to the device |
length | Length of data in bytes |
Implemented in microstrain::connections::TcpConnection, microstrain::connections::RecordingConnection, and microstrain::connections::SerialConnection.
|
inline |
|
protected |
|
staticconstexpr |