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

#include <wifi.hpp>

Inheritance diagram for painlessmesh::wifi::Mesh:
Inheritance graph
[legend]
Collaboration diagram for painlessmesh::wifi::Mesh:
Collaboration graph
[legend]

Classes

struct  BridgeCandidate
 
struct  BridgeCoordinationState
 

Public Types

enum  BridgeSelectionStrategy { PRIORITY_BASED = 0 , ROUND_ROBIN = 1 , BEST_SIGNAL = 2 }
 

Public Member Functions

void init (TSTRING ssid, TSTRING password, uint16_t port=5555, WiFiMode_t connectMode=WIFI_AP_STA, uint8_t channel=1, uint8_t hidden=0, uint8_t maxconn=MAX_CONN, TSTRING stationSSID="", TSTRING stationPassword="")
 
void init (TSTRING ssid, TSTRING password, Scheduler *baseScheduler, uint16_t port=5555, WiFiMode_t connectMode=WIFI_AP_STA, uint8_t channel=1, uint8_t hidden=0, uint8_t maxconn=MAX_CONN, TSTRING stationSSID="", TSTRING stationPassword="")
 
bool initAsBridge (TSTRING meshSSID, TSTRING meshPassword, TSTRING routerSSID, TSTRING routerPassword, Scheduler *baseScheduler, uint16_t port=5555)
 
bool initAsBridge (TSTRING meshSSID, TSTRING meshPassword, TSTRING routerSSID, TSTRING routerPassword, Scheduler *baseScheduler, uint16_t port, uint8_t priority)
 
bool initAsSharedGateway (TSTRING meshPrefix, TSTRING meshPassword, TSTRING routerSSID, TSTRING routerPassword, Scheduler *userScheduler, uint16_t port=5555, gateway::SharedGatewayConfig config=gateway::SharedGatewayConfig())
 
bool isSharedGatewayMode () const
 
const gateway::SharedGatewayConfig & getSharedGatewayConfig () const
 
void stationManual (TSTRING ssid, TSTRING password, uint16_t port=0, IPAddress remote_ip=IPAddress(0, 0, 0, 0))
 
void initStation ()
 
void handleStationDisconnectComplete ()
 
void tcpServerInit ()
 
bool tcpListening ()
 
void tcpConnect ()
 
void blockNodeAfterTCPFailure (IPAddress ip, uint32_t blockDurationMs=painlessmesh::tcp::TCP_FAILURE_BLOCK_DURATION_MS)
 
bool setHostname (const char *hostname)
 
IPAddress getStationIP ()
 
IPAddress getAPIP ()
 
void enableBridgeFailover (bool enabled)
 
void setRouterCredentials (TSTRING ssid, TSTRING password)
 
void setElectionTimeout (uint32_t timeoutMs)
 
void setMinimumBridgeRSSI (int8_t minRSSI)
 
void setElectionStartupDelay (uint32_t delayMs)
 
void setElectionRandomDelay (uint32_t minMs, uint32_t maxMs)
 
void onBridgeRoleChanged (std::function< void(bool isBridge, const TSTRING &reason)> callback)
 
void onBridgeCoordination (std::function< void(const plugin::BridgeCoordinationPackage &, uint32_t)> callback)
 
void onBridgeCoordinationChanged (std::function< void(const plugin::BridgeCoordinationPackage &, uint32_t, TSTRING)> callback)
 
void enableMultiBridge (bool enabled)
 
void setBridgeSelectionStrategy (BridgeSelectionStrategy strategy)
 
void setMaxBridges (uint8_t maxBridges)
 
std::vector< uint32_t > getActiveBridges ()
 
bool hasInternetConnection ()
 
uint32_t getRecommendedBridge ()
 
bool isMultiBridgeEnabled () const
 
void checkForBridge ()
 
void checkForBridgeSoon ()
 
void stop ()
 
- Public Member Functions inherited from painlessmesh::Mesh< Connection >
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)
 
bool sendBroadcast (TSTRING msg, Priority priorityLevel, IncludeSelf includeSelf=false)
 
size_t checkAcks ()
 
size_t pendingAcks () const
 
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< Connection > 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< Connection > 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 ()
 

Static Public Attributes

static constexpr uint8_t TCP_STATE_LISTEN = 1
 
- Static Public Attributes inherited from painlessmesh::Mesh< Connection >
static constexpr uint32_t ESP8266_CAPACITY_FLOOR
 
static constexpr uint32_t CAPACITY_WARN_INTERVAL_MS
 
static const size_t MAX_KNOWN_BRIDGES
 
static const size_t MAX_ELECTION_HISTORY
 

Protected Types

enum  ElectionState { ELECTION_IDLE , ELECTION_SCANNING , ELECTION_COLLECTING }
 

Protected Member Functions

void init (Scheduler *scheduler, uint32_t id)
 
void init (uint32_t id)
 
void apInit (uint32_t nodeId)
 
void initBridgeStatusBroadcast ()
 
void initBridgeCoordination ()
 
void sendBridgeCoordination ()
 
int8_t scanRouterSignalStrength (TSTRING routerSSID, uint8_t *routerChannel=nullptr)
 
void startBridgeElection ()
 
void evaluateElection ()
 
void promoteToBridge (uint8_t routerChannel)
 
bool attemptIsolatedBridgePromotion ()
 
void handleBridgeElection (uint32_t fromNode, int8_t routerRSSI, uint8_t routerChannel, uint32_t uptime, uint32_t freeMemory)
 
void sendBridgeStatus (bool leaving=false)
 
bool hasActualInternetAccess ()
 
bool detectCaptivePortal ()
 
void initGatewayInternetHandler ()
 
void probeUplinkAfterAssociation ()
 
void eventHandleInit ()
 
void initSharedGatewayMonitoring ()
 
void monitorRouterConnection ()
 
void scheduleRouterReconnect ()
 
void attemptRouterReconnect ()
 
- Protected Member Functions inherited from painlessmesh::Mesh< Connection >
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

TSTRING _meshSSID
 
TSTRING _meshPassword
 
uint8_t _meshChannel = 1
 
uint8_t _meshHidden = 0
 
uint8_t _meshMaxConn = MAX_CONN
 
uint16_t _meshPort = 5555
 
IPAddress _apIp
 
StationScan stationScan
 
gateway::NegativeDnsCache negativeDns
 
AsyncServer * _tcpListener = nullptr
 
std::shared_ptr< Task > bridgeStatusTask
 
uint32_t _lastBridgeStatusBroadcast = 0
 
bool _pendingStationReconnect = false
 
bool bridgeFailoverEnabled = true
 
bool routerCredentialsConfigured = false
 
TSTRING routerSSID = ""
 
TSTRING routerPassword = ""
 
uint32_t electionTimeoutMs = 5000
 
int8_t minimumBridgeRSSI
 
uint32_t electionStartupDelayMs
 
uint32_t electionRandomDelayMinMs
 
uint32_t electionRandomDelayMaxMs
 
uint32_t lastRoleChangeTime = 0
 
bool bridgeCheckPending = false
 
ElectionState electionState = ELECTION_IDLE
 
uint32_t electionDeadline = 0
 
std::vector< BridgeCandidate > electionCandidates
 
std::function< void(bool isBridge, const TSTRING &reason)> bridgeRoleChangedCallback
 
uint8_t _isolatedBridgeRetryAttempts = 0
 
uint32_t _isolatedBridgeRetryResetTime
 
bool _isolatedRetryPending
 
bool multiBridgeEnabled = false
 
BridgeSelectionStrategy bridgeSelectionStrategy = PRIORITY_BASED
 
uint8_t maxConcurrentBridges = 2
 
uint8_t bridgePriority = 5
 
TSTRING bridgeRole = "secondary"
 
std::shared_ptr< Task > bridgeCoordinationTask
 
std::map< uint32_t, uint8_t > bridgePriorities
 
std::vector< uint32_t > knownBridgePeers
 
size_t lastSelectedBridgeIndex = 0
 
std::map< uint32_t, BridgeCoordinationState > lastBridgeCoordinationState
 
std::function< void(const plugin::BridgeCoordinationPackage &, uint32_t)> bridgeCoordinationCallback
 
std::function< void(const plugin::BridgeCoordinationPackage &, uint32_t, TSTRING)> bridgeCoordinationChangedCallback
 
std::shared_ptr< Task > bridgeLostDetectionTask
 
bool _sharedGatewayMode = false
 
gateway::SharedGatewayConfig _sharedGatewayConfig
 
std::shared_ptr< Task > _sharedGatewayMonitorTask
 
uint32_t _lastRouterReconnectAttempt = 0
 
uint8_t _routerReconnectAttempts = 0
 
- Protected Attributes inherited from painlessmesh::Mesh< Connection >
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 const uint8_t MAX_ISOLATED_BRIDGE_RETRY_ATTEMPTS
 
static const uint32_t isolatedBridgeRetryIntervalMs
 
static const uint32_t isolatedBridgeRetryResetIntervalMs
 
static const uint16_t ISOLATED_BRIDGE_RETRY_SCAN_THRESHOLD
 
static const uint32_t ASYNC_PROMOTION_DELAY_MS
 
static const uint8_t MAX_ROUTER_RECONNECT_ATTEMPTS = 10
 
static const uint32_t ROUTER_RECONNECT_BASE_INTERVAL
 
static const uint32_t ROUTER_RECONNECT_MAX_INTERVAL
 
static const int ROUTER_CONNECTION_TIMEOUT_SECONDS
 
static const uint8_t MIN_WIFI_CHANNEL = 1
 
static const uint8_t MAX_WIFI_CHANNEL
 
- Static Protected Attributes inherited from painlessmesh::Mesh< Connection >
static constexpr unsigned long ACK_CHECK_INTERVAL_MS
 
static constexpr uint32_t ACK_BROADCAST_JITTER_MS
 
static constexpr uint32_t ACK_BROADCAST_MIN_TIMEOUT_MS
 
static constexpr size_t MAX_QUEUED_BROADCAST_ACKS
 

Friends

class ::StationScan
 

Additional Inherited Members

- Public Attributes inherited from painlessmesh::Mesh< Connection >
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
 
bool isExternalScheduler
 
bool shouldContainRoot
 Is the node a root node.
 
Scheduler * mScheduler
 
std::vector< BridgeInfo > knownBridges
 
uint32_t bridgeStatusIntervalMs
 
uint32_t bridgeTimeoutMs
 
bool bridgeStatusBroadcastEnabled
 
bool _overCapacity
 
uint32_t _capacityWarnedAt
 
std::shared_ptr< Task > bridgeCleanupTask
 
uint32_t metricsDisconnectCount
 
rtc::RTCManager rtcManager
 
bool diagnosticsEnabled
 
std::vector< ElectionRecord > electionHistory
 
BridgeChangeEvent lastBridgeChange
 
uint32_t lastBridgeChangeTime
 
gateway::InternetHealthChecker internetHealthChecker
 
std::shared_ptr< Task > internetHealthCheckTask
 
localInternetChangedCallback_t localInternetChangedCallback
 
std::map< uint32_t, PendingInternetRequest > pendingInternetRequests
 
std::shared_ptr< Task > internetCleanupTask
 
uint32_t internetRequestTimeout
 
uint8_t internetRetryCount
 
uint32_t internetRetryDelay
 
bool sendToInternetEnabled
 
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
 

Member Enumeration Documentation

◆ BridgeSelectionStrategy

Enumerator
PRIORITY_BASED 
ROUND_ROBIN 
BEST_SIGNAL 

◆ ElectionState

Enumerator
ELECTION_IDLE 
ELECTION_SCANNING 
ELECTION_COLLECTING 

Member Function Documentation

◆ apInit()

void painlessmesh::wifi::Mesh::apInit ( uint32_t  nodeId)
inlineprotected

◆ attemptIsolatedBridgePromotion()

bool painlessmesh::wifi::Mesh::attemptIsolatedBridgePromotion ( )
inlineprotected

Attempt to promote an isolated node to bridge

This method handles the case where a node is isolated (no mesh connections) but has router credentials. Unlike the election-based promotion, this directly attempts to connect to the router without requiring mesh connectivity.

This is useful for:

  • Nodes that failed initial bridge setup and need to retry
  • Nodes that are the first to start and no mesh exists yet
  • Recovery scenarios where mesh network is unavailable

CRITICAL: This function is called from within a scheduled task (isolated bridge retry task). We MUST NOT call stop() synchronously here because that would clear the taskList while the current task is executing, causing a use-after-free crash when the task tries to return to scheduler.

Returns
true if promotion was attempted (regardless of success), false if skipped

◆ attemptRouterReconnect()

void painlessmesh::wifi::Mesh::attemptRouterReconnect ( )
inlineprotected

Attempt to reconnect to the router

◆ blockNodeAfterTCPFailure()

void painlessmesh::wifi::Mesh::blockNodeAfterTCPFailure ( IPAddress  ip,
uint32_t  blockDurationMs = painlessmesh::tcp::TCP_FAILURE_BLOCK_DURATION_MS 
)
inline

Block a node after TCP connection failure

This prevents the node from being repeatedly selected for connection attempts when its TCP server is unresponsive. The block is temporary and will expire after the configured duration.

Parameters
ipThe IP address of the failed node
blockDurationMsDuration to block the node in milliseconds (default: 60s)

◆ checkForBridge()

void painlessmesh::wifi::Mesh::checkForBridge ( )
inline

◆ checkForBridgeSoon()

void painlessmesh::wifi::Mesh::checkForBridgeSoon ( )
inline

◆ detectCaptivePortal()

bool painlessmesh::wifi::Mesh::detectCaptivePortal ( )
inlineprotected

Detect captive portal by making a lightweight HTTP request

Captive portals often allow DNS resolution but intercept HTTP requests, returning redirects, cached responses (HTTP 203), or their own HTML. This function makes a simple HTTP GET request to a known endpoint and verifies the response to detect such interference.

Test endpoint used:

Returns
true if no captive portal detected, false if portal found or check fails

◆ enableBridgeFailover()

void painlessmesh::wifi::Mesh::enableBridgeFailover ( bool  enabled)
inline

Enable or disable automatic bridge failover

When enabled, nodes will participate in bridge elections if the primary bridge goes offline and they have router credentials configured.

Parameters
enabledtrue to enable automatic failover (default), false to disable

◆ enableMultiBridge()

void painlessmesh::wifi::Mesh::enableMultiBridge ( bool  enabled)
inline

Enable or disable multi-bridge coordination mode

When enabled, multiple bridges can operate simultaneously for:

  • Load balancing across multiple Internet connections
  • Geographic distribution
  • Hot standby redundancy without failover delays
Parameters
enabledtrue to enable multi-bridge mode, false for single-bridge (default)

◆ evaluateElection()

void painlessmesh::wifi::Mesh::evaluateElection ( )
inlineprotected

Evaluate election and determine winner Called after election timeout expires

◆ eventHandleInit()

void painlessmesh::wifi::Mesh::eventHandleInit ( )
inlineprotected

◆ getActiveBridges()

std::vector< uint32_t > painlessmesh::wifi::Mesh::getActiveBridges ( )
inline

Get list of all active bridges (with Internet connection)

Returns
vector of node IDs for active bridges

◆ getAPIP()

IPAddress painlessmesh::wifi::Mesh::getAPIP ( )
inline

◆ getRecommendedBridge()

uint32_t painlessmesh::wifi::Mesh::getRecommendedBridge ( )
inline

Get recommended bridge for message transmission

Uses the configured bridge selection strategy to pick the best bridge. Returns 0 if no suitable bridge is available.

Returns
node ID of recommended bridge, or 0 if none available

◆ getSharedGatewayConfig()

const gateway::SharedGatewayConfig & painlessmesh::wifi::Mesh::getSharedGatewayConfig ( ) const
inline

Get the shared gateway configuration

Returns
const reference to the SharedGatewayConfig

◆ getStationIP()

IPAddress painlessmesh::wifi::Mesh::getStationIP ( )
inline

◆ handleBridgeElection()

void painlessmesh::wifi::Mesh::handleBridgeElection ( uint32_t  fromNode,
int8_t  routerRSSI,
uint8_t  routerChannel,
uint32_t  uptime,
uint32_t  freeMemory 
)
inlineprotected

Handle received bridge election package Called by package handler when election message arrives

◆ handleStationDisconnectComplete()

void painlessmesh::wifi::Mesh::handleStationDisconnectComplete ( )
inline

Handle station disconnect completion Called after WiFi disconnect event is fully processed This ensures proper sequencing: disconnect -> event -> reconnect

◆ hasActualInternetAccess()

bool painlessmesh::wifi::Mesh::hasActualInternetAccess ( )
inlineprotected

Check if gateway has actual internet connectivity

Tests DNS resolution to detect scenarios where WiFi is connected but the router has no internet access. This provides early detection before attempting HTTP requests that would timeout or fail.

Returns
true if internet is accessible, false otherwise

◆ hasInternetConnection()

bool painlessmesh::wifi::Mesh::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 via the painlessMesh protocol. To send data to the Internet from a regular node, you must use sendToInternet() which routes through a gateway, or use initAsSharedGateway(meshSSID, meshPwd, ROUTER_SSID, ROUTER_PWD, scheduler, port) to give all nodes direct router access (requires router credentials).

Override of base class method to also check if THIS node is a bridge with Internet connectivity, not just other bridges in the mesh.

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

◆ init() [1/4]

void painlessmesh::wifi::Mesh::init ( Scheduler *  scheduler,
uint32_t  id 
)
inlineprotected

◆ init() [2/4]

void painlessmesh::wifi::Mesh::init ( TSTRING  ssid,
TSTRING  password,
Scheduler *  baseScheduler,
uint16_t  port = 5555,
WiFiMode_t  connectMode = WIFI_AP_STA,
uint8_t  channel = 1,
uint8_t  hidden = 0,
uint8_t  maxconn = MAX_CONN,
TSTRING  stationSSID = "",
TSTRING  stationPassword = "" 
)
inline

Initialize the mesh network

Add this to your setup() function. This routine does the following things:

  • Starts a wifi network
  • Begins searching for other wifi networks that are part of the mesh
  • Logs on to the best mesh network node it finds… if it doesn’t find anything, it starts a new search in 5 seconds.
Parameters
ssidThe name of your mesh. All nodes share same AP ssid. They are distinguished by BSSID.
passwordWifi password to your mesh.
portthe TCP port that you want the mesh server to run on. Defaults to 5555 if not specified.
connectModeSwitch between WIFI_AP, WIFI_STA and WIFI_AP_STA (default) mode

◆ init() [3/4]

void painlessmesh::wifi::Mesh::init ( TSTRING  ssid,
TSTRING  password,
uint16_t  port = 5555,
WiFiMode_t  connectMode = WIFI_AP_STA,
uint8_t  channel = 1,
uint8_t  hidden = 0,
uint8_t  maxconn = MAX_CONN,
TSTRING  stationSSID = "",
TSTRING  stationPassword = "" 
)
inline

Initialize the mesh network

Add this to your setup() function. This routine does the following things:

  • Starts a wifi network
  • Begins searching for other wifi networks that are part of the mesh
  • Logs on to the best mesh network node it finds… if it doesn’t find anything, it starts a new search in 5 seconds.
Parameters
ssidThe name of your mesh. All nodes share same AP ssid. They are distinguished by BSSID.
passwordWifi password to your mesh.
portthe TCP port that you want the mesh server to run on. Defaults to 5555 if not specified.
connectModeSwitch between WIFI_AP, WIFI_STA and WIFI_AP_STA (default) mode

◆ init() [4/4]

void painlessmesh::wifi::Mesh::init ( uint32_t  id)
inlineprotected

◆ initAsBridge() [1/2]

bool painlessmesh::wifi::Mesh::initAsBridge ( TSTRING  meshSSID,
TSTRING  meshPassword,
TSTRING  routerSSID,
TSTRING  routerPassword,
Scheduler *  baseScheduler,
uint16_t  port,
uint8_t  priority 
)
inline

Initialize mesh as a bridge node with priority (for multi-bridge mode)

This overload adds bridge priority configuration for multi-bridge deployments. Priority determines which bridge is preferred when multiple bridges are available.

Parameters
meshSSIDThe name of your mesh network
meshPasswordWiFi password for the mesh
routerSSIDSSID of the router to connect to
routerPasswordPassword for the router
baseSchedulerTask scheduler for mesh operations
portTCP port for mesh communication (default: 5555)
priorityBridge priority: 10=highest (primary), 5=medium (secondary), 1=lowest (default: 5)

◆ initAsBridge() [2/2]

bool painlessmesh::wifi::Mesh::initAsBridge ( TSTRING  meshSSID,
TSTRING  meshPassword,
TSTRING  routerSSID,
TSTRING  routerPassword,
Scheduler *  baseScheduler,
uint16_t  port = 5555 
)
inline

Initialize mesh as a bridge node with automatic channel detection

This method connects to a router first, detects its channel, then initializes the mesh on the same channel. This ensures the bridge can maintain both router and mesh connections on the same channel.

The bridge node will automatically:

  • Connect to the specified router in STA mode
  • Detect the router's WiFi channel
  • Initialize the mesh AP on the detected channel
  • Set itself as root node
  • Maintain the router connection
Parameters
meshSSIDThe name of your mesh network
meshPasswordWiFi password for the mesh
routerSSIDSSID of the router to connect to
routerPasswordPassword for the router
baseSchedulerTask scheduler for mesh operations
portTCP port for mesh communication (default: 5555)

◆ initAsSharedGateway()

bool painlessmesh::wifi::Mesh::initAsSharedGateway ( TSTRING  meshPrefix,
TSTRING  meshPassword,
TSTRING  routerSSID,
TSTRING  routerPassword,
Scheduler *  userScheduler,
uint16_t  port = 5555,
gateway::SharedGatewayConfig  config = gateway::SharedGatewayConfig() 
)
inline

Initialize mesh as a shared gateway node

This method initializes all mesh nodes in AP+STA mode with router connectivity. Unlike initAsBridge() which creates a single bridge node, initAsSharedGateway() allows all nodes to connect to the router while maintaining mesh communication.

Key features:

  • All nodes operate in AP+STA mode
  • All nodes connect to the same router
  • Mesh and router operate on the same channel for reliability
  • Automatic router reconnection on disconnect
  • Channel synchronization between mesh and router
Parameters
meshPrefixThe name prefix for the mesh network
meshPasswordWiFi password for the mesh network
routerSSIDSSID of the router to connect to
routerPasswordPassword for the router
userSchedulerTask scheduler for mesh operations
portTCP port for mesh communication (default: 5555)
configSharedGatewayConfig with advanced settings (optional)
Returns
true if initialization succeeded, false otherwise

◆ initBridgeCoordination()

void painlessmesh::wifi::Mesh::initBridgeCoordination ( )
inlineprotected

Initialize bridge coordination broadcasting Sets up periodic coordination messages between bridges

◆ initBridgeStatusBroadcast()

void painlessmesh::wifi::Mesh::initBridgeStatusBroadcast ( )
inlineprotected

Initialize bridge status broadcasting Sets up a periodic task to broadcast bridge status to the mesh

◆ initGatewayInternetHandler()

void painlessmesh::wifi::Mesh::initGatewayInternetHandler ( )
inlineprotected

Initialize gateway Internet handler Registers GATEWAY_DATA package handler for bridge/gateway nodes

This handler processes GATEWAY_DATA packages from mesh nodes requesting HTTP/HTTPS requests to Internet destinations. It validates connectivity, makes the request, and sends back a GATEWAY_ACK with the result.

Security notes:

  • Neither target authenticates the TLS peer. The library configures no trust anchor anywhere: there is no setCACert, no certificate bundle and no fingerprint API on the gateway config, so an https:// destination is not protected against an active man in the middle.
    • ESP8266 calls setInsecure(), which disables certificate validation outright.
    • ESP32 calls http.begin(url) with no trust anchor supplied. What that yields depends entirely on the Arduino-ESP32 core in use; do not read it as verified. (An earlier revision of this comment claimed ESP32 "uses default SSL settings with certificate validation" – that was never backed by anything in src/.) Treat gateway HTTPS as transport encryption without authentication, and see SECURITY.md for the full threat model.

Limitations:

  • HTTP redirects (3xx) are not automatically followed
  • Only 2xx status codes are treated as success
  • Request timeout is GATEWAY_HTTP_TIMEOUT_MS, which is derived from NODE_TIMEOUT and asserted to stay below it (see painlessmesh/gateway.hpp)

◆ initSharedGatewayMonitoring()

void painlessmesh::wifi::Mesh::initSharedGatewayMonitoring ( )
inlineprotected

Initialize shared gateway monitoring

Sets up periodic monitoring of router connection and automatic reconnection logic for shared gateway mode.

◆ initStation()

void painlessmesh::wifi::Mesh::initStation ( )
inline

◆ isMultiBridgeEnabled()

bool painlessmesh::wifi::Mesh::isMultiBridgeEnabled ( ) const
inline

Check if multi-bridge mode is enabled

Returns
true if multi-bridge coordination is enabled

◆ isSharedGatewayMode()

bool painlessmesh::wifi::Mesh::isSharedGatewayMode ( ) const
inline

Check if shared gateway mode is enabled

Returns
true if node is operating in shared gateway mode

◆ monitorRouterConnection()

void painlessmesh::wifi::Mesh::monitorRouterConnection ( )
inlineprotected

Monitor router connection in shared gateway mode

Checks router connectivity and triggers reconnection if needed.

◆ onBridgeCoordination()

void painlessmesh::wifi::Mesh::onBridgeCoordination ( std::function< void(const plugin::BridgeCoordinationPackage &, uint32_t)>  callback)
inline

Set callback for bridge coordination messages

Called every time a coordination message (Type 613) is received from another bridge. Useful for monitoring bridge health and status.

For non-bridge nodes, this also registers a Type 613 handler so that regular mesh nodes can monitor bridge coordination traffic.

Parameters
callbackFunction called with the coordination package and sender node ID

◆ onBridgeCoordinationChanged()

void painlessmesh::wifi::Mesh::onBridgeCoordinationChanged ( std::function< void(const plugin::BridgeCoordinationPackage &, uint32_t, TSTRING)>  callback)
inline

Set callback for bridge coordination state changes

Called when a new bridge is discovered, an existing bridge changes its priority/role/load, or a bridge is lost (no coordination message for 60s).

Parameters
callbackFunction called with the coordination package, sender node ID, and change type ("new", "updated", or "lost")

◆ onBridgeRoleChanged()

void painlessmesh::wifi::Mesh::onBridgeRoleChanged ( std::function< void(bool isBridge, const TSTRING &reason)>  callback)
inline

Set callback for when this node's bridge role changes

Parameters
callbackFunction to call when role changes

◆ probeUplinkAfterAssociation()

void painlessmesh::wifi::Mesh::probeUplinkAfterAssociation ( )
inlineprotected

