Class Receiver

Inheritance Relationships

Derived Type

Class Documentation

class Receiver

Interface class to any receiver implemented by the network backend.

Subclassed by Netio3Receiver

Public Types

using OnMsg = std::function<void(const std::vector<ToFlxMessage>&)>
using OnConnOpen = std::function<void(const std::string&)>
using OnConnClose = std::function<void(const std::string&)>

Public Functions

virtual ~Receiver() = default
virtual void set_conn_open_callback(OnConnOpen callback) = 0

application callback for new connections.

Parameters:

callback -- the std::function<void (std::string &)> to invoked when a new connection is established.

virtual void set_conn_close_callback(OnConnClose callback) = 0

application callback for closed connections.

Parameters:

callback -- the std::function<void (std::string &)> to be invoked when a new connection is closed.

virtual void set_on_msg_callback(OnMsg callback) = 0

application callback for received messages.

Parameters:

callback -- the std::function<void(uint8_t*, size_t)> to invoke when a message is received.

virtual int get_number_of_connections() = 0

Monitor the number of open connetions.

Returns:

the number of open connections.

virtual uint16_t get_port() const = 0

Get the port number assigned by the system.

Returns:

the port number.