AlteriomPainlessMesh v2.1.1
Easy ESP32/ESP8266 mesh networking with Alteriom IoT extensions
Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | List of all members
painlessmesh::gateway::SharedGatewayConfig Struct Reference

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.
 

Detailed Description

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:

config.enabled = true;
config.routerSSID = "MyHomeWiFi";
config.routerPassword = "secretpassword";
auto result = config.validate();
if (!result.valid) {
Serial.println(result.errorMessage.c_str());
}
Configuration structure for Shared Gateway Mode.
Definition gateway.hpp:162
TSTRING routerSSID
Router SSID to connect for Internet access.
Definition gateway.hpp:180
bool enabled
Enable or disable shared gateway functionality.
Definition gateway.hpp:172
ValidationResult validate() const
Validate the configuration.
Definition gateway.hpp:331
TSTRING routerPassword
Router password for authentication.
Definition gateway.hpp:188

Member Function Documentation

◆ canParticipateInElection()

bool painlessmesh::gateway::SharedGatewayConfig::canParticipateInElection ( ) const
inline

Check if this node can participate in gateway elections.

A node can participate if:

  • participateInElection is true
  • routerSSID is configured
Returns
true if eligible to become a gateway

◆ hasRouterCredentials()

bool painlessmesh::gateway::SharedGatewayConfig::hasRouterCredentials ( ) const
inline

Check if the configuration has valid router credentials.

Returns
true if router SSID is set

◆ validate()

ValidationResult painlessmesh::gateway::SharedGatewayConfig::validate ( ) const
inline

Validate the configuration.

Performs comprehensive validation of all configuration fields. Returns a ValidationResult with detailed error information.

Returns
ValidationResult indicating validity and any error messages

Member Data Documentation

◆ duplicateTrackingTimeout

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)

◆ enabled

bool painlessmesh::gateway::SharedGatewayConfig::enabled = false

Enable or disable shared gateway functionality.

When false, this node will not attempt to act as a gateway.

◆ gatewayFailureTimeout

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)

◆ gatewayHeartbeatInterval

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)

◆ internetCheckHost

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)

◆ internetCheckInterval

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)

◆ internetCheckPort

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)

◆ internetCheckTimeout

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)

◆ maintainPermanentConnection

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

◆ maxTrackedMessages

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

◆ messageRetryCount

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

◆ participateInElection

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

◆ relayedMessagePriority

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)

◆ retryInterval

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)

◆ routerPassword

TSTRING painlessmesh::gateway::SharedGatewayConfig::routerPassword = ""

Router password for authentication.

The password for the external WiFi router. May be empty for open networks (not recommended).

◆ routerSSID

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.


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