AlteriomPainlessMesh v2.1.1
Easy ESP32/ESP8266 mesh networking with Alteriom IoT extensions
Loading...
Searching...
No Matches
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
AsyncClient Class Reference

#include <asynctcp.hpp>

Public Member Functions

 AsyncClient (boost::asio::io_context &io_service)
 
bool connect (IPAddress ipaddress, uint16_t port)
 
void initRead ()
 
size_t write (const void *data, size_t len, size_t copy=ASYNC_WRITE_FLAG_COPY)
 
void send ()
 
void setNoDelay (bool value=true)
 
void setRxTimeout (uint32_t timeout)
 
const char * errorToString (int8_t error)
 
void abort ()
 
void onConnect (AcConnectHandler cb, void *arg=0)
 
void onDisconnect (AcConnectHandler cb, void *arg=0)
 
void onAck (AcAckHandler cb, void *arg=0)
 
void onError (AcErrorHandler cb, void *arg=0)
 
void onData (AcDataHandler cb, void *arg=0)
 
void onTimeout (AcTimeoutHandler cb, void *arg=0)
 
void onPoll (AcConnectHandler cb, void *arg=0)
 
bool connected ()
 
bool freeable ()
 
void close (bool now=true)
 
 ~AsyncClient ()
 
size_t space ()
 
bool canSend ()
 
size_t ack (size_t len)
 
tcp::socket & socket ()
 

Protected Member Functions

void handleConnect (const boost::system::error_code &ec)
 
void handleData (const boost::system::error_code &ec, size_t len)
 
void handleWrite (const boost::system::error_code &ec, size_t len)
 
void handleError (const boost::system::error_code &ec)
 

Protected Attributes

boost::asio::io_context & _io_service
 
tcp::socket mSocket
 
char mInputBuffer [TCP_MSS]
 
char mWriteBuffer [TCP_MSS]
 
bool writing = false
 
bool disconnectCalled = false
 
AcConnectHandler _connect_cb = 0
 
void * _connect_cb_arg = 0
 
AcConnectHandler _discard_cb = 0
 
void * _discard_cb_arg = 0
 
AcAckHandler _sent_cb = 0
 
void * _sent_cb_arg = 0
 
AcErrorHandler _error_cb = 0
 
void * _error_cb_arg = 0
 
AcDataHandler _recv_cb = 0
 
void * _recv_cb_arg = 0
 
AcTimeoutHandler _timeout_cb = 0
 
void * _timeout_cb_arg = 0
 
AcConnectHandler _poll_cb = 0
 
void * _poll_cb_arg = 0
 

Constructor & Destructor Documentation

◆ AsyncClient()

AsyncClient::AsyncClient ( boost::asio::io_context &  io_service)
inline

◆ ~AsyncClient()

AsyncClient::~AsyncClient ( )
inline

Member Function Documentation

◆ abort()

void AsyncClient::abort ( )
inline

◆ ack()

size_t AsyncClient::ack ( size_t  len)
inline

◆ canSend()

bool AsyncClient::canSend ( )
inline

◆ close()

void AsyncClient::close ( bool  now = true)
inline

◆ connect()

bool AsyncClient::connect ( IPAddress  ipaddress,
uint16_t  port 
)
inline

◆ connected()

bool AsyncClient::connected ( )
inline

◆ errorToString()

const char * AsyncClient::errorToString ( int8_t  error)
inline

◆ freeable()

bool AsyncClient::freeable ( )
inline

◆ handleConnect()

void AsyncClient::handleConnect ( const boost::system::error_code &  ec)
inlineprotected

◆ handleData()

void AsyncClient::handleData ( const boost::system::error_code &  ec,
size_t  len 
)
inlineprotected

◆ handleError()

void AsyncClient::handleError ( const boost::system::error_code &  ec)
inlineprotected

◆ handleWrite()

void AsyncClient::handleWrite ( const boost::system::error_code &  ec,
size_t  len 
)
inlineprotected

◆ initRead()

void AsyncClient::initRead ( )
inline

◆ onAck()

void AsyncClient::onAck ( AcAckHandler  cb,
void *  arg = 0 
)
inline

◆ onConnect()

void AsyncClient::onConnect ( AcConnectHandler  cb,
void *  arg = 0 
)
inline

◆ onData()

void AsyncClient::onData ( AcDataHandler  cb,
void *  arg = 0 
)
inline

◆ onDisconnect()

void AsyncClient::onDisconnect ( AcConnectHandler  cb,
void *  arg = 0 
)
inline

◆ onError()

void AsyncClient::onError ( AcErrorHandler  cb,
void *  arg = 0 
)
inline

◆ onPoll()

void AsyncClient::onPoll ( AcConnectHandler  cb,
void *  arg = 0 
)
inline

◆ onTimeout()

void AsyncClient::onTimeout ( AcTimeoutHandler  cb,
void *  arg = 0 
)
inline

◆ send()

void AsyncClient::send ( )
inline

◆ setNoDelay()

void AsyncClient::setNoDelay ( bool  value = true)
inline

◆ setRxTimeout()

void AsyncClient::setRxTimeout ( uint32_t  timeout)
inline

◆ socket()

tcp::socket & AsyncClient::socket ( )
inline

◆ space()

size_t AsyncClient::space ( )
inline

◆ write()

size_t AsyncClient::write ( const void *  data,
size_t  len,
size_t  copy = ASYNC_WRITE_FLAG_COPY 
)
inline

Member Data Documentation

◆ _connect_cb

AcConnectHandler AsyncClient::_connect_cb = 0
protected

◆ _connect_cb_arg

void* AsyncClient::_connect_cb_arg = 0
protected

◆ _discard_cb

AcConnectHandler AsyncClient::_discard_cb = 0
protected

◆ _discard_cb_arg

void* AsyncClient::_discard_cb_arg = 0
protected

◆ _error_cb

AcErrorHandler AsyncClient::_error_cb = 0
protected

◆ _error_cb_arg

void* AsyncClient::_error_cb_arg = 0
protected

◆ _io_service

boost::asio::io_context& AsyncClient::_io_service
protected

◆ _poll_cb

AcConnectHandler AsyncClient::_poll_cb = 0
protected

◆ _poll_cb_arg

void* AsyncClient::_poll_cb_arg = 0
protected

◆ _recv_cb

AcDataHandler AsyncClient::_recv_cb = 0
protected

◆ _recv_cb_arg

void* AsyncClient::_recv_cb_arg = 0
protected

◆ _sent_cb

AcAckHandler AsyncClient::_sent_cb = 0
protected

◆ _sent_cb_arg

void* AsyncClient::_sent_cb_arg = 0
protected

◆ _timeout_cb

AcTimeoutHandler AsyncClient::_timeout_cb = 0
protected

◆ _timeout_cb_arg

void* AsyncClient::_timeout_cb_arg = 0
protected

◆ disconnectCalled

bool AsyncClient::disconnectCalled = false
protected

◆ mInputBuffer

char AsyncClient::mInputBuffer[TCP_MSS]
protected

◆ mSocket

tcp::socket AsyncClient::mSocket
protected

◆ mWriteBuffer

char AsyncClient::mWriteBuffer[TCP_MSS]
protected

◆ writing

bool AsyncClient::writing = false
protected

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