AlteriomPainlessMesh v2.1.1
Easy ESP32/ESP8266 mesh networking with Alteriom IoT extensions
Loading...
Searching...
No Matches
Classes | Public Member Functions | Public Attributes | Static Public Attributes | Protected Member Functions | Protected Attributes | Static Protected Attributes | Friends | List of all members
painlessmesh::Mesh< T > Class Template Reference

#include <mesh.hpp>

Inheritance diagram for painlessmesh::Mesh< T >:
Inheritance graph
[legend]
Collaboration diagram for painlessmesh::Mesh< T >:
Collaboration graph
[legend]

Classes

struct  ConnectionInfo
 

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 sendSingle (uint32_t destId, TSTRING msg, uint8_t priorityLevel)
 
bool sendSingle (uint32_t destId, TSTRING msg, const SendOptions &options)
 
bool sendSingle (uint32_t destId, TSTRING msg, ack::deliveryCallback_t ackCallback, uint32_t ackTimeoutMs=5000)
 
bool sendBroadcast (TSTRING msg, bool includeSelf=false)
 
bool sendBroadcast (TSTRING msg, const SendOptions &options, bool includeSelf=false)
 
bool sendBroadcast (TSTRING msg, bool includeSelf, ack::deliveryCallback_t ackCallback, uint32_t ackTimeoutMs=5000)
 
size_t checkAcks ()
 
size_t pendingAcks () const
 
template<typename Priority , typename IncludeSelf = bool, typename std::enable_if<(std::is_integral< typename std::decay< Priority >::type >::value||std::is_enum< typename std::decay< Priority >::type >::value) &&!std::is_same< typename std::decay< Priority >::type, bool >::value &&std::is_same< typename std::decay< IncludeSelf >::type, bool >::value, int >::type = 0>
bool sendBroadcast (TSTRING msg, Priority priorityLevel, IncludeSelf 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)
 
void onBridgeStatusChanged (bridgeStatusChangedCallback_t onBridgeStatusChanged)
 
bool hasInternetConnection ()
 
std::vector< uint32_t > getNodesWithInternet ()
 
std::vector< BridgeInfo > getBridges ()
 
BridgeInfo * getPrimaryBridge ()
 
BridgeInfo * getLastKnownBridge ()
 
bool hasActiveMeshConnections ()
 
bool isBridge ()
 
size_t apChildren ()
 
bool overCapacity ()
 
bool capacityCheck (uint32_t freeHeap, uint32_t floor)
 
bool isPrimaryGateway ()
 
uint32_t getPrimaryGateway ()
 
std::list< uint32_t > getGateways ()
 
size_t getGatewayCount ()
 
void onGatewayChanged (gatewayChangedCallback_t callback)
 
void setBridgeStatusInterval (uint32_t intervalMs)
 
void setBridgeTimeout (uint32_t timeoutMs)
 
void enableBridgeStatusBroadcast (bool enabled)
 
bool forgetBridge (uint32_t bridgeNodeId)
 
void cleanupExpiredBridges ()
 
void enableBridgeCleanup ()
 
void disableBridgeCleanup ()
 
bool isBridgeCleanupEnabled () const
 
bool hasLocalInternet ()
 
bool uplinkServesLocally ()
 
void onLocalInternetChanged (localInternetChangedCallback_t callback)
 
gateway::InternetStatus getInternetStatus ()
 
void configureInternetHealthCheck (const gateway::SharedGatewayConfig &config)
 
void setInternetCheckTarget (const TSTRING &host, uint16_t port=53)
 
void setInternetCheckInterval (uint32_t intervalMs)
 
void setInternetCheckTimeout (uint32_t timeoutMs)
 
bool checkInternetNow ()
 
void enableInternetHealthCheck ()
 
void disableInternetHealthCheck ()
 
bool isInternetHealthCheckEnabled () const
 
void resetInternetHealthStats ()
 
uint32_t sendToInternet (TSTRING destination, TSTRING payload, internetResultCallback_t callback, uint8_t priority=static_cast< uint8_t >(gateway::GatewayPriority::PRIORITY_NORMAL))
 
uint32_t sendToInternet (TSTRING destination, TSTRING payload, internetResponseCallback_t onResult, uint8_t priority=static_cast< uint8_t >(gateway::GatewayPriority::PRIORITY_NORMAL))
 
void setInternetRequestTimeout (uint32_t timeoutMs)
 
void setInternetRetryCount (uint8_t retryCount)
 
void setInternetRetryDelay (uint32_t delayMs)
 
void setTcpRetryConfig (const painlessmesh::tcp::TcpRetryConfig &config)
 
painlessmesh::tcp::TcpRetryConfig getTcpRetryConfig () const
 
size_t getPendingInternetRequestCount () const
 
bool cancelInternetRequest (uint32_t messageId)
 
void enableSendToInternet ()
 
void disableSendToInternet ()
 
bool isSendToInternetEnabled () const
 
void sendGatewayAck (const gateway::GatewayDataPackage &request, bool success, uint16_t httpStatus, const TSTRING &error, std::shared_ptr< T > ingressConnection=nullptr, const TSTRING &response=TSTRING(), int8_t retryable=-1, uint32_t retryAfterMs=0)
 
void updateBridgeStatus (uint32_t bridgeNodeId, bool internetConnected, int8_t routerRSSI, uint8_t routerChannel, uint32_t uptime, TSTRING gatewayIP, uint32_t timestamp)
 
bool enableRTC (rtc::RTCInterface *rtcInterface)
 
void disableRTC ()
 
bool syncRTCFromNTP (uint32_t ntpTimestamp)
 
uint32_t getAccurateTime ()
 
bool hasRTC () const
 
rtc::RTCType getRTCType () const
 
uint32_t getTimeSinceRTCSync () const
 
void onRTCSyncComplete (rtcSyncCompleteCallback_t onRTCSyncComplete)
 
void setTimeAuthority (bool hasAuthority)
 
bool getTimeAuthority () const
 
void enableMessageQueue (bool enabled, uint32_t maxSize=1000)
 
uint32_t queueMessage (const TSTRING &payload, const TSTRING &destination="", MessagePriority priority=PRIORITY_NORMAL)
 
std::vector< QueuedMessage > flushMessageQueue ()
 
bool removeQueuedMessage (uint32_t messageId)
 
uint32_t incrementQueuedMessageAttempts (uint32_t messageId)
 
uint32_t getQueuedMessageCount (MessagePriority priority)
 
uint32_t getQueuedMessageCount ()
 
QueueStats getQueueStats ()
 
void onQueueStateChanged (queueStateChangedCallback_t callback)
 
uint32_t pruneQueue (uint32_t maxAgeMs)
 
void clearQueue ()
 
bool isConnected (uint32_t nodeId)
 
std::list< uint32_t > getNodeList (bool includeSelf=false)
 
TSTRING subConnectionJson (bool pretty=false)
 
std::vector< ConnectionInfo > getConnectionDetails ()
 
int getHopCount (uint32_t nodeId)
 
std::map< uint32_t, uint32_t > getRoutingTable ()
 
std::vector< uint32_t > getPathToNode (uint32_t nodeId)
 
BridgeHealthMetrics getBridgeHealthMetrics ()
 
void resetHealthMetrics ()
 
TSTRING getHealthMetricsJSON ()
 
void onHealthMetricsUpdate (std::function< void(BridgeHealthMetrics)> callback, uint32_t intervalMs=60000)
 
void enableDiagnostics (bool enabled=true)
 
BridgeStatus getBridgeStatus ()
 
std::vector< ElectionRecord > getElectionHistory ()
 
BridgeChangeEvent getLastBridgeChange ()
 
TSTRING exportTopologyDOT ()
 
BridgeTestResult testBridgeConnectivity ()
 
bool isBridgeReachable (uint32_t bridgeNodeId)
 
TSTRING getDiagnosticReport ()
 
std::shared_ptr< Task > addTask (unsigned long aInterval, long aIterations, std::function< void()> aCallback)
 
std::shared_ptr< Task > addTask (std::function< void()> aCallback)
 
std::shared_ptr< Task > addTask (std::function< void()> aCallback, unsigned long delayMs)
 
 ~Mesh ()
 
void startTimeSync (std::shared_ptr< T > conn)
 
bool getNodeNeighbors (const protocol::NodeTree &tree, uint32_t nodeId, std::list< uint32_t > &neighbors, uint32_t parent=0) const
 
bool closeConnectionSTA ()
 
void eraseClosedConnections ()
 
bool semaphoreTake ()
 
void semaphoreGive ()
 
- Public Member Functions inherited from painlessmesh::ntp::MeshTime
uint32_t getNodeTime ()
 
- Public Member Functions inherited from painlessmesh::plugin::PackageHandler< T >
void stop (Scheduler *scheduler=nullptr)
 
 ~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 () const
 
bool isRoot () const
 
protocol::NodeTree asNodeTree ()
 

Public Attributes

callback::List< uint32_t > newConnectionCallbacks
 
callback::List< uint32_t, bool > droppedConnectionCallbacks
 
callback::List< uint32_t > changedConnectionCallbacks
 
nodeTimeAdjustedCallback_t nodeTimeAdjustedCallback
 
nodeDelayCallback_t nodeDelayReceivedCallback
 
bridgeStatusChangedCallback_t bridgeStatusChangedCallback
 
rtcSyncCompleteCallback_t rtcSyncCompleteCallback
 
gatewayChangedCallback_t gatewayChangedCallback
 
MessageQueue * messageQueue = nullptr
 
bool isExternalScheduler = false
 
bool shouldContainRoot = false
 Is the node a root node.
 
Scheduler * mScheduler = nullptr
 
std::vector< BridgeInfo > knownBridges
 
uint32_t bridgeStatusIntervalMs = 30000
 
uint32_t bridgeTimeoutMs = 60000
 
bool bridgeStatusBroadcastEnabled = true
 
bool _overCapacity = false
 
uint32_t _capacityWarnedAt = 0
 
std::shared_ptr< Task > bridgeCleanupTask = nullptr
 
uint32_t metricsDisconnectCount = 0
 
rtc::RTCManager rtcManager
 
bool diagnosticsEnabled = false
 
std::vector< ElectionRecord > electionHistory
 
BridgeChangeEvent lastBridgeChange
 
uint32_t lastBridgeChangeTime = 0
 
gateway::InternetHealthChecker internetHealthChecker
 
std::shared_ptr< Task > internetHealthCheckTask = nullptr
 
localInternetChangedCallback_t localInternetChangedCallback
 
std::map< uint32_t, PendingInternetRequest > pendingInternetRequests
 
std::shared_ptr< Task > internetCleanupTask = nullptr
 
uint32_t internetRequestTimeout = 30000
 
uint8_t internetRetryCount = 3
 
uint32_t internetRetryDelay = 1000
 
bool sendToInternetEnabled = false
 
painlessmesh::tcp::TcpRetryConfig tcpRetryConfig
 
friend T
 
- Public Attributes inherited from painlessmesh::ntp::MeshTime
uint32_t timeOffset = 0
 
- Public Attributes inherited from painlessmesh::layout::Layout< T >
size_t stability = 0
 
std::list< std::shared_ptr< T > > subs
 

Static Public Attributes

static constexpr uint32_t ESP8266_CAPACITY_FLOOR = 12 * 1024
 
static constexpr uint32_t CAPACITY_WARN_INTERVAL_MS = 5 * 60 * 1000
 
static const size_t MAX_KNOWN_BRIDGES = 20
 
static const size_t MAX_ELECTION_HISTORY = 10
 

Protected Member Functions

void reclaimRetiredSchedulers ()
 
void queueBroadcastAck (uint32_t origin, uint32_t msgId)
 
void ensureAckScheduling ()
 
void setScheduler (Scheduler *baseScheduler)
 
- Protected Member Functions inherited from painlessmesh::plugin::PackageHandler< T >
void reclaimQuarantinedTasks ()
 

Protected Attributes

std::list< Scheduler * > retiredSchedulers = {}
 
ack::AckTracker ackTracker
 
std::shared_ptr< Task > ackCheckTask
 
std::vector< std::pair< uint32_t, uint32_t > > pendingBroadcastAcks
 
std::shared_ptr< Task > broadcastAckTask
 
- Protected Attributes inherited from painlessmesh::plugin::PackageHandler< T >
callback::MeshPackageCallbackList< T > callbackList
 
std::list< std::shared_ptr< Task > > taskList = {}
 
std::list< std::pair< Scheduler *, std::shared_ptr< Task > > > quarantinedTasks
 
- Protected Attributes inherited from painlessmesh::layout::Layout< T >
uint32_t nodeId = 0
 
bool root = false
 
bool hasTimeAuthority = false
 

Static Protected Attributes

static constexpr unsigned long ACK_CHECK_INTERVAL_MS
 
static constexpr uint32_t ACK_BROADCAST_JITTER_MS = 50
 
static constexpr uint32_t ACK_BROADCAST_MIN_TIMEOUT_MS = 1000
 
static constexpr size_t MAX_QUEUED_BROADCAST_ACKS
 

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 &, uint8_t)
 

Detailed Description

template<class T>
class painlessmesh::Mesh< T >

Main api class for the mesh

Brings all the functions together except for the WiFi functions

Constructor & Destructor Documentation

◆ ~Mesh()

template<class T >
painlessmesh::Mesh< T >::~Mesh ( )
inline

Member Function Documentation

◆ addTask() [1/3]

template<class T >
std::shared_ptr< Task > painlessmesh::Mesh< T >::addTask ( std::function< void()>  aCallback)
inline

◆ addTask() [2/3]

template<class T >
std::shared_ptr< Task > painlessmesh::Mesh< T >::addTask ( std::function< void()>  aCallback,
unsigned long  delayMs 
)
inline

Add a one-shot delayed task

Parameters
aCallbackFunction to call after the delay
delayMsDelay in milliseconds before executing the callback
Returns
Shared pointer to the task

◆ addTask() [3/3]

template<class T >
std::shared_ptr< Task > painlessmesh::Mesh< T >::addTask ( unsigned long  aInterval,
long  aIterations,
std::function< void()>  aCallback 
)
inline

◆ apChildren()

template<class T >
size_t painlessmesh::Mesh< T >::apChildren ( )
inline

Live connections for which this node is the access point.

Every one of them holds send and receive buffers on this node's heap. A leaf has none; a node the mesh routes through has as many as attach.

◆ cancelInternetRequest()

template<class T >
bool painlessmesh::Mesh< T >::cancelInternetRequest ( uint32_t  messageId)
inline

Cancel a pending Internet request

Parameters
messageIdMessage ID to cancel
Returns
true if request was found and cancelled

◆ capacityCheck()

template<class T >
bool painlessmesh::Mesh< T >::capacityCheck ( uint32_t  freeHeap,
uint32_t  floor 
)
inline

Evaluate the capacity rule now. Returns the new state.

Parameters
freeHeapthe part's current free heap in bytes
floorbelow this, with more than one child, is over capacity

◆ checkAcks()

template<class T >
size_t painlessmesh::Mesh< T >::checkAcks ( )
inline

Process pending delivery acknowledgments (non-blocking poll)

Schedules timeout callbacks for messages whose acknowledgment window has elapsed. Callbacks run on a later scheduler pass, after the current mesh dispatch has unwound. This also happens automatically inside mesh.update(), so calling it manually is only needed in tight loops that want prompt timeout detection.

Returns
Number of messages still awaiting acknowledgment

◆ checkInternetNow()

template<class T >
bool painlessmesh::Mesh< T >::checkInternetNow ( )
inline

Perform an immediate Internet connectivity check

Bypasses the periodic check schedule and performs an immediate check. Fires the onLocalInternetChanged callback if status changes.

Returns
true if Internet is reachable

◆ cleanupExpiredBridges()

template<class T >
void painlessmesh::Mesh< T >::cleanupExpiredBridges ( )
inline

◆ clearQueue()

template<class T >
void painlessmesh::Mesh< T >::clearQueue ( )
inline

Clear all messages from the queue

◆ closeConnectionSTA()

template<class T >
bool painlessmesh::Mesh< T >::closeConnectionSTA ( )
inline

◆ configureInternetHealthCheck()

template<class T >
void painlessmesh::Mesh< T >::configureInternetHealthCheck ( const gateway::SharedGatewayConfig &  config)
inline

Configure Internet health checker with gateway settings

Sets up the health checker with parameters from SharedGatewayConfig. This should be called before enabling gateway mode.

Parameters
configGateway configuration with check parameters

◆ disableBridgeCleanup()

template<class T >
void painlessmesh::Mesh< T >::disableBridgeCleanup ( )
inline

Disable periodic cleanup of expired bridge entries

◆ disableInternetHealthCheck()

template<class T >
void painlessmesh::Mesh< T >::disableInternetHealthCheck ( )
inline

Disable periodic Internet health checking

◆ disableRTC()

template<class T >
void painlessmesh::Mesh< T >::disableRTC ( )
inline

Disable RTC integration

◆ disableSendToInternet()

template<class T >
void painlessmesh::Mesh< T >::disableSendToInternet ( )
inline

Disable the sendToInternet() API

◆ enableBridgeCleanup()

template<class T >
void painlessmesh::Mesh< T >::enableBridgeCleanup ( )
inline

Enable periodic cleanup of expired bridge entries

Starts a background task that periodically removes stale bridge entries. The cleanup runs at the same interval as the bridge timeout (default 60 seconds).

This is recommended for all nodes to prevent memory growth from accumulating stale bridge entries.

mesh.enableBridgeCleanup(); // Start automatic cleanup

◆ enableBridgeStatusBroadcast()

template<class T >
void painlessmesh::Mesh< T >::enableBridgeStatusBroadcast ( bool  enabled)
inline

Enable or disable bridge status broadcasting (bridge nodes only)

Parameters
enabledtrue to enable broadcasting (default), false to disable

◆ enableDiagnostics()

template<class T >
void painlessmesh::Mesh< T >::enableDiagnostics ( bool  enabled = true)
inline

Enable or disable diagnostics collection

When enabled, the mesh will track election history, bridge changes, and other diagnostic information. This has minimal overhead.

Parameters
enabledtrue to enable diagnostics (default), false to disable

◆ enableInternetHealthCheck()

template<class T >
void painlessmesh::Mesh< T >::enableInternetHealthCheck ( )
inline

Enable periodic Internet health checking

Starts a TaskScheduler task that periodically checks Internet connectivity. The check interval is configured via setInternetCheckInterval() or configureInternetHealthCheck().

mesh.enableInternetHealthCheck(); // Use default 30 second interval
// or
mesh.setInternetCheckInterval(15000); // 15 seconds
mesh.enableInternetHealthCheck();

◆ enableMessageQueue()

template<class T >
void painlessmesh::Mesh< T >::enableMessageQueue ( bool  enabled,
uint32_t  maxSize = 1000 
)
inline

Enable or disable the manual message queue for offline mode

When enabled, allocates a MessageQueue that your application can push into while an upstream (MQTT/HTTP/etc.) is unreachable. The mesh does NOT flush the queue automatically and does NOT observe connectivity changes — the app is responsible for detecting when to drain it via flushMessageQueue() + removeQueuedMessage().

