Can be used on Windows, OSX, or linux to communicate with a MIP device over TCP.
More...
#include <tcp_connection.hpp>
|
| TcpConnection ()=default |
|
| TcpConnection (const std::string &hostname, uint16_t port) |
| Creates a TcpConnection that will communicate with a device over TCP. More...
|
|
| ~TcpConnection () override |
| Closes the underlying TCP socket. More...
|
|
| TcpConnection (const TcpConnection &)=delete |
|
TcpConnection & | operator= (const TcpConnection &)=delete |
|
bool | recvFromDevice (uint8_t *buffer, size_t max_length, unsigned int wait_time_ms, size_t *length_out, EmbeddedTimestamp *timestamp_out) override |
| Receives bytes from the device. More...
|
|
bool | sendToDevice (const uint8_t *data, size_t length) override |
| Sends bytes to the device. More...
|
|
bool | isConnected () const override |
| Check if the socket is connected. More...
|
|
bool | connect () override |
| Connect to the socket. More...
|
|
bool | disconnect () override |
| Disconnect from the socket. More...
|
|
void | connectionInfo (std::string &host_name, uint32_t &port) const |
|
const char * | interfaceName () const override |
|
uint32_t | parameter () const override |
|
| Connection () |
|
virtual | ~Connection () |
|
bool | sendToDeviceSpan (microstrain::Span< const uint8_t > data) |
|
bool | recvFromDeviceSpan (microstrain::Span< uint8_t > buffer, unsigned int wait_time_ms, size_t *length_out, EmbeddedTimestamp *timestamp_out) |
|
bool | recvFromDeviceSpanUpdate (microstrain::Span< uint8_t > &buffer, unsigned int wait_time_ms, EmbeddedTimestamp *timestamp_out) |
|
const char * | type () const |
|
|
static constexpr const char * | TYPE = "TCP" |
|
static constexpr const char * | TYPE = "None" |
|
Can be used on Windows, OSX, or linux to communicate with a MIP device over TCP.
◆ TcpConnection() [1/3]
microstrain::connections::TcpConnection::TcpConnection |
( |
| ) |
|
|
default |
◆ TcpConnection() [2/3]
microstrain::connections::TcpConnection::TcpConnection |
( |
const std::string & |
hostname, |
|
|
uint16_t |
port |
|
) |
| |
Creates a TcpConnection that will communicate with a device over TCP.
- Parameters
-
hostname | Host name or IP address to connect to |
port | Port on hostName to connect to |
◆ ~TcpConnection()
microstrain::connections::TcpConnection::~TcpConnection |
( |
| ) |
|
|
override |
Closes the underlying TCP socket.
◆ TcpConnection() [3/3]
microstrain::connections::TcpConnection::TcpConnection |
( |
const TcpConnection & |
| ) |
|
|
delete |
◆ connect()
bool microstrain::connections::TcpConnection::connect |
( |
| ) |
|
|
overridevirtual |
◆ connectionInfo()
void microstrain::connections::TcpConnection::connectionInfo |
( |
std::string & |
host_name, |
|
|
uint32_t & |
port |
|
) |
| const |
|
inline |
◆ disconnect()
bool microstrain::connections::TcpConnection::disconnect |
( |
| ) |
|
|
overridevirtual |
◆ interfaceName()
const char* microstrain::connections::TcpConnection::interfaceName |
( |
| ) |
const |
|
inlineoverridevirtual |
◆ isConnected()
bool microstrain::connections::TcpConnection::isConnected |
( |
| ) |
const |
|
overridevirtual |
◆ operator=()
◆ parameter()
uint32_t microstrain::connections::TcpConnection::parameter |
( |
| ) |
const |
|
inlineoverridevirtual |
◆ recvFromDevice()
bool microstrain::connections::TcpConnection::recvFromDevice |
( |
uint8_t * |
buffer, |
|
|
size_t |
max_length, |
|
|
unsigned int |
wait_time_ms, |
|
|
size_t * |
length_out, |
|
|
EmbeddedTimestamp * |
timestamp_out |
|
) |
| |
|
overridevirtual |
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::TcpConnection::sendToDevice |
( |
const uint8_t * |
data, |
|
|
size_t |
length |
|
) |
| |
|
overridevirtual |
Sends bytes to the device.
- Parameters
-
data | The data to send to the device |
length | Length of data in bytes |
Implements microstrain::Connection.
◆ TYPE
constexpr const char* microstrain::connections::TcpConnection::TYPE = "TCP" |
|
staticconstexpr |
The documentation for this class was generated from the following files: