MIP_SDK  latest-2-g34f3e39
MicroStrain Communications Library for embedded systems
Public Member Functions | Static Public Attributes | Protected Attributes | List of all members
microstrain::Connection Class Referenceabstract

Represents a type of connection. More...

#include <connection.hpp>

Inheritance diagram for microstrain::Connection:
microstrain::connections::RecordingConnection microstrain::connections::SerialConnection microstrain::connections::TcpConnection microstrain::connections::RecordingConnectionWrapper< ConnectionType > microstrain::connections::UsbSerialConnection

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
 

Detailed Description

Represents a type of connection.

The following methods are pure virtual and must be implemented by a derived class:

Constructor & Destructor Documentation

◆ Connection()

microstrain::Connection::Connection ( )
inline

◆ ~Connection()

virtual microstrain::Connection::~Connection ( )
inlinevirtual

Member Function Documentation

◆ connect()

virtual bool microstrain::Connection::connect ( )
pure virtual

◆ disconnect()

virtual bool microstrain::Connection::disconnect ( )
pure virtual

◆ interfaceName()

virtual const char* microstrain::Connection::interfaceName ( ) const
pure virtual

◆ isConnected()

virtual bool microstrain::Connection::isConnected ( ) const
pure virtual

◆ parameter()

virtual uint32_t microstrain::Connection::parameter ( ) const
pure virtual

◆ recvFromDevice()

mip::Connection::recvFromDevice ( uint8_t *  buffer,
size_t  max_length,
unsigned int  wait_time_ms,
size_t *  length_out,
EmbeddedTimestamp timestamp_out 
)
pure virtual

Receives bytes from the device.

Parameters
bufferBuffer to store the received data in
max_lengthMax number of bytes that can be read. Should be at most the length of buffer.
wait_time_msTime to wait for data in milliseconds.
length_outNumber of bytes actually read.
timestamp_outTimestamp of when the data was received

Implemented in microstrain::connections::TcpConnection, microstrain::connections::RecordingConnection, and microstrain::connections::SerialConnection.

◆ sendToDevice()

mip::Connection::sendToDevice ( const uint8_t *  data,
size_t  length 
)
pure virtual

Sends bytes to the device.

Parameters
dataThe data to send to the device
lengthLength of data in bytes

Implemented in microstrain::connections::TcpConnection, microstrain::connections::RecordingConnection, and microstrain::connections::SerialConnection.

◆ type()

const char* microstrain::Connection::type ( ) const
inline

Member Data Documentation

◆ mType

const char* microstrain::Connection::mType
protected

◆ TYPE

constexpr const char* microstrain::Connection::TYPE = "None"
staticconstexpr

The documentation for this class was generated from the following files: