painlessMesh
|
#include <mesh.hpp>
Public Member Functions | |
void | init (uint32_t id) |
void | init (Scheduler *scheduler, uint32_t id) |
void | setRoot (bool on=true) |
void | setContainsRoot (bool on=true) |
bool | isRoot () |
void | setDebugMsgTypes (uint16_t types) |
void | stop () |
void | update (void) |
bool | sendSingle (uint32_t destId, TSTRING msg) |
bool | sendBroadcast (TSTRING msg, bool includeSelf=false) |
bool | startDelayMeas (uint32_t id) |
void | onReceive (receivedCallback_t onReceive) |
void | onNewConnection (newConnectionCallback_t onNewConnection) |
void | onDroppedConnection (droppedConnectionCallback_t onDroppedConnection) |
void | onChangedConnections (changedConnectionsCallback_t onChangedConnections) |
void | onNodeTimeAdjusted (nodeTimeAdjustedCallback_t onTimeAdjusted) |
void | onNodeDelayReceived (nodeDelayCallback_t onDelayReceived) |
bool | isConnected (uint32_t nodeId) |
std::list< uint32_t > | getNodeList (bool includeSelf=false) |
TSTRING | subConnectionJson (bool pretty=false) |
std::shared_ptr< Task > | addTask (unsigned long aInterval, long aIterations, std::function< void()> aCallback) |
std::shared_ptr< Task > | addTask (std::function< void()> aCallback) |
~Mesh () | |
Public Member Functions inherited from painlessmesh::ntp::MeshTime | |
uint32_t | getNodeTime () |
Public Member Functions inherited from painlessmesh::plugin::PackageHandler< T > | |
void | stop () |
~PackageHandler () | |
bool | sendPackage (const protocol::PackageInterface *pkg) |
void | onPackage (int type, std::function< bool(protocol::Variant)> function) |
std::shared_ptr< Task > | addTask (Scheduler &scheduler, unsigned long aInterval, long aIterations, std::function< void()> aCallback) |
std::shared_ptr< Task > | addTask (Scheduler &scheduler, std::function< void()> aCallback) |
Public Member Functions inherited from painlessmesh::layout::Layout< T > | |
uint32_t | getNodeId () |
protocol::NodeTree | asNodeTree () |
Protected Member Functions | |
void | setScheduler (Scheduler *baseScheduler) |
void | startTimeSync (std::shared_ptr< T > conn) |
bool | closeConnectionSTA () |
void | eraseClosedConnections () |
bool | semaphoreTake () |
void | semaphoreGive () |
Protected Attributes | |
callback::List< uint32_t > | newConnectionCallbacks |
callback::List< uint32_t, bool > | droppedConnectionCallbacks |
callback::List< uint32_t > | changedConnectionCallbacks |
nodeTimeAdjustedCallback_t | nodeTimeAdjustedCallback |
nodeDelayCallback_t | nodeDelayReceivedCallback |
bool | isExternalScheduler = false |
bool | shouldContainRoot |
Is the node a root node. More... | |
Scheduler * | mScheduler |
friend | T |
Protected Attributes inherited from painlessmesh::ntp::MeshTime | |
uint32_t | timeOffset = 0 |
Protected Attributes inherited from painlessmesh::plugin::PackageHandler< T > | |
callback::MeshPackageCallbackList< T > | callbackList |
std::list< std::shared_ptr< Task > > | taskList = {} |
Protected Attributes inherited from painlessmesh::layout::Layout< T > | |
uint32_t | nodeId = 0 |
bool | root = false |
Friends | |
void | onDataCb (void *, AsyncClient *, void *, size_t) |
void | tcpSentCb (void *, AsyncClient *, size_t, uint32_t) |
void | meshRecvCb (void *, AsyncClient *, void *, size_t) |
void | painlessmesh::ntp::handleTimeSync (Mesh &, painlessmesh::protocol::TimeSync, std::shared_ptr< T >, uint32_t) |
void | painlessmesh::ntp::handleTimeDelay (Mesh &, painlessmesh::protocol::TimeDelay, std::shared_ptr< T >, uint32_t) |
void | painlessmesh::router::handleNodeSync (Mesh &, protocol::NodeTree, std::shared_ptr< T > conn) |
void | painlessmesh::tcp::initServer (AsyncServer &, Mesh &) |
void | painlessmesh::tcp::connect (AsyncClient &, IPAddress, uint16_t, Mesh &) |
Additional Inherited Members | |
Public Attributes inherited from painlessmesh::layout::Layout< T > | |
size_t | stability = 0 |
std::list< std::shared_ptr< T > > | subs |
Main api class for the mesh
Brings all the functions together except for the WiFi functions
|
inline |
|
inline |
|
inline |
|
inlineprotected |
|
inlineprotected |
|
inline |
Get a list of all known nodes.
This includes nodes that are both directly and indirectly connected to the current node.
|
inline |
|
inline |
|
inline |
Are we connected/know a route to the given node?
nodeId | The nodeId we are looking for |
|
inline |
Check whether this node is a root node.
|
inline |
Callback that gets called every time the layout of the mesh changes
|
inline |
|
inline |
|
inline |
Callback that gets called when a delay measurement is received.
This fires when a time delay masurement response is received, after a request was sent.
|
inline |
Callback that gets called every time node time gets adjusted
Node time is automatically kept in sync in the mesh. This gets called whenever the time is to far out of sync with the rest of the mesh and gets adjusted.
|
inline |
Set a callback routine for any messages that are addressed to this node.
Every time this node receives a message, this callback routine will the called. “from” is the id of the original sender of the message, and “msg” is a string that contains the message. The message can be anything. A JSON, some other text string, or binary data.
|
inlineprotected |
Wrapper function for ESP32 semaphore give function
Does nothing on ESP8266 hardware
|
inlineprotected |
Wrapper function for ESP32 semaphore function
Waits for the semaphore to be available and then returns true
Always return true on ESP8266
|
inline |
Broadcast a message to every node on the mesh network.
includeSelf | Send message to myself as well. Default is false. |
|
inline |
Send message to a specific node
destId | The nodeId of the node to send it to. |
msg | The message to send |
|
inline |
The mesh should contains a root node
This will cause the mesh to restructure more quickly around the root node. Note that this could have adverse effects if set, while there is no root node present. Also see painlessMesh::setRoot().
|
inline |
|
inline |
Set the node as an root/master node for the mesh
This is an optional setting that can speed up mesh formation. At most one node in the mesh should be a root, or you could end up with multiple subMeshes.
We recommend any AP_ONLY nodes (e.g. a bridgeNode) to be set as a root node.
If one node is root, then it is also recommended to call painlessMesh::setContainsRoot() on all the nodes in the mesh.
|
inlineprotected |
|
inline |
Sends a node a packet to measure network trip delay to that node.
After calling this function, user program have to wait to the response in the form of a callback specified by onNodeDelayReceived().
|
inlineprotected |
|
inline |
Disconnect and stop this node
|
inline |
Return a json representation of the current mesh layout
|
inline |
Perform crucial maintenance task
Add this to your loop() function. This routine runs various maintenance tasks.
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
Is the node a root node.
|
protected |