|
AlteriomPainlessMesh v2.1.1
Easy ESP32/ESP8266 mesh networking with Alteriom IoT extensions
|
Enumerations | |
| enum | Type { ROUTING_ERROR = -1 , NEIGHBOUR , SINGLE , BROADCAST } |
Functions | |
| template<class T > | |
| std::shared_ptr< T > | findRoute (const layout::Layout< T > &tree, std::function< bool(std::shared_ptr< T >)> func) |
| template<class T > | |
| std::shared_ptr< T > | findRoute (const layout::Layout< T > &tree, uint32_t nodeId) |
| template<class T > | |
| std::shared_ptr< T > | findLiveRoute (const layout::Layout< T > &tree, uint32_t nodeId, std::shared_ptr< T > exclude=nullptr) |
| template<class T , class U > | |
| bool | send (T &package, std::shared_ptr< U > conn, bool priority=false) |
| template<class T , class U > | |
| bool | send (T &&package, std::shared_ptr< U > conn, bool priority=false) |
| template<class U > | |
| bool | send (protocol::Variant &variant, std::shared_ptr< U > conn, bool priority=false) |
| template<class U > | |
| bool | send (protocol::Variant &&variant, std::shared_ptr< U > conn, bool priority=false) |
| template<class T , class U > | |
| bool | sendWithPriority (T &package, std::shared_ptr< U > conn, uint8_t priorityLevel) |
| template<class T , class U > | |
| bool | sendWithPriority (T &&package, std::shared_ptr< U > conn, uint8_t priorityLevel) |
| template<class U > | |
| bool | sendWithPriority (protocol::Variant &variant, std::shared_ptr< U > conn, uint8_t priorityLevel) |
| template<class U > | |
| bool | sendWithPriority (protocol::Variant &&variant, std::shared_ptr< U > conn, uint8_t priorityLevel) |
| template<class U > | |
| bool | send (protocol::Variant &variant, const layout::Layout< U > &layout) |
| template<class T , class U > | |
| bool | send (T &package, const layout::Layout< U > &layout) |
| template<class T , class U > | |
| bool | send (T &&package, const layout::Layout< U > &layout) |
| template<class U > | |
| bool | send (protocol::Variant &&variant, const layout::Layout< U > &layout) |
| template<class T > | |
| size_t | broadcast (protocol::Variant &variant, const layout::Layout< T > &layout, uint32_t exclude) |
| template<class T , class U > | |
| size_t | broadcast (T &package, const layout::Layout< U > &layout, uint32_t exclude) |
| template<class T , class U > | |
| size_t | broadcast (T &&package, const layout::Layout< U > &layout, uint32_t exclude) |
| template<class T > | |
| size_t | broadcast (protocol::Variant &&variant, const layout::Layout< T > &layout, uint32_t exclude) |
| template<class T > | |
| void | routePackage (const layout::Layout< T > &layout, std::shared_ptr< T > connection, const TSTRING &pkg, callback::MeshPackageCallbackList< T > &cbl, uint32_t receivedAt) |
| template<class T , class U > | |
| void | handleNodeSync (T &mesh, protocol::NodeTree newTree, std::shared_ptr< U > conn) |
| template<class T , typename U > | |
| void | addPackageCallback (callback::MeshPackageCallbackList< U > &callbackList, T &mesh) |
Helper functions to route messages
Different ways to route packages
NEIGHBOUR packages are send to the neighbour and will be immediately handled there. The TIME_SYNC and NODE_SYNC packages are NEIGHBOUR. SINGLE messages are meant for a specific node. When another node receives this message, it will look in its routing information and send it on to the correct node, without processing the message in any other way. Only the targetted node will actually parse/handle this message (without sending it on). Finally, BROADCAST message are send to every node and processed/handled by every node.
| Enumerator | |
|---|---|
| ROUTING_ERROR | |
| NEIGHBOUR | |
| SINGLE | |
| BROADCAST | |
| void painlessmesh::router::addPackageCallback | ( | callback::MeshPackageCallbackList< U > & | callbackList, |
| T & | mesh | ||
| ) |
| size_t painlessmesh::router::broadcast | ( | protocol::Variant && | variant, |
| const layout::Layout< T > & | layout, | ||
| uint32_t | exclude | ||
| ) |
| size_t painlessmesh::router::broadcast | ( | protocol::Variant & | variant, |
| const layout::Layout< T > & | layout, | ||
| uint32_t | exclude | ||
| ) |
| size_t painlessmesh::router::broadcast | ( | T && | package, |
| const layout::Layout< U > & | layout, | ||
| uint32_t | exclude | ||
| ) |
| size_t painlessmesh::router::broadcast | ( | T & | package, |
| const layout::Layout< U > & | layout, | ||
| uint32_t | exclude | ||
| ) |
| std::shared_ptr< T > painlessmesh::router::findLiveRoute | ( | const layout::Layout< T > & | tree, |
| uint32_t | nodeId, | ||
| std::shared_ptr< T > | exclude = nullptr |
||
| ) |
findRoute() for the duplicate-connection check in handleNodeSync().
exclude drops the connection being judged, which cannot duplicate itself. Refusing a live direct connection on the authority of a dead route left a node with neither once the dead one was erased.
| std::shared_ptr< T > painlessmesh::router::findRoute | ( | const layout::Layout< T > & | tree, |
| std::function< bool(std::shared_ptr< T >)> | func | ||
| ) |
| std::shared_ptr< T > painlessmesh::router::findRoute | ( | const layout::Layout< T > & | tree, |
| uint32_t | nodeId | ||
| ) |
The live connection through which nodeId is reachable, or NULL.
A closed connection stays in subs until eraseClosedConnections() next runs. Routing a packet to it is a silent loss: the write is queued into a buffer nothing will ever drain, and the sender is told it succeeded. On the Alteriom HIL rig, correlating every unacknowledged delivery with the receiver's log showed the message had usually never arrived at all — 27 of 33 across three suites — which is this. A dead link is not a route, for any purpose; the liveness test is the one layout::syncLayout() already applies.
| void painlessmesh::router::handleNodeSync | ( | T & | mesh, |
| protocol::NodeTree | newTree, | ||
| std::shared_ptr< U > | conn | ||
| ) |
| void painlessmesh::router::routePackage | ( | const layout::Layout< T > & | layout, |
| std::shared_ptr< T > | connection, | ||
| const TSTRING & | pkg, | ||
| callback::MeshPackageCallbackList< T > & | cbl, | ||
| uint32_t | receivedAt | ||
| ) |
| bool painlessmesh::router::send | ( | protocol::Variant && | variant, |
| const layout::Layout< U > & | layout | ||
| ) |
| bool painlessmesh::router::send | ( | protocol::Variant && | variant, |
| std::shared_ptr< U > | conn, | ||
| bool | priority = false |
||
| ) |
| bool painlessmesh::router::send | ( | protocol::Variant & | variant, |
| const layout::Layout< U > & | layout | ||
| ) |
| bool painlessmesh::router::send | ( | protocol::Variant & | variant, |
| std::shared_ptr< U > | conn, | ||
| bool | priority = false |
||
| ) |
| bool painlessmesh::router::send | ( | T && | package, |
| const layout::Layout< U > & | layout | ||
| ) |
| bool painlessmesh::router::send | ( | T && | package, |
| std::shared_ptr< U > | conn, | ||
| bool | priority = false |
||
| ) |
| bool painlessmesh::router::send | ( | T & | package, |
| const layout::Layout< U > & | layout | ||
| ) |
| bool painlessmesh::router::send | ( | T & | package, |
| std::shared_ptr< U > | conn, | ||
| bool | priority = false |
||
| ) |
| bool painlessmesh::router::sendWithPriority | ( | protocol::Variant && | variant, |
| std::shared_ptr< U > | conn, | ||
| uint8_t | priorityLevel | ||
| ) |
| bool painlessmesh::router::sendWithPriority | ( | protocol::Variant & | variant, |
| std::shared_ptr< U > | conn, | ||
| uint8_t | priorityLevel | ||
| ) |
| bool painlessmesh::router::sendWithPriority | ( | T && | package, |
| std::shared_ptr< U > | conn, | ||
| uint8_t | priorityLevel | ||
| ) |
| bool painlessmesh::router::sendWithPriority | ( | T & | package, |
| std::shared_ptr< U > | conn, | ||
| uint8_t | priorityLevel | ||
| ) |