Class Worker
Defined in File worker.hpp
Inheritance Relationships
Derived Type
public ublox_gps::AsyncWorker< StreamT >
(Template Class AsyncWorker)
Class Documentation
-
class Worker
Handles I/O reading and writing.
Subclassed by ublox_gps::AsyncWorker< StreamT >
Public Types
-
using WorkerCallback = std::function<size_t(unsigned char*, std::size_t)>
-
using WorkerRawCallback = std::function<void(unsigned char*, std::size_t)>
Public Functions
-
virtual ~Worker() = default
-
virtual void setCallback(const WorkerCallback &callback) = 0
Set the callback function for received messages.
- Parameters:
callback – the callback function which process messages in the buffer
-
virtual void setRawDataCallback(const WorkerRawCallback &callback) = 0
Set the callback function which handles raw data.
- Parameters:
callback – the write callback which handles raw data
-
virtual bool send(const unsigned char *data, const unsigned int size) = 0
Send the data in the buffer.
- Parameters:
data – the bytes to send
size – the size of the buffer
-
virtual void wait(const std::chrono::milliseconds &timeout) = 0
Wait for an incoming message.
- Parameters:
timeout – the maximum time to wait.
-
virtual bool isOpen() const = 0
Whether or not the I/O stream is open.
-
using WorkerCallback = std::function<size_t(unsigned char*, std::size_t)>