|
ROSaic
|
This is the central interface between this ROS driver and the mosaic receiver(s), managing I/O operations such as reading messages and sending commands.. More...
#include <async_manager.hpp>


Public Member Functions | |
| AsyncManager (boost::shared_ptr< StreamT > stream, boost::shared_ptr< boost::asio::io_service > io_service, std::size_t buffer_size=8192) | |
| Class constructor. More... | |
| virtual | ~AsyncManager () |
| void | SetCallback (const Callback &callback) |
| Sets the callback function. More... | |
| void | Wait (uint16_t *count) |
| Waits count seconds before throwing ROS_INFO message in case no message from the receiver arrived. More... | |
| bool | Send (std::string cmd, std::size_t size) |
| Sends commands via the I/O stream. More... | |
| bool | IsOpen () const |
| Determines whether or not the connection is open. More... | |
Public Member Functions inherited from io_comm_mosaic::Manager | |
| virtual | ~Manager () |
Protected Member Functions | |
| void | DoRead () |
| Reads in via async_read_some and hands certain number of bytes (bytes_transferred) over to async_read_some_handler. More... | |
| void | AsyncReadSomeHandler (const boost::system::error_code &error, std::size_t bytes_transferred) |
| Handler for async_read_some (Boost library).. More... | |
| void | DoWrite (std::string cmd, std::size_t size) |
| Sends all the data in the output buffer. More... | |
| void | DoClose () |
| Closes Stream "stream_". More... | |
| void | TryParsing () |
| Tries parsing SBF/NMEA whenever the boolean class variable "try_parsing" is true. More... | |
| void | CallAsyncWait (uint16_t *count) |
| Handles the ROS_INFO throwing (if no incoming message) More... | |
Protected Attributes | |
| boost::mutex | parse_mutex_ |
| Mutex to control changes of class variable "try_parsing". More... | |
| bool | try_parsing_ |
| Determines when the TryParsing() method will attempt parsing SBF/NMEA. More... | |
| bool | allow_writing_ |
| Determines when the AsyncReadSomeHandler() method should write SBF/NMEA into the circular buffer. More... | |
| boost::condition_variable | parsing_condition_ |
| Condition variable complementing "parse_mutex". More... | |
| boost::shared_ptr< StreamT > | stream_ |
| Stream, represents either serial or TCP/IP connection. More... | |
| boost::shared_ptr< boost::asio::io_service > | io_service_ |
| io_context object More... | |
| std::vector< uint8_t > | in_ |
| Buffer for async_read_some() to read continuous SBF/NMEA stream. More... | |
| CircularBuffer | circular_buffer_ |
| Circular Buffer to avoid unsuccessful SBF/NMEA parsing due to incomplete messages. More... | |
| uint8_t * | to_be_parsed_ |
| Memory location where read_callback_ will start reading unless part of SBF/NMEA had to be appended before. More... | |
| boost::shared_ptr< boost::thread > | async_background_thread_ |
| New thread for receiving incoming messages. More... | |
| Callback | read_callback_ |
| Callback to be called once message arrives. More... | |
| bool | stopping_ |
| Whether or not we want to sever the connection to the Rx. More... | |
| const std::size_t | buffer_size_ |
| Size of in_ buffers. More... | |
| boost::asio::deadline_timer | timer_ |
| Boost timer for throwing ROS_INFO message once timed out due to lack of incoming messages. More... | |
| const uint16_t | count_max_ |
| Number of seconds before ROS_INFO message is thrown (if no incoming message) More... | |
| uint16_t | do_read_count_ |
| Number of times the DoRead() method has been called (only counts initially) More... | |
Additional Inherited Members | |
Public Types inherited from io_comm_mosaic::Manager | |
| typedef boost::function< void(const uint8_t *, std::size_t &)> | Callback |
This is the central interface between this ROS driver and the mosaic receiver(s), managing I/O operations such as reading messages and sending commands..
StreamT is either boost::asio::serial_port or boost::asio::tcp::ip
Definition at line 110 of file async_manager.hpp.
| io_comm_mosaic::AsyncManager< StreamT >::AsyncManager | ( | boost::shared_ptr< StreamT > | stream, |
| boost::shared_ptr< boost::asio::io_service > | io_service, | ||
| std::size_t | buffer_size = 8192 |
||
| ) |
Class constructor.
| stream | Whether TCP/IP or serial communication, either boost::asio::serial_port or boost::asio::tcp::ip |
| io_service | The io_context object. The io_context represents your program's link to the operating system's I/O services. |
Definition at line 284 of file async_manager.hpp.
References io_comm_mosaic::AsyncManager< StreamT >::async_background_thread_, io_comm_mosaic::AsyncManager< StreamT >::buffer_size_, io_comm_mosaic::AsyncManager< StreamT >::CallAsyncWait(), io_comm_mosaic::AsyncManager< StreamT >::in_, io_comm_mosaic::AsyncManager< StreamT >::io_service_, io_comm_mosaic::AsyncManager< StreamT >::stream_, and io_comm_mosaic::AsyncManager< StreamT >::TryParsing().