Wire it to your own connectivity signal, for example onLocalInternetChanged on the bridge node or onBridgeStatusChanged on downstream nodes.

Parameters
enabledTrue to enable queueing, false to disable
maxSizeMaximum number of messages in queue (default 1000)
mesh.enableMessageQueue(true, 500); // Enable with 500 message capacity
mesh.onLocalInternetChanged([&mesh](bool available) {
if (available) {
auto messages = mesh.flushMessageQueue();
for (auto& msg : messages) {
if (sendToCloud(msg.payload, msg.destination)) {
mesh.removeQueuedMessage(msg.id);
}
}
}
});

◆ enableRTC()

template<class T >
bool painlessmesh::Mesh< T >::enableRTC ( rtc::RTCInterface *  rtcInterface)
inline

Enable RTC integration for offline timekeeping

Allows nodes to maintain accurate timestamps even when Internet/bridge is unavailable. User must provide an implementation of RTCInterface for their specific RTC hardware.

// Example with DS3231 RTC
class MyRTC : public painlessmesh::rtc::RTCInterface {
// ... implement interface methods ...
};
MyRTC myRTC;
mesh.enableRTC(&myRTC);
Definition rtc.hpp:30
Parameters
rtcInterfacePointer to user's RTC implementation
Returns
true if RTC enabled successfully, false otherwise

◆ enableSendToInternet()

template<class T >
void painlessmesh::Mesh< T >::enableSendToInternet ( )
inline

Enable the sendToInternet() API

This registers the handler for GatewayAckPackage (Type 621) and starts the periodic cleanup of timed-out requests.

Call this after mesh.init() to enable the sendToInternet() functionality.

mesh.init(MESH_PREFIX, MESH_PASSWORD, &userScheduler, MESH_PORT);
mesh.enableSendToInternet(); // Enable the API

◆ ensureAckScheduling()

template<class T >
void painlessmesh::Mesh< T >::ensureAckScheduling ( )
inlineprotected

Make sure the periodic ack-timeout task is running

The task disables itself as soon as no acknowledgments are pending, so there is zero scheduler overhead when the ack API is not in use.

◆ eraseClosedConnections()

template<class T >
void painlessmesh::Mesh< T >::eraseClosedConnections ( )
inline

◆ exportTopologyDOT()

template<class T >
TSTRING painlessmesh::Mesh< T >::exportTopologyDOT ( )
inline

Export topology as DOT format (Graphviz)

Generates a GraphViz DOT format representation of the mesh topology. Can be visualized using Graphviz tools.

String dot = mesh.exportTopologyDOT();
Serial.println(dot);
// Save to file or send to visualization tool
Returns
String containing DOT format graph

◆ flushMessageQueue()

template<class T >
std::vector< QueuedMessage > painlessmesh::Mesh< T >::flushMessageQueue ( )
inline

Return a snapshot of all queued messages for manual delivery

This does NOT transmit anything and does NOT clear the queue. The application is responsible for actually sending each message and calling removeQueuedMessage(id) for each one that succeeded. Messages left in the queue remain available for retry on the next flush.

Returns
Vector of queued messages to send
auto messages = mesh.flushMessageQueue();
for (auto& msg : messages) {
if (sendToCloud(msg.payload, msg.destination)) {
mesh.removeQueuedMessage(msg.id);
}
}

◆ forgetBridge()

template<class T >
bool painlessmesh::Mesh< T >::forgetBridge ( uint32_t  bridgeNodeId)
inline

Clean up expired bridge entries that haven't reported recently

Removes bridges that haven't sent a status update within the timeout period. This helps maintain an accurate list of available gateways and prevents the bridge list from growing unbounded.

Called periodically when bridge cleanup is enabled, or can be called manually.

// Manual cleanup
mesh.cleanupExpiredBridges();
// Or enable automatic cleanup (recommended)
mesh.enableBridgeCleanup();

Forget one bridge now: it announced that it is stepping down.

Returns whether it was known.

◆ getAccurateTime()

template<class T >
uint32_t painlessmesh::Mesh< T >::getAccurateTime ( )
inline

Get accurate time with RTC fallback

Returns time from RTC if available, otherwise falls back to mesh time. This provides the most accurate timestamp available to the node.

Returns
Unix timestamp in seconds, or mesh time in microseconds if RTC unavailable

◆ getBridgeHealthMetrics()

template<class T >
BridgeHealthMetrics painlessmesh::Mesh< T >::getBridgeHealthMetrics ( )
inline

Get bridge health metrics

Collects comprehensive health metrics including connectivity, signal quality, traffic, and performance data. Useful for monitoring and troubleshooting.

auto metrics = mesh.getBridgeHealthMetrics();
Serial.printf("Uptime: %u s, Messages RX: %u, Avg Latency: %u ms\n",
metrics.uptimeSeconds, metrics.messagesRx, metrics.avgLatencyMs);
Returns
BridgeHealthMetrics structure with current metrics

◆ getBridges()

template<class T >
std::vector< BridgeInfo > painlessmesh::Mesh< T >::getBridges ( )
inline

Get list of all known bridges in the mesh

Returns
vector of BridgeInfo objects for all tracked bridges

◆ getBridgeStatus()

template<class T >
BridgeStatus painlessmesh::Mesh< T >::getBridgeStatus ( )
inline

Get current bridge status

Returns information about this node's bridge role and connectivity status

auto status = mesh.getBridgeStatus();
if (status.isBridge && status.internetConnected) {
Serial.println("I am bridge with Internet");
}
Returns
BridgeStatus structure with current status

◆ getConnectionDetails()

template<class T >
std::vector< ConnectionInfo > painlessmesh::Mesh< T >::getConnectionDetails ( )
inline

Get detailed connection information for all direct neighbors

◆ getDiagnosticReport()

template<class T >
TSTRING painlessmesh::Mesh< T >::getDiagnosticReport ( )
inline

Get comprehensive diagnostic report

Generates a human-readable diagnostic report with mesh status, bridge info, connectivity, and performance metrics. Useful for debugging and monitoring.

Serial.println(mesh.getDiagnosticReport());
// Example output:
// === painlessMesh Diagnostics ===
// Mode: Regular Node
// Mesh: ProductionMesh (25 nodes)
// Bridge: 123456789 (RSSI: -42 dBm, Internet: ✓)
// Queue: 3 messages (2 CRITICAL, 1 NORMAL)
// Uptime: 02:15:33
// Last Election: 00:45:12 ago (Winner: 123456789)
Returns
String containing formatted diagnostic report

◆ getElectionHistory()

template<class T >
std::vector< ElectionRecord > painlessmesh::Mesh< T >::getElectionHistory ( )
inline

Get election history

Returns list of recent bridge elections if diagnostics are enabled. History is limited to last 10 elections.

auto history = mesh.getElectionHistory();
for (const auto& record : history) {
Serial.printf("Election: winner=%u, RSSI=%d, candidates=%u\n",
record.winnerNodeId, record.winnerRSSI, record.candidateCount);
}
Returns
Vector of ElectionRecord structures

◆ getGatewayCount()

template<class T >
size_t painlessmesh::Mesh< T >::getGatewayCount ( )
inline

Get count of available gateways

Returns the number of healthy bridges with active Internet connectivity.

size_t count = mesh.getGatewayCount();
if (count == 0) {
Serial.println("Warning: No gateways available!");
} else {
Serial.printf("%d gateway(s) available\n", count);
}
Returns
Number of available gateways

◆ getGateways()

template<class T >
std::list< uint32_t > painlessmesh::Mesh< T >::getGateways ( )
inline

Get list of all nodes with Internet access

Returns node IDs of all healthy bridges with active Internet connectivity. Only bridges that have reported status within the timeout period are included.

This method provides the same data as getNodesWithInternet() but returns a std::list for consistency with other node list methods in painlessMesh.

auto gateways = mesh.getGateways();
Serial.printf("Available gateways: %d\n", gateways.size());
for (auto gatewayId : gateways) {
Serial.printf(" Gateway: %u\n", gatewayId);
}
Returns
List of node IDs with Internet connectivity

◆ getHealthMetricsJSON()

template<class T >
TSTRING painlessmesh::Mesh< T >::getHealthMetricsJSON ( )
inline

Export health metrics as JSON string

Generates a JSON representation of current health metrics for easy integration with monitoring tools, MQTT publishing, or logging.

String json = mesh.getHealthMetricsJSON();
mqttClient.publish("bridge/metrics", json.c_str());
Returns
JSON string containing all health metrics

◆ getHopCount()

template<class T >
int painlessmesh::Mesh< T >::getHopCount ( uint32_t  nodeId)
inline

Get hop count to specific node Returns -1 if node is unreachable

◆ getInternetStatus()

template<class T >
gateway::InternetStatus painlessmesh::Mesh< T >::getInternetStatus ( )
inline

Get detailed status of local Internet connectivity

Returns comprehensive information about Internet connectivity checks including success/failure counts, timing, and error messages.

auto status = mesh.getInternetStatus();
Serial.printf("Internet %s, uptime: %d%%\n",
status.available ? "UP" : "DOWN",
status.getUptimePercent());
Returns
InternetStatus structure with detailed connectivity info

◆ getLastBridgeChange()

template<class T >
BridgeChangeEvent painlessmesh::Mesh< T >::getLastBridgeChange ( )
inline

Get last bridge change event

Returns information about the most recent bridge change

auto event = mesh.getLastBridgeChange();
if (event.timestamp > 0) {
Serial.printf("Bridge changed from %u to %u: %s\n",
event.oldBridgeId, event.newBridgeId, event.reason.c_str());
}
Returns
BridgeChangeEvent structure

◆ getLastKnownBridge()

