|
AlteriomPainlessMesh v2.1.1
Easy ESP32/ESP8266 mesh networking with Alteriom IoT extensions
|
#include <connection.hpp>


Public Member Functions | |
| BufferedConnection (AsyncClient *client) | |
| ~BufferedConnection () | |
| void | initialize (Scheduler *scheduler) |
| void | close () |
| bool | write (const TSTRING &data, bool priority=false) |
| bool | writeWithPriority (const TSTRING &data, uint8_t priorityLevel) |
| void | onDisconnect (std::function< void()> callback) |
| void | onReceive (std::function< void(TSTRING)> callback) |
| bool | connected () |
Protected Member Functions | |
| bool | writeNext () |
| template<typename T > | |
| std::shared_ptr< T > | shared_from (T *derived) |
Protected Attributes | |
| bool | mConnected = true |
| AsyncClient * | client |
| Scheduler * | mScheduler = nullptr |
| std::function< void(TSTRING)> | receiveCallback |
| std::function< void()> | disconnectCallback |
| painlessmesh::buffer::ReceiveBuffer< TSTRING > | receiveBuffer |
| painlessmesh::buffer::SentBuffer< TSTRING > | sentBuffer |
| Task | sentBufferTask |
| Task | readBufferTask |
Class that performs buffered read and write to the tcp connection (asyncclient)
Note that the class expects to be wrapped in a shared_ptr to ensure proper lifetime management. Objects generally will only be destroyed after close is called (and the reading and writing tasks are stopped).
|
inline |
Create a buffered connection around the client
BufferedConnection takes ownership of the client and will delete the pointer at the end.
One should always call initialize after construction
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inlineprotected |
|
inline |
|
inlineprotected |
|
inline |
Write data with explicit priority level (0-3)
| data | The data to send |
| priorityLevel | Priority level: 0=CRITICAL, 1=HIGH, 2=NORMAL, 3=LOW |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |