|
AlteriomPainlessMesh v2.1.1
Easy ESP32/ESP8266 mesh networking with Alteriom IoT extensions
|
Configuration structure for Shared Gateway Mode. More...
#include <gateway.hpp>
Public Member Functions | |
| ValidationResult | validate () const |
| Validate the configuration. | |
| bool | canParticipateInElection () const |
| Check if this node can participate in gateway elections. | |
| bool | hasRouterCredentials () const |
| Check if the configuration has valid router credentials. | |
Public Attributes | |
| bool | enabled = false |
| Enable or disable shared gateway functionality. | |
| TSTRING | routerSSID = "" |
| Router SSID to connect for Internet access. | |
| TSTRING | routerPassword = "" |
| Router password for authentication. | |
| uint32_t | internetCheckInterval = 30000 |
| Interval between Internet connectivity checks in milliseconds. | |
| TSTRING | internetCheckHost = "8.8.8.8" |
| Host to ping for Internet connectivity verification. | |
| uint16_t | internetCheckPort = 53 |
| Port for Internet connectivity check. | |
| uint32_t | internetCheckTimeout = 5000 |
| Timeout for Internet connectivity check in milliseconds. | |
| uint8_t | messageRetryCount = 3 |
| Number of retry attempts for message delivery. | |
| uint32_t | retryInterval = 1000 |
| Interval between retry attempts in milliseconds. | |
| uint32_t | duplicateTrackingTimeout = 60000 |
| Timeout for tracking duplicate messages in milliseconds. | |
| uint16_t | maxTrackedMessages = 500 |
| Maximum number of messages to track for deduplication. | |
| uint32_t | gatewayHeartbeatInterval = 15000 |
| Interval for broadcasting gateway heartbeat in milliseconds. | |
| uint32_t | gatewayFailureTimeout = 45000 |
| Timeout for detecting gateway failure in milliseconds. | |
| bool | participateInElection = true |
| Whether this node should participate in gateway elections. | |
| uint8_t | relayedMessagePriority = 0 |
| Priority for relayed messages (0 = highest/CRITICAL) | |
| bool | maintainPermanentConnection = true |
| Whether to maintain a permanent connection to the router. | |
Configuration structure for Shared Gateway Mode.
This structure holds all configuration parameters needed for a node to operate as a shared gateway, providing Internet connectivity to the mesh network.
When enabled and configured with valid router credentials, a node can:
Example usage:
|
inline |
Check if this node can participate in gateway elections.
A node can participate if:
|
inline |
Check if the configuration has valid router credentials.
|
inline |
Validate the configuration.
Performs comprehensive validation of all configuration fields. Returns a ValidationResult with detailed error information.
| uint32_t painlessmesh::gateway::SharedGatewayConfig::duplicateTrackingTimeout = 60000 |
Timeout for tracking duplicate messages in milliseconds.
How long to remember message IDs to prevent duplicate processing. Default: 60000ms (60 seconds)
| bool painlessmesh::gateway::SharedGatewayConfig::enabled = false |
Enable or disable shared gateway functionality.
When false, this node will not attempt to act as a gateway.
| uint32_t painlessmesh::gateway::SharedGatewayConfig::gatewayFailureTimeout = 45000 |
Timeout for detecting gateway failure in milliseconds.
If no heartbeat is received within this period, the gateway is considered failed and election may begin. Should be at least 2x gatewayHeartbeatInterval. Default: 45000ms (45 seconds)
| uint32_t painlessmesh::gateway::SharedGatewayConfig::gatewayHeartbeatInterval = 15000 |
Interval for broadcasting gateway heartbeat in milliseconds.
How often the gateway broadcasts its status to the mesh. Other nodes use this to detect gateway health. Default: 15000ms (15 seconds)
| TSTRING painlessmesh::gateway::SharedGatewayConfig::internetCheckHost = "8.8.8.8" |
Host to ping for Internet connectivity verification.
A reliable external host used to verify Internet connectivity. Default: "8.8.8.8" (Google Public DNS)
| uint32_t painlessmesh::gateway::SharedGatewayConfig::internetCheckInterval = 30000 |
Interval between Internet connectivity checks in milliseconds.
How often the gateway should verify it can reach the Internet. Lower values provide faster failure detection but increase network usage. Default: 30000ms (30 seconds)
| uint16_t painlessmesh::gateway::SharedGatewayConfig::internetCheckPort = 53 |
Port for Internet connectivity check.
The port to use when checking connectivity to internetCheckHost. Default: 53 (DNS port)
| uint32_t painlessmesh::gateway::SharedGatewayConfig::internetCheckTimeout = 5000 |
Timeout for Internet connectivity check in milliseconds.
Maximum time to wait for a response from the Internet check host. Default: 5000ms (5 seconds)
| bool painlessmesh::gateway::SharedGatewayConfig::maintainPermanentConnection = true |
Whether to maintain a permanent connection to the router.
When true, the gateway maintains a continuous connection to the router. When false, the gateway may disconnect when idle to save power. Default: true
| uint16_t painlessmesh::gateway::SharedGatewayConfig::maxTrackedMessages = 500 |
Maximum number of messages to track for deduplication.
The maximum number of message IDs to store for duplicate detection. Older entries are removed when this limit is reached. Default: 500
| uint8_t painlessmesh::gateway::SharedGatewayConfig::messageRetryCount = 3 |
Number of retry attempts for message delivery.
How many times to retry sending a message before considering it failed. Default: 3
| bool painlessmesh::gateway::SharedGatewayConfig::participateInElection = true |
Whether this node should participate in gateway elections.
When true, this node may become a gateway if the current gateway fails. Requires routerSSID and routerPassword to be set. Default: true
| uint8_t painlessmesh::gateway::SharedGatewayConfig::relayedMessagePriority = 0 |
Priority for relayed messages (0 = highest/CRITICAL)
The priority level assigned to messages being relayed through the gateway. Lower values = higher priority. Default: 0 (CRITICAL priority)
| uint32_t painlessmesh::gateway::SharedGatewayConfig::retryInterval = 1000 |
Interval between retry attempts in milliseconds.
Base delay between message retry attempts. Actual delay may use exponential backoff. Default: 1000ms (1 second)
| TSTRING painlessmesh::gateway::SharedGatewayConfig::routerPassword = "" |
Router password for authentication.
The password for the external WiFi router. May be empty for open networks (not recommended).
| TSTRING painlessmesh::gateway::SharedGatewayConfig::routerSSID = "" |
Router SSID to connect for Internet access.
The SSID of the external WiFi router that provides Internet connectivity. Required when enabled is true.