template<class T >
BridgeInfo * painlessmesh::Mesh< T >::getLastKnownBridge ( )
inline

Get the last known bridge with Internet connection (regardless of lastSeen timeout)

Unlike getPrimaryBridge(), this method returns the best known bridge even if the lastSeen timestamp is stale. This is useful when the local node is temporarily disconnected from the mesh and cannot receive bridge status updates.

The returned bridge may not be currently reachable, but represents the last known good configuration.

Returns
pointer to BridgeInfo of last known bridge, or nullptr if no bridge ever seen

◆ getNodeList()

template<class T >
std::list< uint32_t > painlessmesh::Mesh< T >::getNodeList ( bool  includeSelf = false)
inline

Get a list of all known nodes.

This includes nodes that are both directly and indirectly connected to the current node.

◆ getNodeNeighbors()

template<class T >
bool painlessmesh::Mesh< T >::getNodeNeighbors ( const protocol::NodeTree &  tree,
uint32_t  nodeId,
std::list< uint32_t > &  neighbors,
uint32_t  parent = 0 
) const
inline

Helper function to get direct neighbors of a node from the mesh topology tree

Parameters
treeThe node tree to search
nodeIdThe node whose neighbors we want to find
neighborsOutput list of neighbor node IDs
parentThe parent node ID (used during recursion, 0 means no parent)
Returns
true if the node was found in the tree

◆ getNodesWithInternet()

template<class T >
std::vector< uint32_t > painlessmesh::Mesh< T >::getNodesWithInternet ( )
inline

Get list of nodes that currently have Internet access

Returns node IDs of all healthy bridges with active Internet connectivity. Only bridges that have reported status within the timeout period are included.

auto internetNodes = mesh.getNodesWithInternet();
for (auto nodeId : internetNodes) {
Serial.printf("Node %u has Internet access\n", nodeId);
}
uint32_t nodeId
Definition layout.hpp:125
Returns
Vector of node IDs with Internet connectivity

◆ getPathToNode()

template<class T >
std::vector< uint32_t > painlessmesh::Mesh< T >::getPathToNode ( uint32_t  nodeId)
inline

Get complete path from this node to target node

Returns a vector containing the complete path of node IDs from this node to the target node, including both endpoints. Uses BFS to find the shortest path. Returns an empty vector if the target is unreachable.

Parameters
nodeIdThe target node ID
Returns
Vector of node IDs representing the path (empty if unreachable)
auto path = mesh.getPathToNode(targetNodeId);
if (!path.empty()) {
Serial.printf("Path length: %d hops\n", path.size() - 1);
for (auto node : path) {
Serial.printf("%u -> ", node);
}
}

◆ getPendingInternetRequestCount()

template<class T >
size_t painlessmesh::Mesh< T >::getPendingInternetRequestCount ( ) const
inline

Get number of pending Internet requests

Returns
Number of requests waiting for acknowledgment

◆ getPrimaryBridge()

template<class T >
BridgeInfo * painlessmesh::Mesh< T >::getPrimaryBridge ( )
inline

Get the primary (best) bridge node

Primary bridge is selected based on:

  1. Must be healthy (seen within timeout)
  2. Must have Internet connection
  3. Best WiFi RSSI to router

This method now ALWAYS requires healthy (recent) bridge status to prevent routing messages to unreachable or outdated bridges when mesh connectivity is lost. Without active mesh connections and fresh status, we cannot reliably route messages to any bridge.

If you need access to the last known bridge regardless of health status, use getLastKnownBridge() instead.

Returns
pointer to BridgeInfo of primary bridge, or nullptr if no suitable bridge

◆ getPrimaryGateway()

template<class T >
uint32_t painlessmesh::Mesh< T >::getPrimaryGateway ( )
inline

Get the node ID of the current primary gateway

Returns the node ID of the bridge with the best RSSI to the router that has Internet connectivity, or 0 if no gateway is available.

uint32_t gatewayId = mesh.getPrimaryGateway();
if (gatewayId != 0) {
Serial.printf("Primary gateway is node %u\n", gatewayId);
} else {
Serial.println("No gateway available");
}
Returns
Node ID of the primary gateway, or 0 if none available

◆ getQueuedMessageCount() [1/2]

template<class T >
uint32_t painlessmesh::Mesh< T >::getQueuedMessageCount ( )
inline

◆ getQueuedMessageCount() [2/2]

template<class T >
uint32_t painlessmesh::Mesh< T >::getQueuedMessageCount ( MessagePriority  priority)
inline

Get number of queued messages

Parameters
priorityOptional priority level to count (counts all if not specified)
Returns
Number of queued messages

◆ getQueueStats()

template<class T >
QueueStats painlessmesh::Mesh< T >::getQueueStats ( )
inline

Get queue statistics

Returns
QueueStats structure with detailed statistics

◆ getRoutingTable()

template<class T >
std::map< uint32_t, uint32_t > painlessmesh::Mesh< T >::getRoutingTable ( )
inline

Get routing table as map (destination -> next hop)

Uses BFS to build a complete routing table with next-hop information for all reachable nodes in the mesh. For direct connections, the next hop is the node itself. For multi-hop paths, the next hop is the first node on the shortest path to the destination.

◆ getRTCType()

template<class T >
rtc::RTCType painlessmesh::Mesh< T >::getRTCType ( ) const
inline

Get RTC type

Returns
RTCType enum value, or RTC_NONE if no RTC enabled

◆ getTcpRetryConfig()

template<class T >
painlessmesh::tcp::TcpRetryConfig painlessmesh::Mesh< T >::getTcpRetryConfig ( ) const
inline

Get the active TCP retry configuration

Returns
The configuration currently in effect, after clamping

◆ getTimeAuthority()

template<class T >
bool painlessmesh::Mesh< T >::getTimeAuthority ( ) const
inline

Check if this node has time authority

Returns
True if node has RTC or Internet time source

◆ getTimeSinceRTCSync()

template<class T >
uint32_t painlessmesh::Mesh< T >::getTimeSinceRTCSync ( ) const
inline

Get time since last RTC sync

Returns
Milliseconds since last RTC sync, or 0 if never synced

◆ hasActiveMeshConnections()

template<class T >
bool painlessmesh::Mesh< T >::hasActiveMeshConnections ( )
inline

Check if this node has active mesh connections

Returns true if this node has at least one active connection to other mesh nodes. When false, the node is isolated and cannot receive any mesh messages including bridge status updates.

This is useful for distinguishing between:

  • Bridge genuinely unavailable (mesh connected, but bridge not responding)
  • Local node temporarily disconnected (cannot receive any mesh messages)
Returns
true if at least one mesh connection is active

◆ hasInternetConnection()

template<class T >
bool painlessmesh::Mesh< T >::hasInternetConnection ( )
inline

Check if any bridge/gateway in the mesh has Internet connectivity

IMPORTANT: This method checks if a GATEWAY node (bridge) in the mesh has Internet access, NOT whether THIS node can directly make HTTP/HTTPS requests.

Regular mesh nodes do NOT have direct IP routing to the Internet - they only communicate over the painlessMesh protocol. To send data to the Internet from a regular node, you must either:

  1. Use sendToInternet() to route data through a gateway node
  2. Use initAsSharedGateway(meshSSID, meshPwd, ROUTER_SSID, ROUTER_PWD, scheduler, port) to give all nodes direct router access (requires router credentials)
  3. Send mesh messages to a bridge node that handles Internet communication

Use hasLocalInternet() to check if THIS specific node has direct Internet access.

This method now ALWAYS requires healthy (recent) bridge status to prevent false positives when mesh connectivity is lost. Without active mesh connections, stale bridge data cannot be relied upon, as the bridge may have lost Internet connectivity or become unreachable.

if (mesh.hasInternetConnection()) {
// A gateway exists with Internet - use sendToInternet() to reach Internet
mesh.sendToInternet("https://api.example.com/data", jsonPayload, callback);
}
// DON'T DO THIS - regular mesh nodes cannot make direct HTTP requests:
// HTTPClient http;
// http.begin("https://api.example.com"); // Will fail with "connection refused"
Returns
true if at least one gateway/bridge reports Internet connection
See also
hasLocalInternet() to check if THIS node has direct Internet access
sendToInternet() to send data to Internet via gateway
initAsSharedGateway() to give all nodes direct Internet access (requires router credentials)

◆ hasLocalInternet()

template<class T >
bool painlessmesh::Mesh< T >::hasLocalInternet ( )
inline

Check if THIS node has direct local Internet access

This method checks whether this specific node can directly reach the Internet, as opposed to hasInternetConnection() which checks if any bridge in the mesh has Internet access.

For gateway/bridge nodes, this returns the result of the local health check. For regular nodes, this typically returns false unless they have their own Internet connection.

if (mesh.hasLocalInternet()) {
Serial.println("This node has direct Internet access");
}
Returns
true if this node has verified local Internet connectivity

◆ hasRTC()

template<class T >
bool painlessmesh::Mesh< T >::hasRTC ( ) const
inline

Check if RTC is enabled and available

Returns
true if RTC can be used, false otherwise

◆ incrementQueuedMessageAttempts()

template<class T >
uint32_t painlessmesh::Mesh< T >::incrementQueuedMessageAttempts ( uint32_t  messageId)
inline

Increment send attempt counter for a message

Parameters
messageIdID of message
Returns
New attempt count, or 0 if message not found

◆ init() [1/2]

template<class T >
void painlessmesh::Mesh< T >::init ( Scheduler *  scheduler,
uint32_t  id 
)
inline

◆ init() [2/2]

template<class T >
void painlessmesh::Mesh< T >::init ( uint32_t  id)
inline

◆ isBridge()

template<class T >
bool painlessmesh::Mesh< T >::isBridge ( )
inline

Check if this node is acting as a bridge

Returns
true if this node is configured as a root node (typically bridges)

◆ isBridgeCleanupEnabled()

template<class T >
bool painlessmesh::Mesh< T >::isBridgeCleanupEnabled ( ) const
inline

Check if bridge cleanup is enabled

Returns
true if periodic cleanup is running

◆ isBridgeReachable()

template<class T >
bool painlessmesh::Mesh< T >::isBridgeReachable ( uint32_t  bridgeNodeId)
inline

Check if specific bridge is reachable

Tests if the specified bridge node can be reached from this node.

if (mesh.isBridgeReachable(bridgeNodeId)) {
Serial.println("Bridge is reachable");
}
Parameters
bridgeNodeIdBridge node ID to test
Returns
true if bridge is reachable, false otherwise

◆ isConnected()

template<class T >
bool painlessmesh::Mesh< T >::isConnected ( uint32_t  nodeId)
inline

Are we connected/know a route to the given node?

Parameters
nodeIdThe nodeId we are looking for

◆ isInternetHealthCheckEnabled()

template<class T >
bool painlessmesh::Mesh< T >::isInternetHealthCheckEnabled ( ) const
inline

Check if Internet health checking is enabled

Returns
true if periodic health checks are running

◆ isPrimaryGateway()

template<class T >
bool painlessmesh::Mesh< T >::isPrimaryGateway ( )
inline

Check if this node is the primary gateway

A node is the primary gateway if it's the bridge with the best RSSI to the router and has Internet connectivity.

if (mesh.isPrimaryGateway()) {
Serial.println("I am the primary gateway!");
}
Returns
true if this node is the primary gateway

◆ isRoot()

template<class T >
bool painlessmesh::Mesh< T >::isRoot ( )
inline

Check whether this node is a root node.

◆ isSendToInternetEnabled()

template<class T >
bool painlessmesh::Mesh< T >::isSendToInternetEnabled ( ) const
inline

Check if sendToInternet() API is enabled

Returns
true if the API is enabled

◆ onBridgeStatusChanged()

template<class T >
void painlessmesh::Mesh< T >::onBridgeStatusChanged ( bridgeStatusChangedCallback_t  onBridgeStatusChanged)
inline

Callback that gets called when bridge status changes.

This fires when a bridge node reports a change in Internet connectivity status. Useful for implementing failover logic or message queueing.

mesh.onBridgeStatusChanged([](auto bridgeNodeId, auto hasInternet) {
if (hasInternet) {
Serial.println("Internet available - sending queued data");
} else {
Serial.println("Internet offline - queueing messages");
}
});

◆ onChangedConnections()

template<class T >
void painlessmesh::Mesh< T >::onChangedConnections ( changedConnectionsCallback_t  onChangedConnections)
inline

Callback that gets called every time the layout of the mesh changes

mesh.onChangedConnections([]() {
// Do something with the event
});

◆ onDroppedConnection()

template<class T >
void painlessmesh::Mesh< T >::onDroppedConnection ( droppedConnectionCallback_t  onDroppedConnection)
inline

Callback that gets called every time the local node drops a connection.

mesh.onDroppedConnection([](auto nodeId) {
// Do something with the event
Serial.println(String(nodeId));
});

◆ onGatewayChanged()

template<class T >
void painlessmesh::Mesh< T >::onGatewayChanged ( gatewayChangedCallback_t  callback)
inline

Register callback for primary gateway changes

This callback fires when the primary gateway changes, either because a new gateway becomes available, the current gateway becomes unavailable, or a better gateway is discovered.

mesh.onGatewayChanged([](uint32_t oldPrimary, uint32_t newPrimary) {
if (newPrimary == 0) {
Serial.println("Warning: Lost all gateways!");
} else if (oldPrimary == 0) {
Serial.printf("Gateway available: %u\n", newPrimary);
} else {
Serial.printf("Gateway changed: %u -> %u\n", oldPrimary, newPrimary);
}
});
Parameters
callbackFunction to call when primary gateway changes

◆ onHealthMetricsUpdate()

template<class T >
void painlessmesh::Mesh< T >::onHealthMetricsUpdate ( std::function< void(BridgeHealthMetrics)>  callback,
uint32_t  intervalMs = 60000 
)
inline

Set periodic health metrics callback

Registers a callback that will be invoked periodically with current health metrics. Useful for automated monitoring, MQTT publishing, or Prometheus export.

mesh.onHealthMetricsUpdate([](BridgeHealthMetrics metrics) {
String json = mesh.getHealthMetricsJSON();
mqttClient.publish("bridge/metrics", json.c_str());
}, 60000); // Every 60 seconds
Definition mesh.hpp:201
Parameters
callbackFunction to call with metrics
intervalMsCallback interval in milliseconds (default: 60000 = 60 seconds)

◆ onLocalInternetChanged()

template<class T >
void painlessmesh::Mesh< T >::onLocalInternetChanged ( localInternetChangedCallback_t  callback)
inline

Register callback for local Internet connectivity changes

This callback fires when THIS node's direct Internet connectivity changes, as detected by the periodic health check.

mesh.onLocalInternetChanged([](bool available) {
if (available) {
Serial.println("Local Internet connected");
} else {
Serial.println("Local Internet disconnected");
}
});
Parameters
callbackFunction to call when local Internet status changes

◆ onNewConnection()

template<class T >
void painlessmesh::Mesh< T >::onNewConnection ( newConnectionCallback_t  onNewConnection)
inline

Callback that gets called every time the local node makes a new connection.

mesh.onNewConnection([](auto nodeId) {
// Do something with the event
Serial.println(String(nodeId));
});

◆ onNodeDelayReceived()

template<class T >
void painlessmesh::Mesh< T >::onNodeDelayReceived ( nodeDelayCallback_t  onDelayReceived)
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.

mesh.onNodeDelayReceived([](auto nodeId, auto delay) {
// Do something with the event
Serial.println(String(delay));
});

◆ onNodeTimeAdjusted()

template<class T >
void painlessmesh::Mesh< T >::onNodeTimeAdjusted ( nodeTimeAdjustedCallback_t  onTimeAdjusted)
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.

mesh.onNodeTimeAdjusted([](auto offset) {
// Do something with the event
Serial.println(String(offset));
});

◆ onQueueStateChanged()

template<class T >
void painlessmesh::Mesh< T >::onQueueStateChanged ( queueStateChangedCallback_t  callback)
inline

Set callback for queue state changes

Fires when queue state changes (EMPTY, NORMAL, 75%, FULL)

mesh.onQueueStateChanged([](QueueState state, uint32_t count) {
if (state == QUEUE_75_PERCENT) {
Serial.printf("Warning: Queue 75%% full (%u messages)\n", count);
}
});
QueueState
Definition message_queue.hpp:28
@ QUEUE_75_PERCENT
Definition message_queue.hpp:31

◆ onReceive()

template<class T >
void painlessmesh::Mesh< T >::onReceive ( receivedCallback_t  onReceive)
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.

mesh.onReceive([](auto nodeId, auto msg) {
// Do something with the message
Serial.println(msg);
});
Note
Accumulates — does not replace. Calling onReceive() a second time does not overwrite the previous handler; both handlers are invoked for every subsequent message, in the order they were registered. This mirrors the other on...() setters on this class (onNewConnection, onDroppedConnection, onChangedConnections, onNodeTimeAdjusted, onNodeDelayReceived). There is currently no public API to unregister a handler; if you need replace-semantics, keep a single dispatcher lambda and mutate the target it dispatches to.

◆ onRTCSyncComplete()

template<class T >
void painlessmesh::Mesh< T >::onRTCSyncComplete ( rtcSyncCompleteCallback_t  onRTCSyncComplete)
inline

Callback when RTC sync completes

This fires when syncRTCFromNTP() successfully updates the RTC.

mesh.onRTCSyncComplete([](auto timestamp) {
Serial.printf("RTC synced to: %u\n", timestamp);
});

◆ overCapacity()

template<class T >
bool painlessmesh::Mesh< T >::overCapacity ( )
inline

Whether this node is being asked to do more than its part can carry.

The ESP8266 is specified for small meshes, or as a leaf in larger ones: measured as an interior node of a seven-node mesh it runs at 10–13 KB free — a working set that tracks its live connections and the traffic through them, not a leak — and a single 8 KB package or one OTA part can then fail to allocate. This is the part's limit, not a defect. It is set by capacityCheck(), which the Arduino layer runs periodically on ESP8266 and which logs an ERROR when the condition is first met and again every five minutes it persists. Configure the node as a leaf with init(..., maxconn = 0) — or 1 to allow a single child.

◆ pendingAcks()

template<class T >
size_t painlessmesh::Mesh< T >::pendingAcks ( ) const
inline

Number of messages still awaiting delivery acknowledgment

◆ pruneQueue()

template<class T >
uint32_t painlessmesh::Mesh< T >::pruneQueue ( uint32_t  maxAgeMs)
inline

Prune old messages from the queue

Parameters
maxAgeMsMaximum age in milliseconds
Returns
Number of messages removed

◆ queueBroadcastAck()

template<class T >
void painlessmesh::Mesh< T >::queueBroadcastAck ( uint32_t  origin,
uint32_t  msgId 
)
inlineprotected

◆ queueMessage()

template<class T >
uint32_t painlessmesh::Mesh< T >::queueMessage ( const TSTRING &  payload,
const TSTRING &  destination = "",
MessagePriority  priority = PRIORITY_NORMAL 
)
inline

Queue a message with priority for later manual delivery

Use this to buffer critical messages when your upstream (MQTT/HTTP/etc.) is unavailable. The library does NOT deliver these on its own — your app must call flushMessageQueue() and removeQueuedMessage() once its own connectivity check clears.

Parameters
payloadMessage content to queue
destinationOptional destination metadata (e.g., MQTT topic, HTTP endpoint)
priorityMessage priority (default: PRIORITY_NORMAL)
Returns
Message ID if successfully queued, 0 if failed
// Queue critical alarm
uint32_t msgId = mesh.queueMessage(
alarmData.toJSON(),
"mqtt://cloud.example.com/alarms",
);
@ PRIORITY_CRITICAL
Definition message_queue.hpp:19

◆ reclaimRetiredSchedulers()

template<class T >
void painlessmesh::Mesh< T >::reclaimRetiredSchedulers ( )
inlineprotected

◆ removeQueuedMessage()

template<class T >
bool painlessmesh::Mesh< T >::removeQueuedMessage ( uint32_t  messageId)
inline

Remove a successfully sent message from the queue

Parameters
messageIdID of message to remove
Returns
true if message was found and removed

◆ resetHealthMetrics()

template<class T >
void painlessmesh::Mesh< T >::resetHealthMetrics ( )
inline

Reset health metrics counters

Resets all counters to zero but keeps current state metrics (RSSI, node count, etc.) Useful for periodic monitoring windows.

// Reset metrics at the start of each monitoring period
mesh.resetHealthMetrics();

◆ resetInternetHealthStats()

template<class T >
void painlessmesh::Mesh< T >::resetInternetHealthStats ( )
inline

Reset Internet health check statistics

◆ semaphoreGive()

template<class T >
void painlessmesh::Mesh< T >::semaphoreGive ( )
inline

Wrapper function for ESP32 semaphore give function

Does nothing on ESP8266 hardware

◆ semaphoreTake()

template<class T >
bool painlessmesh::Mesh< T >::semaphoreTake ( )
inline

Wrapper function for ESP32 semaphore function

Waits for the semaphore to be available and then returns true

Always return true on ESP8266

◆ sendBroadcast() [1/4]

template<class T >
bool painlessmesh::Mesh< T >::sendBroadcast ( TSTRING  msg,
bool  includeSelf,
ack::deliveryCallback_t  ackCallback,
uint32_t  ackTimeoutMs = 5000 
)
inline

Broadcast a message with per-node delivery confirmation

The set of nodes expected to acknowledge is snapshotted from the current mesh layout (excluding this node) when the broadcast is sent. The callback fires once per expected node: with delivered = true and the round-trip latency when that node's ACK arrives, or with delivered = false when ackTimeoutMs elapses. The local node never acknowledges itself, even with includeSelf = true.

Note: includeSelf and ackCallback are deliberately non-defaulted on this overload; C++ overload resolution against the priority overload would otherwise be ambiguous or, worse, silently convert a lambda to bool.

Parameters
msgThe message to broadcast
includeSelfSend message to myself as well.
ackCallbackDelivery confirmation callback, fired once per node. Passing nullptr behaves like the plain sendBroadcast().
ackTimeoutMsHow long to wait for acknowledgments (default 5000 ms). Values below 1000 ms are raised to 1000 ms so the 50 ms jitter window still leaves time for routed round-trip delivery.
Returns
true if the message was queued and at least one node is expected to acknowledge, false otherwise — including when PAINLESSMESH_MAX_PENDING_ACKS messages already await acknowledgment (nothing is sent; the callback will not fire).

◆ sendBroadcast() [2/4]

template<class T >
bool painlessmesh::Mesh< T >::sendBroadcast ( TSTRING  msg,
bool  includeSelf = false 
)
inline

Broadcast a message to every node on the mesh network.

Parameters
includeSelfSend message to myself as well. Default is false.
Returns
true if everything works, false if not

◆ sendBroadcast() [3/4]

template<class T >
bool painlessmesh::Mesh< T >::sendBroadcast ( TSTRING  msg,
const SendOptions &  options,
bool  includeSelf = false 
)
inline

