unilink  0.4.3
A simple C++ library for unified async communication
unilink::wrapper::ChannelInterface Class Referenceabstract

Common interface for 1:1 point-to-point communication (e.g., TcpClient, Serial, Udp) More...

#include <ichannel.hpp>

Inheritance diagram for unilink::wrapper::ChannelInterface:
unilink::wrapper::Serial unilink::wrapper::TcpClient unilink::wrapper::Udp

Public Types

using MessageHandler = std::function< void(const MessageContext &)>
 
using ConnectionHandler = std::function< void(const ConnectionContext &)>
 
using ErrorHandler = std::function< void(const ErrorContext &)>
 

Public Member Functions

virtual ~ChannelInterface ()=default
 
virtual std::future< bool > start ()=0
 
virtual void stop ()=0
 
virtual bool is_connected () const =0
 
virtual void send (std::string_view data)=0
 
virtual void send_line (std::string_view line)=0
 
virtual ChannelInterfaceon_data (MessageHandler handler)=0
 
virtual ChannelInterfaceon_connect (ConnectionHandler handler)=0
 
virtual ChannelInterfaceon_disconnect (ConnectionHandler handler)=0
 
virtual ChannelInterfaceon_error (ErrorHandler handler)=0
 
virtual ChannelInterfaceauto_manage (bool manage=true)=0
 

Detailed Description

Common interface for 1:1 point-to-point communication (e.g., TcpClient, Serial, Udp)

Definition at line 34 of file ichannel.hpp.

Member Typedef Documentation

◆ ConnectionHandler

Definition at line 37 of file ichannel.hpp.

◆ ErrorHandler

Definition at line 38 of file ichannel.hpp.

◆ MessageHandler

Definition at line 36 of file ichannel.hpp.

Constructor & Destructor Documentation

◆ ~ChannelInterface()

virtual unilink::wrapper::ChannelInterface::~ChannelInterface ( )
virtualdefault

Member Function Documentation

◆ auto_manage()

virtual ChannelInterface& unilink::wrapper::ChannelInterface::auto_manage ( bool  manage = true)
pure virtual

◆ is_connected()

virtual bool unilink::wrapper::ChannelInterface::is_connected ( ) const
pure virtual

◆ on_connect()

virtual ChannelInterface& unilink::wrapper::ChannelInterface::on_connect ( ConnectionHandler  handler)
pure virtual

◆ on_data()

virtual ChannelInterface& unilink::wrapper::ChannelInterface::on_data ( MessageHandler  handler)
pure virtual

◆ on_disconnect()

virtual ChannelInterface& unilink::wrapper::ChannelInterface::on_disconnect ( ConnectionHandler  handler)
pure virtual

◆ on_error()

virtual ChannelInterface& unilink::wrapper::ChannelInterface::on_error ( ErrorHandler  handler)
pure virtual

◆ send()

virtual void unilink::wrapper::ChannelInterface::send ( std::string_view  data)
pure virtual

◆ send_line()

virtual void unilink::wrapper::ChannelInterface::send_line ( std::string_view  line)
pure virtual

◆ start()

virtual std::future<bool> unilink::wrapper::ChannelInterface::start ( )
pure virtual

◆ stop()

virtual void unilink::wrapper::ChannelInterface::stop ( )
pure virtual

The documentation for this class was generated from the following file: