ROSaic
|
Handles communication with configuration of the mosaic (and beyond) device(s) More...
#include <communication_core.hpp>
Public Member Functions | |
Comm_IO () | |
Default constructor of the class Comm_IO. More... | |
virtual | ~Comm_IO ()=default |
Default destructor of the class Comm_IO. More... | |
bool | InitializeSerial (std::string port, uint32_t baudrate=115200, std::string flowcontrol="None") |
Initializes the serial port. More... | |
bool | InitializeTCP (std::string host, std::string port) |
Initializes the TCP I/O. More... | |
void | SetManager (const boost::shared_ptr< Manager > &manager) |
Set the I/O manager. More... | |
void | ResetSerial (std::string port) |
Reset the Serial I/O port, e.g. after mosaic reset. More... | |
CallbackHandlers | GetHandlers () const |
void | Send (std::string cmd) |
Data Fields | |
CallbackHandlers | handlers_ |
Callback handlers for the inwards streaming messages. More... | |
Private Attributes | |
std::string | serial_port_ |
Saves the port description. More... | |
boost::shared_ptr< Manager > | manager_ |
uint32_t | baudrate_ |
Baudrate at the moment, unless InitializeSerial or ResetSerial fail. More... | |
std::string | host_ |
Host currently connected to. More... | |
std::string | port_ |
Port over which TCP/IP connection is currently established. More... | |
Static Private Attributes | |
static const unsigned int | set_baudrate_sleep_ = 500000 |
Friends | |
class | CallbackHandlers |
class | mosaicMessage |
Handles communication with configuration of the mosaic (and beyond) device(s)
Definition at line 116 of file communication_core.hpp.
io_comm_mosaic::Comm_IO::Comm_IO | ( | ) |
Default constructor of the class Comm_IO.
Definition at line 39 of file communication_core.cpp.
|
virtualdefault |
Default destructor of the class Comm_IO.
|
inline |
Definition at line 160 of file communication_core.hpp.
References handlers_, and Send().
Referenced by rosaic_node::ROSaicNode::DefineMessages().
bool io_comm_mosaic::Comm_IO::InitializeSerial | ( | std::string | port, |
uint32_t | baudrate = 115200 , |
||
std::string | flowcontrol = "None" |
||
) |
Initializes the serial port.
[in] | port | The device's port address |
[in] | baudrate | The chosen baud rate of the port |
[in] | flowcontrol | Default is "None", set variable (not yet checked) to "RTS|CTS" to activate hardware flow control (only for mosaic serial ports COM1, COM2 and COM3) |
Definition at line 94 of file communication_core.cpp.
References baudrate_, io_comm_mosaic::baudrates, manager_, serial_port_, set_baudrate_sleep_, and SetManager().
Referenced by rosaic_node::ROSaicNode::Reconnect().
bool io_comm_mosaic::Comm_IO::InitializeTCP | ( | std::string | host, |
std::string | port | ||
) |
Initializes the TCP I/O.
[in] | host | The TCP host |
[in] | port | The TCP port |
Definition at line 47 of file communication_core.cpp.
References host_, manager_, port_, and SetManager().
Referenced by rosaic_node::ROSaicNode::Reconnect().
void io_comm_mosaic::Comm_IO::ResetSerial | ( | std::string | port | ) |
Reset the Serial I/O port, e.g. after mosaic reset.
[in] | port | The device's port address |
Definition at line 240 of file communication_core.cpp.
References baudrate_, manager_, serial_port_, and SetManager().
void io_comm_mosaic::Comm_IO::Send | ( | std::string | cmd | ) |
Definition at line 41 of file communication_core.cpp.
References manager_.
Referenced by rosaic_node::ROSaicNode::ConfigureMosaic(), and GetHandlers().
void io_comm_mosaic::Comm_IO::SetManager | ( | const boost::shared_ptr< Manager > & | manager | ) |
Set the I/O manager.
[in] | manager | An I/O handler |
Definition at line 231 of file communication_core.cpp.
References handlers_, manager_, and io_comm_mosaic::CallbackHandlers::ReadCallback().
Referenced by InitializeSerial(), InitializeTCP(), and ResetSerial().
|
friend |
Definition at line 177 of file communication_core.hpp.
|
friend |
Definition at line 178 of file communication_core.hpp.
|
private |
Baudrate at the moment, unless InitializeSerial or ResetSerial fail.
Definition at line 175 of file communication_core.hpp.
Referenced by InitializeSerial(), and ResetSerial().
CallbackHandlers io_comm_mosaic::Comm_IO::handlers_ |
Callback handlers for the inwards streaming messages.
Definition at line 165 of file communication_core.hpp.
Referenced by rosaic_node::ROSaicNode::DefineMessages(), GetHandlers(), and SetManager().
|
private |
Host currently connected to.
Definition at line 181 of file communication_core.hpp.
Referenced by InitializeTCP().
|
private |
Processes I/O stream data This declaration is deliberately stream-independent (Serial or TCP).
Definition at line 173 of file communication_core.hpp.
Referenced by InitializeSerial(), InitializeTCP(), ResetSerial(), Send(), and SetManager().
|
private |
Port over which TCP/IP connection is currently established.
Definition at line 183 of file communication_core.hpp.
Referenced by InitializeTCP().
|
private |
Saves the port description.
Definition at line 170 of file communication_core.hpp.
Referenced by InitializeSerial(), and ResetSerial().
|
staticprivate |
Sleep time in microseconds (there is no Unix command for milliseconds) after setting the baudrate to certain value (important between increments)
Definition at line 186 of file communication_core.hpp.
Referenced by InitializeSerial().