The station just got an IP. On a node that runs the Internet health check – a bridge or a shared gateway, whose station is the manual router link – the last probe most likely ran during association and failed, and the next is a full interval away (issue #450). Probe again now, from the scheduler rather than the Wi-Fi event task, so hasLocalInternet() and the bridge's own sends stop waiting out the interval. A regular node's mesh station never enables the check and is left alone.

◆ promoteToBridge()

void painlessmesh::wifi::Mesh::promoteToBridge ( uint8_t  routerChannel)
inlineprotected

Promote this node to bridge role Called when node wins election

CRITICAL: This function is called from within evaluateElection() which runs as a scheduled task. We MUST NOT call stop() synchronously here because that would clear the taskList while the current task is executing, causing a use-after-free crash when the task tries to return to scheduler.

Instead, we schedule the actual promotion work to run after the current task completes, allowing safe cleanup of task structures.

◆ scanRouterSignalStrength()

int8_t painlessmesh::wifi::Mesh::scanRouterSignalStrength ( TSTRING  routerSSID,
uint8_t *  routerChannel = nullptr 
)
inlineprotected

Scan for router and return its signal strength

Parameters
routerSSIDSSID of router to scan for
Returns
RSSI in dBm (negative number, -127 to 0), or 0 if not found

◆ scheduleRouterReconnect()

void painlessmesh::wifi::Mesh::scheduleRouterReconnect ( )
inlineprotected

Schedule router reconnection with exponential backoff

◆ sendBridgeCoordination()

void painlessmesh::wifi::Mesh::sendBridgeCoordination ( )
inlineprotected

Send bridge coordination message to other bridges Called periodically in multi-bridge mode

◆ sendBridgeStatus()

void painlessmesh::wifi::Mesh::sendBridgeStatus ( bool  leaving = false)
inlineprotected

Send bridge status broadcast Called periodically by bridge nodes to report connectivity status

◆ setBridgeSelectionStrategy()

void painlessmesh::wifi::Mesh::setBridgeSelectionStrategy ( BridgeSelectionStrategy  strategy)
inline

Set bridge selection strategy for multi-bridge mode

Parameters
strategySelection strategy:
  • PRIORITY_BASED: Always use highest priority bridge (default)
  • ROUND_ROBIN: Distribute load evenly across bridges
  • BEST_SIGNAL: Always use bridge with best RSSI

◆ setElectionRandomDelay()

void painlessmesh::wifi::Mesh::setElectionRandomDelay ( uint32_t  minMs,
uint32_t  maxMs 
)
inline

Set the random delay range for bridge elections

When multiple nodes detect missing bridge simultaneously, randomized delays prevent all nodes from starting elections at the same instant. Longer delays provide more time for mesh discovery and reduce split-brain risk.

Parameters
minMsMinimum random delay in milliseconds (default: 1000 = 1 second)
maxMsMaximum random delay in milliseconds (default: 3000 = 3 seconds)

◆ setElectionStartupDelay()

void painlessmesh::wifi::Mesh::setElectionStartupDelay ( uint32_t  delayMs)
inline

Set the startup delay before first bridge election check

Allows time for mesh network formation before starting bridge elections. Longer delays reduce the risk of split-brain scenarios when multiple nodes start simultaneously, ensuring nodes discover each other before elections.

Parameters
delayMsStartup delay in milliseconds (default: 60000 = 60 seconds, min: 10000)

◆ setElectionTimeout()

void painlessmesh::wifi::Mesh::setElectionTimeout ( uint32_t  timeoutMs)
inline

Set the election timeout (how long to collect candidates)

Parameters
timeoutMsTimeout in milliseconds (default: 5000 = 5 seconds)

◆ setHostname()

bool painlessmesh::wifi::Mesh::setHostname ( const char *  hostname)
inline

◆ setMaxBridges()

void painlessmesh::wifi::Mesh::setMaxBridges ( uint8_t  maxBridges)
inline

Set maximum number of concurrent bridges in multi-bridge mode

Parameters
maxBridgesMaximum bridges to track (default: 2, max: 5)

◆ setMinimumBridgeRSSI()

void painlessmesh::wifi::Mesh::setMinimumBridgeRSSI ( int8_t  minRSSI)
inline

Set the minimum RSSI required for bridge election

Prevents nodes with poor router signal from becoming bridges in isolated elections. When a node is the only candidate, it must meet this threshold. When multiple candidates exist, the best RSSI wins regardless of threshold.

Parameters
minRSSIMinimum RSSI in dBm (default: -80 dBm, range: -100 to -30)

◆ setRouterCredentials()

void painlessmesh::wifi::Mesh::setRouterCredentials ( TSTRING  ssid,
TSTRING  password 
)
inline

Set router credentials for bridge election participation

Nodes must have router credentials configured to participate in bridge elections. When a bridge fails, only nodes with credentials can become the new bridge.

Parameters
ssidRouter SSID
passwordRouter password

◆ startBridgeElection()

void painlessmesh::wifi::Mesh::startBridgeElection ( )
inlineprotected

Start bridge election process Called when primary bridge failure is detected

◆ stationManual()

void painlessmesh::wifi::Mesh::stationManual ( TSTRING  ssid,
TSTRING  password,
uint16_t  port = 0,
IPAddress  remote_ip = IPAddress(0, 0, 0, 0) 
)
inline

Connect (as a station) to a specified network and ip

You can pass {0,0,0,0} as IP to have it connect to the gateway

This stops the node from scanning for other (non specified) nodes and you should probably also use this node as an anchor: setAnchor(true)

◆ stop()

void painlessmesh::wifi::Mesh::stop ( )
inline

◆ tcpConnect()

void painlessmesh::wifi::Mesh::tcpConnect ( )
inline

Establish TCP connection to mesh network

This method is called by WiFi event handlers when station gets IP address. It creates a TCP client connection to the mesh network gateway.

Architecture Note: This is intentionally kept in the Mesh class rather than extracted to a separate StationConnection class because:

  • It's tightly coupled with WiFi event lifecycle
  • Needs access to mesh state and callbacks
  • Moving it would increase complexity without clear benefits
  • The existing design keeps connection logic cohesive with WiFi management

TCP Connection Retry: The TCP connection now includes automatic retry with exponential backoff. If the initial connection fails (error -14 ERR_CONN or other errors), the system will retry up to the configured maxRetries times before triggering a full WiFi reconnection cycle (see setTcpRetryConfig()). This helps handle:

  • Timing issues where TCP server is not ready immediately
  • Network stack stabilization after IP acquisition
  • Transient network conditions

◆ tcpListening()

bool painlessmesh::wifi::Mesh::tcpListening ( )
inline

Whether this node's TCP listener exists and is in LISTEN.

The state peers depend on and nothing else reports: a node whose listener was never created (#466 crashed before it could be) or was re-created not listening (#435's promoted bridge served nothing for two minutes) is reachable only through connections it made outbound, and nothing can join through it. Cheap enough to put in a health report.

◆ tcpServerInit()

void painlessmesh::wifi::Mesh::tcpServerInit ( )
inline

Friends And Related Symbol Documentation

◆ ::StationScan

friend class ::StationScan
friend

Member Data Documentation

◆ _apIp

IPAddress painlessmesh::wifi::Mesh::_apIp
protected

◆ _isolatedBridgeRetryAttempts

uint8_t painlessmesh::wifi::Mesh::_isolatedBridgeRetryAttempts = 0
protected

◆ _isolatedBridgeRetryResetTime

uint32_t painlessmesh::wifi::Mesh::_isolatedBridgeRetryResetTime
protected
Initial value:
=
0

◆ _isolatedRetryPending

bool painlessmesh::wifi::Mesh::_isolatedRetryPending
protected
Initial value:
=
false

◆ _lastBridgeStatusBroadcast

uint32_t painlessmesh::wifi::Mesh::_lastBridgeStatusBroadcast = 0
protected

◆ _lastRouterReconnectAttempt

uint32_t painlessmesh::wifi::Mesh::_lastRouterReconnectAttempt = 0
protected

◆ _meshChannel

uint8_t painlessmesh::wifi::Mesh::_meshChannel = 1
protected

◆ _meshHidden

uint8_t painlessmesh::wifi::Mesh::_meshHidden = 0
protected

◆ _meshMaxConn

uint8_t painlessmesh::wifi::Mesh::_meshMaxConn = MAX_CONN
protected

◆ _meshPassword

TSTRING painlessmesh::wifi::Mesh::_meshPassword
protected

◆ _meshPort

uint16_t painlessmesh::wifi::Mesh::_meshPort = 5555
protected

◆ _meshSSID

TSTRING painlessmesh::wifi::Mesh::_meshSSID
protected

◆ _pendingStationReconnect

bool painlessmesh::wifi::Mesh::_pendingStationReconnect = false
protected

◆ _routerReconnectAttempts

uint8_t painlessmesh::wifi::Mesh::_routerReconnectAttempts = 0
protected

◆ _sharedGatewayConfig

gateway::SharedGatewayConfig painlessmesh::wifi::Mesh::_sharedGatewayConfig
protected

◆ _sharedGatewayMode

bool painlessmesh::wifi::Mesh::_sharedGatewayMode = false
protected

◆ _sharedGatewayMonitorTask

std::shared_ptr<Task> painlessmesh::wifi::Mesh::_sharedGatewayMonitorTask
protected

◆ _tcpListener

AsyncServer* painlessmesh::wifi::Mesh::_tcpListener = nullptr
protected

◆ ASYNC_PROMOTION_DELAY_MS

const uint32_t painlessmesh::wifi::Mesh::ASYNC_PROMOTION_DELAY_MS
staticprotected
Initial value:
=
10

◆ bridgeCheckPending

bool painlessmesh::wifi::Mesh::bridgeCheckPending = false
protected

◆ bridgeCoordinationCallback

std::function<void(const plugin::BridgeCoordinationPackage&, uint32_t)> painlessmesh::wifi::Mesh::bridgeCoordinationCallback
protected

◆ bridgeCoordinationChangedCallback

std::function<void(const plugin::BridgeCoordinationPackage&, uint32_t, TSTRING)> painlessmesh::wifi::Mesh::bridgeCoordinationChangedCallback
protected

◆ bridgeCoordinationTask

std::shared_ptr<Task> painlessmesh::wifi::Mesh::bridgeCoordinationTask
protected

◆ bridgeFailoverEnabled

bool painlessmesh::wifi::Mesh::bridgeFailoverEnabled = true
protected

◆ bridgeLostDetectionTask

std::shared_ptr<Task> painlessmesh::wifi::Mesh::bridgeLostDetectionTask
protected

◆ bridgePriorities

std::map<uint32_t, uint8_t> painlessmesh::wifi::Mesh::bridgePriorities
protected

◆ bridgePriority

uint8_t painlessmesh::wifi::Mesh::bridgePriority = 5
protected

◆ bridgeRole

TSTRING painlessmesh::wifi::Mesh::bridgeRole = "secondary"
protected

◆ bridgeRoleChangedCallback

std::function<void(bool isBridge, const TSTRING& reason)> painlessmesh::wifi::Mesh::bridgeRoleChangedCallback
protected

◆ bridgeSelectionStrategy

BridgeSelectionStrategy painlessmesh::wifi::Mesh::bridgeSelectionStrategy = PRIORITY_BASED
protected

◆ bridgeStatusTask

std::shared_ptr<Task> painlessmesh::wifi::Mesh::bridgeStatusTask
protected

◆ electionCandidates

std::vector<BridgeCandidate> painlessmesh::wifi::Mesh::electionCandidates
protected

◆ electionDeadline

uint32_t painlessmesh::wifi::Mesh::electionDeadline = 0
protected

◆ electionRandomDelayMaxMs

uint32_t painlessmesh::wifi::Mesh::electionRandomDelayMaxMs
protected
Initial value:
=
3000

◆ electionRandomDelayMinMs

uint32_t painlessmesh::wifi::Mesh::electionRandomDelayMinMs
protected
Initial value:
=
1000

◆ electionStartupDelayMs

uint32_t painlessmesh::wifi::Mesh::electionStartupDelayMs
protected
Initial value:
=
60000

◆ electionState

ElectionState painlessmesh::wifi::Mesh::electionState = ELECTION_IDLE
protected

◆ electionTimeoutMs

uint32_t painlessmesh::wifi::Mesh::electionTimeoutMs = 5000
protected

◆ ISOLATED_BRIDGE_RETRY_SCAN_THRESHOLD

const uint16_t painlessmesh::wifi::Mesh::ISOLATED_BRIDGE_RETRY_SCAN_THRESHOLD
staticprotected
Initial value:
=
6

◆ isolatedBridgeRetryIntervalMs

const uint32_t painlessmesh::wifi::Mesh::isolatedBridgeRetryIntervalMs
staticprotected
Initial value:
=
60000

◆ isolatedBridgeRetryResetIntervalMs

const uint32_t painlessmesh::wifi::Mesh::isolatedBridgeRetryResetIntervalMs
staticprotected
Initial value:
=
300000

◆ knownBridgePeers

std::vector<uint32_t> painlessmesh::wifi::Mesh::knownBridgePeers
protected

◆ lastBridgeCoordinationState

std::map<uint32_t, BridgeCoordinationState> painlessmesh::wifi::Mesh::lastBridgeCoordinationState
protected

◆ lastRoleChangeTime

uint32_t painlessmesh::wifi::Mesh::lastRoleChangeTime = 0
protected

◆ lastSelectedBridgeIndex

size_t painlessmesh::wifi::Mesh::lastSelectedBridgeIndex = 0
protected

◆ MAX_ISOLATED_BRIDGE_RETRY_ATTEMPTS

const uint8_t painlessmesh::wifi::Mesh::MAX_ISOLATED_BRIDGE_RETRY_ATTEMPTS
staticprotected
Initial value:
=
5

◆ MAX_ROUTER_RECONNECT_ATTEMPTS

const uint8_t painlessmesh::wifi::Mesh::MAX_ROUTER_RECONNECT_ATTEMPTS = 10
staticprotected

◆ MAX_WIFI_CHANNEL

const uint8_t painlessmesh::wifi::Mesh::MAX_WIFI_CHANNEL
staticprotected
Initial value:
=
14

◆ maxConcurrentBridges

uint8_t painlessmesh::wifi::Mesh::maxConcurrentBridges = 2
protected

◆ MIN_WIFI_CHANNEL

const uint8_t painlessmesh::wifi::Mesh::MIN_WIFI_CHANNEL = 1
staticprotected

◆ minimumBridgeRSSI

int8_t painlessmesh::wifi::Mesh::minimumBridgeRSSI
protected
Initial value:
=
-80

◆ multiBridgeEnabled

bool painlessmesh::wifi::Mesh::multiBridgeEnabled = false
protected

◆ negativeDns

gateway::NegativeDnsCache painlessmesh::wifi::Mesh::negativeDns
protected

Helper method to send gateway acknowledgment Hosts that recently failed to resolve; fed on ESP32 only, see the GATEWAY_DATA handler.

◆ ROUTER_CONNECTION_TIMEOUT_SECONDS

const int painlessmesh::wifi::Mesh::ROUTER_CONNECTION_TIMEOUT_SECONDS
staticprotected
Initial value:
=
30

◆ ROUTER_RECONNECT_BASE_INTERVAL

const uint32_t painlessmesh::wifi::Mesh::ROUTER_RECONNECT_BASE_INTERVAL
staticprotected
Initial value:
=
5000

◆ ROUTER_RECONNECT_MAX_INTERVAL

const uint32_t painlessmesh::wifi::Mesh::ROUTER_RECONNECT_MAX_INTERVAL
staticprotected
Initial value:
=
300000

◆ routerCredentialsConfigured

bool painlessmesh::wifi::Mesh::routerCredentialsConfigured = false
protected

◆ routerPassword

TSTRING painlessmesh::wifi::Mesh::routerPassword = ""
protected

◆ routerSSID

TSTRING painlessmesh::wifi::Mesh::routerSSID = ""
protected

◆ stationScan

StationScan painlessmesh::wifi::Mesh::stationScan
protected

◆ TCP_STATE_LISTEN

constexpr uint8_t painlessmesh::wifi::Mesh::TCP_STATE_LISTEN = 1
staticconstexpr

lwIP's LISTEN, which AsyncServer::status() returns as the pcb's state on both cores (ESPAsyncTCP and ESP32Async/AsyncTCP alike). Named rather than written as 1 because status() also answers 0 – lwIP's CLOSED – when the server holds no pcb at all, so the literal read as if it conflated the two. It does not: a listener is listening, or it is not.


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