Broadcast a message to every node — unified path (issue #384)

All sendBroadcast() overloads funnel into this one. Priority and delivery confirmation compose freely; see SendOptions for the semantics of each field. With an ackCallback set, the set of nodes expected to acknowledge is snapshotted from the current mesh layout (excluding this node) when the broadcast is sent, and the callback fires once per expected node. ackTimeoutMs values below 1000 ms are raised to 1000 ms so the 50 ms ACK jitter window still leaves time for routed round-trip delivery.

Parameters
msgThe message to broadcast
optionsPriority and/or delivery confirmation options.
includeSelfSend message to myself as well. Default is false.
Returns
Without an ackCallback: true if the message was queued to at least one peer. With an ackCallback: true if the message was queued and at least one node is expected to acknowledge, false otherwise — including when PAINLESSMESH_MAX_PENDING_ACKS messages already await acknowledgment (nothing is sent; the callback will not fire).

◆ sendBroadcast() [4/4]

template<class T >
template<typename Priority , typename IncludeSelf = bool, typename std::enable_if<(std::is_integral< typename std::decay< Priority >::type >::value||std::is_enum< typename std::decay< Priority >::type >::value) &&!std::is_same< typename std::decay< Priority >::type, bool >::value &&std::is_same< typename std::decay< IncludeSelf >::type, bool >::value, int >::type = 0>
bool painlessmesh::Mesh< T >::sendBroadcast ( TSTRING  msg,
Priority  priorityLevel,
IncludeSelf  includeSelf = false 
)
inline

Broadcast a message with priority to every node on the mesh network.

Parameters
msgThe message to broadcast
priorityLevelPriority level: 0=CRITICAL, 1=HIGH, 2=NORMAL, 3=LOW
includeSelfSend message to myself as well. Default is false.
Returns
true if everything works, false if not

◆ sendGatewayAck()

template<class T >
void painlessmesh::Mesh< T >::sendGatewayAck ( const gateway::GatewayDataPackage &  request,
bool  success,
uint16_t  httpStatus,
const TSTRING &  error,
std::shared_ptr< T >  ingressConnection = nullptr,
const TSTRING &  response = TSTRING(),
int8_t  retryable = -1,
uint32_t  retryAfterMs = 0 
)
inline

Handle incoming gateway acknowledgment package Answer a gateway request: send its GATEWAY_ACK back to the origin node.

A request this node originated completes locally, without a mesh hop. Otherwise the ack is routed to the origin; when the NodeTree has not yet converged enough for findRoute() to resolve it – a freshly promoted gateway can receive data before that – the connection the request arrived on is a valid reverse path, since every intermediate node routes the addressed ack onward toward the origin.

Used by the gateway's own handler (wifi.hpp) and by the fallback every node registers for requests it cannot serve.

◆ sendSingle() [1/4]

template<class T >
bool painlessmesh::Mesh< T >::sendSingle ( uint32_t  destId,
TSTRING  msg 
)
inline

Send message to a specific node

Parameters
destIdThe nodeId of the node to send it to.
msgThe message to send
Returns
true if everything works, false if not.

◆ sendSingle() [2/4]

template<class T >
bool painlessmesh::Mesh< T >::sendSingle ( uint32_t  destId,
TSTRING  msg,
ack::deliveryCallback_t  ackCallback,
uint32_t  ackTimeoutMs = 5000 
)
inline

Send message to a specific node with delivery confirmation

The message is tagged with a unique id and the destination node automatically replies with an acknowledgment. The callback fires exactly once: with delivered = true and the measured round-trip latency when the ACK arrives, or with delivered = false when ackTimeoutMs elapses without an ACK. ACK processing happens inside mesh.update() — no blocking waits.

mesh.sendSingle(dest, msg,
[](uint32_t nodeId, bool delivered, uint32_t latencyMs) {
if (delivered)
Serial.printf("Node %u confirmed in %u ms\n", nodeId, latencyMs);
else
Serial.printf("Delivery to %u timed out\n", nodeId);
});
Parameters
destIdThe nodeId of the node to send it to.
msgThe message to send
ackCallbackDelivery confirmation callback. Passing nullptr behaves exactly like the plain sendSingle().
ackTimeoutMsHow long to wait for the acknowledgment (default 5000 ms).
Returns
true if the message was queued for sending, false if not (no route to destination, or PAINLESSMESH_MAX_PENDING_ACKS messages already await acknowledgment — in both cases nothing is sent and the callback will not fire).

◆ sendSingle() [3/4]

template<class T >
bool painlessmesh::Mesh< T >::sendSingle ( uint32_t  destId,
TSTRING  msg,
const SendOptions &  options 
)
inline

Send message to a specific node — unified path (issue #384)

All sendSingle() overloads funnel into this one. Priority and delivery confirmation compose freely; see SendOptions for the semantics of each field.

Parameters
destIdThe nodeId of the node to send it to.
msgThe message to send
optionsPriority and/or delivery confirmation options.
Returns
true if the message was queued for sending, false if not (no route to destination, or — when an ackCallback is set — PAINLESSMESH_MAX_PENDING_ACKS messages already await acknowledgment; in both cases nothing is sent and the callback will not fire).

◆ sendSingle() [4/4]

template<class T >
bool painlessmesh::Mesh< T >::sendSingle ( uint32_t  destId,
TSTRING  msg,
uint8_t  priorityLevel 
)
inline

Send message to a specific node with priority

Parameters
destIdThe nodeId of the node to send it to.
msgThe message to send
priorityLevelPriority level: 0=CRITICAL, 1=HIGH, 2=NORMAL, 3=LOW
Returns
true if everything works, false if not.

◆ sendToInternet() [1/2]

template<class T >
uint32_t painlessmesh::Mesh< T >::sendToInternet ( TSTRING  destination,
TSTRING  payload,
internetResponseCallback_t  onResult,
uint8_t  priority = static_cast<uint8_t>(gateway::GatewayPriority::PRIORITY_NORMAL) 
)
inline

Send data to an Internet destination, receiving the whole result

The same request as the (success, httpStatus, error) form, but the callback also gets the start of the response body, whether the request may be resent safely, and how many times it was issued. Use it when a service's status alone does not say whether it did what was asked – the sendToInternet example judges CallMeBot's replies this way.

Returns
Unique message ID for tracking, or 0 if immediate failure

◆ sendToInternet() [2/2]

template<class T >
uint32_t painlessmesh::Mesh< T >::sendToInternet ( TSTRING  destination,
TSTRING  payload,
internetResultCallback_t  callback,
uint8_t  priority = static_cast<uint8_t>(gateway::GatewayPriority::PRIORITY_NORMAL) 
)
inline

Send data to an Internet destination through the mesh gateway

This method provides a high-level API for sending data to the Internet through the mesh network. It automatically handles:

  • Local Internet: If this node has direct Internet access, sends directly
  • Gateway routing: Otherwise routes through the best available gateway
  • Acknowledgment tracking: Tracks message delivery with callbacks
  • Retry logic: Implements exponential backoff for failed deliveries
  • Priority handling: Respects message priority levels

PRIORITY LEVELS:

  • 0 (CRITICAL): Immediate processing, no delays
  • 1 (HIGH): High priority, processed before normal
  • 2 (NORMAL): Standard processing (default)
  • 3 (LOW): Background processing when idle

CALLBACK BEHAVIOR: The callback is invoked when:

  • Success: Gateway confirms delivery to Internet destination
  • Failure: Timeout, no gateway available, or delivery error
// Send sensor data to cloud API
uint32_t msgId = mesh.sendToInternet(
"https://api.example.com/sensor",
"{\"temperature\": 23.5}",
[](bool success, uint16_t httpStatus, String error) {
if (success) {
Serial.printf("Delivered! HTTP %u\n", httpStatus);
} else {
Serial.printf("Failed: %s\n", error.c_str());
}
},
PRIORITY_NORMAL // Optional priority
);
Serial.printf("Message ID: %u\n", msgId);
@ PRIORITY_NORMAL
Definition message_queue.hpp:21
Parameters
destinationThe Internet destination URL (e.g., "https://api.example.com/data")
payloadThe data payload to send (typically JSON)
callbackFunction called with result (success, httpStatus, error)
priorityMessage priority (0=CRITICAL to 3=LOW, default: 2=NORMAL)
Returns
Unique message ID for tracking, or 0 if immediate failure

◆ setBridgeStatusInterval()

template<class T >
void painlessmesh::Mesh< T >::setBridgeStatusInterval ( uint32_t  intervalMs)
inline

Set the interval for bridge status broadcasts (bridge nodes only)

Parameters
intervalMsBroadcast interval in milliseconds (default: 30000 = 30 seconds)

◆ setBridgeTimeout()

template<class T >
void painlessmesh::Mesh< T >::setBridgeTimeout ( uint32_t  timeoutMs)
inline

Set the timeout for considering a bridge offline

Parameters
timeoutMsTimeout in milliseconds (default: 60000 = 60 seconds)

◆ setContainsRoot()

template<class T >
void painlessmesh::Mesh< T >::setContainsRoot ( bool  on = true)
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().

◆ setDebugMsgTypes()

template<class T >
void painlessmesh::Mesh< T >::setDebugMsgTypes ( uint16_t  types)
inline

Change the internal log level

◆ setInternetCheckInterval()

template<class T >
void painlessmesh::Mesh< T >::setInternetCheckInterval ( uint32_t  intervalMs)
inline

Set Internet check interval

Parameters
intervalMsInterval between checks in milliseconds

◆ setInternetCheckTarget()

template<class T >
void painlessmesh::Mesh< T >::setInternetCheckTarget ( const TSTRING &  host,
uint16_t  port = 53 
)
inline

Set custom Internet check target

Override the default check host/port (8.8.8.8:53).

Parameters
hostHost to check (IP or hostname)
portPort to connect to (default 53 for DNS)

◆ setInternetCheckTimeout()

template<class T >
void painlessmesh::Mesh< T >::setInternetCheckTimeout ( uint32_t  timeoutMs)
inline

Set Internet check timeout

Parameters
timeoutMsTimeout for each check in milliseconds

◆ setInternetRequestTimeout()

template<class T >
void painlessmesh::Mesh< T >::setInternetRequestTimeout ( uint32_t  timeoutMs)
inline

Configure Internet request timeout

Parameters
timeoutMsTimeout in milliseconds (default: 30000)

◆ setInternetRetryCount()

template<class T >
void painlessmesh::Mesh< T >::setInternetRetryCount ( uint8_t  retryCount)
inline

Configure Internet request retry count

Parameters
retryCountNumber of retry attempts (default: 3)

◆ setInternetRetryDelay()

template<class T >
void painlessmesh::Mesh< T >::setInternetRetryDelay ( uint32_t  delayMs)
inline

Configure base retry delay for exponential backoff

Parameters
delayMsBase delay in milliseconds (default: 1000)

◆ setRoot()

template<class T >
void painlessmesh::Mesh< T >::setRoot ( bool  on = true)
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.

◆ setScheduler()

template<class T >
void painlessmesh::Mesh< T >::setScheduler ( Scheduler *  baseScheduler)
inlineprotected

◆ setTcpRetryConfig()

template<class T >
void painlessmesh::Mesh< T >::setTcpRetryConfig ( const painlessmesh::tcp::TcpRetryConfig &  config)
inline

Configure TCP connection retry behaviour

Lets latency-sensitive, high-reliability or battery-powered deployments pick their own retry envelope. Values outside safe operating bounds are clamped - see painlessmesh::tcp::clampTcpRetryConfig(). Read the applied (post-clamp) values back with getTcpRetryConfig().

The defaults reproduce the previous hardcoded behaviour exactly, so existing sketches that never call this see no change.

Parameters
configRetry parameters to apply

◆ setTimeAuthority()

template<class T >
void painlessmesh::Mesh< T >::setTimeAuthority ( bool  hasAuthority)
inline

Set time authority status for this node

Nodes with time authority (RTC or Internet) are preferred as time sources during mesh time synchronization. This prevents nodes from adopting time from nodes without accurate time sources.

This is automatically set to true when:

  • RTC is enabled via enableRTC()
  • Bridge has Internet connectivity
// Manual control (advanced usage)
mesh.setTimeAuthority(true); // Mark as authoritative time source
mesh.setTimeAuthority(false); // Mark as non-authoritative
Parameters
hasAuthorityTrue if node has accurate time source (RTC/Internet)

◆ startDelayMeas()

template<class T >
bool painlessmesh::Mesh< T >::startDelayMeas ( uint32_t  id)
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().

Returns
true if nodeId is connected to the mesh, false otherwise

◆ startTimeSync()

template<class T >
void painlessmesh::Mesh< T >::startTimeSync ( std::shared_ptr< T >  conn)
inline

◆ stop()

template<class T >
void painlessmesh::Mesh< T >::stop ( )
inline

Disconnect and stop this node

◆ subConnectionJson()

template<class T >
TSTRING painlessmesh::Mesh< T >::subConnectionJson ( bool  pretty = false)
inline

Return a json representation of the current mesh layout

◆ syncRTCFromNTP()

template<class T >
bool painlessmesh::Mesh< T >::syncRTCFromNTP ( uint32_t  ntpTimestamp)
inline

Sync RTC from NTP/Internet time source

Should be called when Internet connection is available to update the RTC with accurate time. Typically called in onBridgeStatusChanged callback when Internet becomes available.

mesh.onBridgeStatusChanged([](auto bridgeNodeId, auto hasInternet) {
if (hasInternet) {
// Get NTP time and sync RTC
uint32_t ntpTime = getNTPTime(); // User implements this
if (mesh.syncRTCFromNTP(ntpTime)) {
Serial.println("RTC synced successfully");
}
}
});
Parameters
ntpTimestampUnix timestamp from NTP source
Returns
true if sync successful, false otherwise

◆ testBridgeConnectivity()

template<class T >
BridgeTestResult painlessmesh::Mesh< T >::testBridgeConnectivity ( )
inline

Test bridge connectivity

Runs a connectivity test to the primary bridge and optionally to Internet. Measures latency and reachability.

auto result = mesh.testBridgeConnectivity();
if (result.success) {
Serial.printf("Bridge test passed: %s (latency: %u ms)\n",
result.message.c_str(), result.latencyMs);
} else {
Serial.printf("Bridge test failed: %s\n", result.message.c_str());
}
Returns
BridgeTestResult with test results

◆ update()

template<class T >
void painlessmesh::Mesh< T >::update ( void  )
inline

Perform crucial maintenance task

Add this to your loop() function. This routine runs various maintenance tasks.

◆ updateBridgeStatus()

template<class T >
void painlessmesh::Mesh< T >::updateBridgeStatus ( uint32_t  bridgeNodeId,
bool  internetConnected,
int8_t  routerRSSI,
uint8_t  routerChannel,
uint32_t  uptime,
TSTRING  gatewayIP,
uint32_t  timestamp 
)
inline

Update bridge information from received status package Internal method called when bridge status is received

Parameters
bridgeNodeIdID of the bridge node
internetConnectedInternet connectivity status
routerRSSIRouter signal strength
routerChannelRouter WiFi channel
uptimeBridge uptime
gatewayIPRouter gateway IP
timestampStatus timestamp

◆ uplinkServesLocally()

template<class T >
bool painlessmesh::Mesh< T >::uplinkServesLocally ( )
inline

Can this node serve a gateway request on its own uplink right now?

hasLocalInternet() is the last periodic probe's answer. On a bridge the first probe runs while the station is still associating and fails, and the next is a full interval (30 s) away, so for that whole window a send fell through to the mesh path and was refused for want of a peer (issue #450). When the flag says no and the health check is running, spend the one on-demand probe the checker allows per period: a send made after the uplink came up is then served locally, and a node whose uplink really is down pays one probe per interval, not one per call.

Returns
true if the request should go to this node's own gateway handler

Friends And Related Symbol Documentation

◆ meshRecvCb

template<class T >
void meshRecvCb ( void *  ,
AsyncClient *  ,
void *  ,
size_t   
)
friend

◆ onDataCb

template<class T >
void onDataCb ( void *  ,
AsyncClient *  ,
void *  ,
size_t   
)
friend

◆ painlessmesh::ntp::handleTimeDelay

template<class T >
void painlessmesh::ntp::handleTimeDelay ( Mesh< T > &  ,
painlessmesh::protocol::TimeDelay  ,
std::shared_ptr< T >  ,
uint32_t   
)
friend

◆ painlessmesh::ntp::handleTimeSync

template<class T >
void painlessmesh::ntp::handleTimeSync ( Mesh< T > &  ,
painlessmesh::protocol::TimeSync  ,
std::shared_ptr< T >  ,
uint32_t   
)
friend

◆ painlessmesh::router::handleNodeSync

template<class T >
void painlessmesh::router::handleNodeSync ( Mesh< T > &  ,
protocol::NodeTree  ,
std::shared_ptr< T >  conn 
)
friend

◆ painlessmesh::tcp::connect

template<class T >
void painlessmesh::tcp::connect ( AsyncClient &  ,
IPAddress  ,
uint16_t  ,
Mesh< T > &  ,
uint8_t   
)
friend

◆ painlessmesh::tcp::initServer

template<class T >
void painlessmesh::tcp::initServer ( AsyncServer &  ,
Mesh< T > &   
)
friend

◆ tcpSentCb

template<class T >
void tcpSentCb ( void *  ,
AsyncClient *  ,
size_t  ,
uint32_t   
)
friend

Member Data Documentation

◆ _capacityWarnedAt

template<class T >
uint32_t painlessmesh::Mesh< T >::_capacityWarnedAt = 0

◆ _overCapacity

template<class T >
bool painlessmesh::Mesh< T >::_overCapacity = false

◆ ACK_BROADCAST_JITTER_MS

template<class T >
constexpr uint32_t painlessmesh::Mesh< T >::ACK_BROADCAST_JITTER_MS = 50
staticconstexprprotected

◆ ACK_BROADCAST_MIN_TIMEOUT_MS

template<class T >
constexpr uint32_t painlessmesh::Mesh< T >::ACK_BROADCAST_MIN_TIMEOUT_MS = 1000
staticconstexprprotected

◆ ACK_CHECK_INTERVAL_MS

template<class T >
constexpr unsigned long painlessmesh::Mesh< T >::ACK_CHECK_INTERVAL_MS
staticconstexprprotected
Initial value:
=
#define PAINLESSMESH_ACK_CHECK_INTERVAL_MS
Definition mesh.hpp:3993

◆ ackCheckTask

template<class T >
std::shared_ptr<Task> painlessmesh::Mesh< T >::ackCheckTask
protected

◆ ackTracker

template<class T >
ack::AckTracker painlessmesh::Mesh< T >::ackTracker
protected

◆ bridgeCleanupTask

template<class T >
std::shared_ptr<Task> painlessmesh::Mesh< T >::bridgeCleanupTask = nullptr

◆ bridgeStatusBroadcastEnabled

template<class T >
bool painlessmesh::Mesh< T >::bridgeStatusBroadcastEnabled = true

◆ bridgeStatusChangedCallback

template<class T >
bridgeStatusChangedCallback_t painlessmesh::Mesh< T >::bridgeStatusChangedCallback

◆ bridgeStatusIntervalMs

template<class T >
uint32_t painlessmesh::Mesh< T >::bridgeStatusIntervalMs = 30000

◆ bridgeTimeoutMs

template<class T >
uint32_t painlessmesh::Mesh< T >::bridgeTimeoutMs = 60000

◆ broadcastAckTask

template<class T >
std::shared_ptr<Task> painlessmesh::Mesh< T >::broadcastAckTask
protected

◆ CAPACITY_WARN_INTERVAL_MS

template<class T >
constexpr uint32_t painlessmesh::Mesh< T >::CAPACITY_WARN_INTERVAL_MS = 5 * 60 * 1000
staticconstexpr

◆ changedConnectionCallbacks

template<class T >
callback::List<uint32_t> painlessmesh::Mesh< T >::changedConnectionCallbacks

◆ diagnosticsEnabled

template<class T >
bool painlessmesh::Mesh< T >::diagnosticsEnabled = false

◆ droppedConnectionCallbacks

template<class T >
callback::List<uint32_t, bool> painlessmesh::Mesh< T >::droppedConnectionCallbacks

◆ electionHistory

template<class T >
std::vector<ElectionRecord> painlessmesh::Mesh< T >::electionHistory

◆ ESP8266_CAPACITY_FLOOR

template<class T >
constexpr uint32_t painlessmesh::Mesh< T >::ESP8266_CAPACITY_FLOOR = 12 * 1024
staticconstexpr

◆ gatewayChangedCallback

template<class T >
gatewayChangedCallback_t painlessmesh::Mesh< T >::gatewayChangedCallback

◆ internetCleanupTask

template<class T >
std::shared_ptr<Task> painlessmesh::Mesh< T >::internetCleanupTask = nullptr

◆ internetHealthChecker

template<class T >
gateway::InternetHealthChecker painlessmesh::Mesh< T >::internetHealthChecker

◆ internetHealthCheckTask

template<class T >
std::shared_ptr<Task> painlessmesh::Mesh< T >::internetHealthCheckTask = nullptr

◆ internetRequestTimeout

template<class T >
uint32_t painlessmesh::Mesh< T >::internetRequestTimeout = 30000

◆ internetRetryCount

template<class T >
uint8_t painlessmesh::Mesh< T >::internetRetryCount = 3

◆ internetRetryDelay

template<class T >
uint32_t painlessmesh::Mesh< T >::internetRetryDelay = 1000

◆ isExternalScheduler

template<class T >
bool painlessmesh::Mesh< T >::isExternalScheduler = false

◆ knownBridges

template<class T >
std::vector<BridgeInfo> painlessmesh::Mesh< T >::knownBridges

◆ lastBridgeChange

template<class T >
BridgeChangeEvent painlessmesh::Mesh< T >::lastBridgeChange

◆ lastBridgeChangeTime

template<class T >
uint32_t painlessmesh::Mesh< T >::lastBridgeChangeTime = 0

◆ localInternetChangedCallback

template<class T >
localInternetChangedCallback_t painlessmesh::Mesh< T >::localInternetChangedCallback

◆ MAX_ELECTION_HISTORY

template<class T >
const size_t painlessmesh::Mesh< T >::MAX_ELECTION_HISTORY = 10
static

◆ MAX_KNOWN_BRIDGES

template<class T >
const size_t painlessmesh::Mesh< T >::MAX_KNOWN_BRIDGES = 20
static

◆ MAX_QUEUED_BROADCAST_ACKS

template<class T >
constexpr size_t painlessmesh::Mesh< T >::MAX_QUEUED_BROADCAST_ACKS
staticconstexprprotected
Initial value:
=
#define PAINLESSMESH_MAX_QUEUED_BROADCAST_ACKS
Definition ack.hpp:25

◆ messageQueue

template<class T >
MessageQueue* painlessmesh::Mesh< T >::messageQueue = nullptr

◆ metricsDisconnectCount

template<class T >
uint32_t painlessmesh::Mesh< T >::metricsDisconnectCount = 0

◆ mScheduler

template<class T >
Scheduler* painlessmesh::Mesh< T >::mScheduler = nullptr

◆ newConnectionCallbacks

template<class T >
callback::List<uint32_t> painlessmesh::Mesh< T >::newConnectionCallbacks

◆ nodeDelayReceivedCallback

template<class T >
nodeDelayCallback_t painlessmesh::Mesh< T >::nodeDelayReceivedCallback

◆ nodeTimeAdjustedCallback

template<class T >
nodeTimeAdjustedCallback_t painlessmesh::Mesh< T >::nodeTimeAdjustedCallback

◆ pendingBroadcastAcks

template<class T >
std::vector<std::pair<uint32_t, uint32_t> > painlessmesh::Mesh< T >::pendingBroadcastAcks
protected

◆ pendingInternetRequests

template<class T >
std::map<uint32_t, PendingInternetRequest> painlessmesh::Mesh< T >::pendingInternetRequests

◆ retiredSchedulers

template<class T >
std::list<Scheduler*> painlessmesh::Mesh< T >::retiredSchedulers = {}
protected

◆ rtcManager

template<class T >
rtc::RTCManager painlessmesh::Mesh< T >::rtcManager

◆ rtcSyncCompleteCallback

template<class T >
rtcSyncCompleteCallback_t painlessmesh::Mesh< T >::rtcSyncCompleteCallback

◆ sendToInternetEnabled

template<class T >
bool painlessmesh::Mesh< T >::sendToInternetEnabled = false

◆ shouldContainRoot

template<class T >
bool painlessmesh::Mesh< T >::shouldContainRoot = false

Is the node a root node.

◆ T

template<class T >
friend painlessmesh::Mesh< T >::T

◆ tcpRetryConfig

template<class T >
painlessmesh::tcp::TcpRetryConfig painlessmesh::Mesh< T >::tcpRetryConfig

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