AlteriomPainlessMesh v2.1.1
Easy ESP32/ESP8266 mesh networking with Alteriom IoT extensions
Loading...
Searching...
No Matches
Enumerations | Functions
painlessmesh::router Namespace Reference

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)
 

Detailed Description

Helper functions to route messages

Enumeration Type Documentation

◆ Type

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 

Function Documentation

◆ addPackageCallback()

template<class T , typename U >
void painlessmesh::router::addPackageCallback ( callback::MeshPackageCallbackList< U > &  callbackList,
T &  mesh 
)

◆ broadcast() [1/4]

template<class T >
size_t painlessmesh::router::broadcast ( protocol::Variant &&  variant,
const layout::Layout< T > &  layout,
uint32_t  exclude 
)

◆ broadcast() [2/4]

template<class T >
size_t painlessmesh::router::broadcast ( protocol::Variant &  variant,
const layout::Layout< T > &  layout,
uint32_t  exclude 
)

◆ broadcast() [3/4]

template<class T , class U >
size_t painlessmesh::router::broadcast ( T &&  package,
const layout::Layout< U > &  layout,
uint32_t  exclude 
)

◆ broadcast() [4/4]

template<class T , class U >
size_t painlessmesh::router::broadcast ( T &  package,
const layout::Layout< U > &  layout,
uint32_t  exclude 
)

◆ findLiveRoute()

template<class T >
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.

◆ findRoute() [1/2]

template<class T >
std::shared_ptr< T > painlessmesh::router::findRoute ( const layout::Layout< T > &  tree,
std::function< bool(std::shared_ptr< T >)>  func 
)

◆ findRoute() [2/2]

template<class T >
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.

◆ handleNodeSync()

template<class T , class U >
void painlessmesh::router::handleNodeSync ( T &  mesh,
protocol::NodeTree  newTree,
std::shared_ptr< U >  conn 
)

◆ routePackage()

template<class T >
void painlessmesh::router::routePackage ( const layout::Layout< T > &  layout,
std::shared_ptr< T >  connection,
const TSTRING &  pkg,
callback::MeshPackageCallbackList< T > &  cbl,
uint32_t  receivedAt 
)

◆ send() [1/8]

template<class U >
bool painlessmesh::router::send ( protocol::Variant &&  variant,
const layout::Layout< U > &  layout 
)

◆ send() [2/8]

template<class U >
bool painlessmesh::router::send ( protocol::Variant &&  variant,
std::shared_ptr< U >  conn,
bool  priority = false 
)

◆ send() [3/8]

template<class U >
bool painlessmesh::router::send ( protocol::Variant &  variant,
const layout::Layout< U > &  layout 
)

◆ send() [4/8]

template<class U >
bool painlessmesh::router::send ( protocol::Variant &  variant,
std::shared_ptr< U >  conn,
bool  priority = false 
)

◆ send() [5/8]

template<class T , class U >
bool painlessmesh::router::send ( T &&  package,
const layout::Layout< U > &  layout 
)

◆ send() [6/8]

template<class T , class U >
bool painlessmesh::router::send ( T &&  package,
std::shared_ptr< U >  conn,
bool  priority = false 
)

◆ send() [7/8]

template<class T , class U >
bool painlessmesh::router::send ( T &  package,
const layout::Layout< U > &  layout 
)

◆ send() [8/8]

template<class T , class U >
bool painlessmesh::router::send ( T &  package,
std::shared_ptr< U >  conn,
bool  priority = false 
)

◆ sendWithPriority() [1/4]

template<class U >
bool painlessmesh::router::sendWithPriority ( protocol::Variant &&  variant,
std::shared_ptr< U >  conn,
uint8_t  priorityLevel 
)

◆ sendWithPriority() [2/4]

template<class U >
bool painlessmesh::router::sendWithPriority ( protocol::Variant &  variant,
std::shared_ptr< U >  conn,
uint8_t  priorityLevel 
)

◆ sendWithPriority() [3/4]

template<class T , class U >
bool painlessmesh::router::sendWithPriority ( T &&  package,
std::shared_ptr< U >  conn,
uint8_t  priorityLevel 
)

◆ sendWithPriority() [4/4]

template<class T , class U >
bool painlessmesh::router::sendWithPriority ( T &  package,
std::shared_ptr< U >  conn,
uint8_t  priorityLevel 
)