|
virtual |
Definition at line 313 of file async_manager.hpp.
References io_comm_mosaic::AsyncManager< StreamT >::async_background_thread_.
|
protected |
Handler for async_read_some (Boost library)..
Definition at line 332 of file async_manager.hpp.
References io_comm_mosaic::AsyncManager< StreamT >::allow_writing_, io_comm_mosaic::AsyncManager< StreamT >::buffer_size_, io_comm_mosaic::AsyncManager< StreamT >::circular_buffer_, io_comm_mosaic::AsyncManager< StreamT >::in_, io_comm_mosaic::AsyncManager< StreamT >::io_service_, io_comm_mosaic::AsyncManager< StreamT >::parse_mutex_, io_comm_mosaic::AsyncManager< StreamT >::parsing_condition_, io_comm_mosaic::AsyncManager< StreamT >::read_callback_, io_comm_mosaic::AsyncManager< StreamT >::stopping_, io_comm_mosaic::AsyncManager< StreamT >::try_parsing_, and CircularBuffer::write().

|
protected |
Handles the ROS_INFO throwing (if no incoming message)
Definition at line 278 of file async_manager.hpp.
References io_comm_mosaic::AsyncManager< StreamT >::Wait().
Referenced by io_comm_mosaic::AsyncManager< StreamT >::AsyncManager().


|
protected |
Closes Stream "stream_".
Definition at line 361 of file async_manager.hpp.
References io_comm_mosaic::AsyncManager< StreamT >::stopping_, and io_comm_mosaic::AsyncManager< StreamT >::stream_.
|
protected |
Reads in via async_read_some and hands certain number of bytes (bytes_transferred) over to async_read_some_handler.
Definition at line 319 of file async_manager.hpp.
References io_comm_mosaic::AsyncManager< StreamT >::do_read_count_, io_comm_mosaic::AsyncManager< StreamT >::in_, and io_comm_mosaic::AsyncManager< StreamT >::stream_.
|
protected |
Sends all the data in the output buffer.
Definition at line 270 of file async_manager.hpp.
|
inlinevirtual |
Determines whether or not the connection is open.
Implements io_comm_mosaic::Manager.
Definition at line 132 of file async_manager.hpp.
|
virtual |
Sends commands via the I/O stream.
| cmd | The command to be sent |
| size | The size of the command |
Implements io_comm_mosaic::Manager.
Definition at line 254 of file async_manager.hpp.
|
inlinevirtual |
Sets the callback function.
Implements io_comm_mosaic::Manager.
Definition at line 121 of file async_manager.hpp.
References io_comm_mosaic::Manager::Send(), and io_comm_mosaic::Manager::Wait().

|
protected |
Tries parsing SBF/NMEA whenever the boolean class variable "try_parsing" is true.
Definition at line 205 of file async_manager.hpp.
Referenced by io_comm_mosaic::AsyncManager< StreamT >::AsyncManager().

|
virtual |
Waits count seconds before throwing ROS_INFO message in case no message from the receiver arrived.
Implements io_comm_mosaic::Manager.
Definition at line 373 of file async_manager.hpp.
References io_comm_mosaic::AsyncManager< StreamT >::async_background_thread_, io_comm_mosaic::AsyncManager< StreamT >::count_max_, io_comm_mosaic::AsyncManager< StreamT >::do_read_count_, and io_comm_mosaic::AsyncManager< StreamT >::timer_.
Referenced by io_comm_mosaic::AsyncManager< StreamT >::CallAsyncWait().

|
protected |
Determines when the AsyncReadSomeHandler() method should write SBF/NMEA into the circular buffer.
Definition at line 158 of file async_manager.hpp.
Referenced by io_comm_mosaic::AsyncManager< StreamT >::AsyncReadSomeHandler().
|
protected |
New thread for receiving incoming messages.
Definition at line 179 of file async_manager.hpp.
Referenced by io_comm_mosaic::AsyncManager< StreamT >::AsyncManager(), io_comm_mosaic::AsyncManager< StreamT >::Wait(), and io_comm_mosaic::AsyncManager< StreamT >::~AsyncManager().
|
protected |
Size of in_ buffers.
Definition at line 188 of file async_manager.hpp.
Referenced by io_comm_mosaic::AsyncManager< StreamT >::AsyncManager(), and io_comm_mosaic::AsyncManager< StreamT >::AsyncReadSomeHandler().
|
protected |
Circular Buffer to avoid unsuccessful SBF/NMEA parsing due to incomplete messages.
Definition at line 173 of file async_manager.hpp.
Referenced by io_comm_mosaic::AsyncManager< StreamT >::AsyncReadSomeHandler().
|
protected |
Number of seconds before ROS_INFO message is thrown (if no incoming message)
Definition at line 194 of file async_manager.hpp.
Referenced by io_comm_mosaic::AsyncManager< StreamT >::Wait().
|
protected |
Number of times the DoRead() method has been called (only counts initially)
Definition at line 200 of file async_manager.hpp.
Referenced by io_comm_mosaic::AsyncManager< StreamT >::DoRead(), and io_comm_mosaic::AsyncManager< StreamT >::Wait().
|
protected |
Buffer for async_read_some() to read continuous SBF/NMEA stream.
Definition at line 170 of file async_manager.hpp.
Referenced by io_comm_mosaic::AsyncManager< StreamT >::AsyncManager(), io_comm_mosaic::AsyncManager< StreamT >::AsyncReadSomeHandler(), and io_comm_mosaic::AsyncManager< StreamT >::DoRead().
|
protected |
io_context object
Definition at line 167 of file async_manager.hpp.
Referenced by io_comm_mosaic::AsyncManager< StreamT >::AsyncManager(), and io_comm_mosaic::AsyncManager< StreamT >::AsyncReadSomeHandler().
|
protected |
Mutex to control changes of class variable "try_parsing".
Definition at line 152 of file async_manager.hpp.
Referenced by io_comm_mosaic::AsyncManager< StreamT >::AsyncReadSomeHandler().
|
protected |
Condition variable complementing "parse_mutex".
Definition at line 161 of file async_manager.hpp.
Referenced by io_comm_mosaic::AsyncManager< StreamT >::AsyncReadSomeHandler().
|
protected |
Callback to be called once message arrives.
Definition at line 182 of file async_manager.hpp.
Referenced by io_comm_mosaic::AsyncManager< StreamT >::AsyncReadSomeHandler().
|
protected |
Whether or not we want to sever the connection to the Rx.
Definition at line 185 of file async_manager.hpp.
Referenced by io_comm_mosaic::AsyncManager< StreamT >::AsyncReadSomeHandler(), and io_comm_mosaic::AsyncManager< StreamT >::DoClose().
|
protected |
Stream, represents either serial or TCP/IP connection.
Definition at line 164 of file async_manager.hpp.
Referenced by io_comm_mosaic::AsyncManager< StreamT >::AsyncManager(), io_comm_mosaic::AsyncManager< StreamT >::DoClose(), and io_comm_mosaic::AsyncManager< StreamT >::DoRead().
|
protected |
Boost timer for throwing ROS_INFO message once timed out due to lack of incoming messages.
Definition at line 191 of file async_manager.hpp.
Referenced by io_comm_mosaic::AsyncManager< StreamT >::Wait().
|
protected |
Memory location where read_callback_ will start reading unless part of SBF/NMEA had to be appended before.
Definition at line 176 of file async_manager.hpp.
|
protected |
Determines when the TryParsing() method will attempt parsing SBF/NMEA.
Definition at line 155 of file async_manager.hpp.
Referenced by io_comm_mosaic::AsyncManager< StreamT >::AsyncReadSomeHandler().
1.8.13