|
SensESP 3.6.1-alpha
Universal Signal K sensor toolkit ESP32
|
A class for quickly configuring a SensESP application object before wiring up your sensors. More...
#include <sensesp_app_builder.h>
Public Member Functions | |
| SensESPAppBuilder () | |
| Construct a new SensESPApp Builder object. | |
| SensESPAppBuilder * | set_wifi_client (String ssid, String password) |
| Set the Wi-Fi network SSID and password. | |
| SensESPAppBuilder * | set_wifi (String ssid, String password) |
| SensESPAppBuilder * | set_wifi_clients (const std::vector< ClientSSIDConfig > &wifi_client_configs) |
| Set multiple Wi-Fi client (STA) networks for failover. | |
| SensESPAppBuilder * | set_wifi_access_point (const String &ssid, const String &password) |
| Set the wifi access point object SSID and password. | |
| SensESPAppBuilder * | disable_wifi () |
| Clear the default WiFi STA/AP settings. | |
| template<typename ProvisionerConfigT > | |
| SensESPAppBuilder * | set_ethernet (ProvisionerConfigT config) |
| Configure the app to use a non-WiFi NetworkProvisioner. | |
| SensESPAppBuilder * | set_sk_server (String address, uint16_t port) |
| Set the Signal K server address and port. | |
| SensESPAppBuilder * | set_hostname (String hostname) override final |
| Set the device hostname. | |
| SensESPAppBuilder * | set_admin_user (const char *username, const char *password) |
| Set admin username and password for the web interface. | |
| SensESPAppBuilder * | set_system_status_led (std::shared_ptr< SystemStatusLed > system_status_led) |
| Set the system status led object. | |
| SensESPAppBuilder * | enable_system_hz_sensor (String prefix=kDefaultSystemInfoSensorPrefix) |
| Enable the System Hz sensor. | |
| SensESPAppBuilder * | enable_free_mem_sensor (String prefix=kDefaultSystemInfoSensorPrefix) |
| Enable the free memory sensor. | |
| SensESPAppBuilder * | enable_uptime_sensor (String prefix=kDefaultSystemInfoSensorPrefix) |
| Report the system uptime in seconds since the last reboot. | |
| SensESPAppBuilder * | enable_ip_address_sensor (String prefix=kDefaultSystemInfoSensorPrefix) |
| Report the IP address of the device. | |
| SensESPAppBuilder * | enable_wifi_signal_sensor (String prefix=kDefaultSystemInfoSensorPrefix) |
| Report the Wi-Fi signal strength. | |
| SensESPAppBuilder * | set_button_pin (int pin) |
| Set the button GPIO pin. | |
| SensESPAppBuilder * | enable_system_info_sensors (String prefix=kDefaultSystemInfoSensorPrefix) |
| Enable all built-in system info sensors. | |
| SensESPAppBuilder * | enable_ota (const char *password) |
| Enable over-the-air updates for the device. | |
| SensESPAppBuilder * | set_wifi_manager_password (const char *password) |
| Set the wifi manager password. | |
| SensESPAppBuilder * | enable_wifi_watchdog (int timeout_s=180) |
| Restart the device after a prolonged network outage. | |
| std::shared_ptr< SensESPApp > | get_app () |
| Get the SensESPApp object. | |
Protected Attributes | |
| std::shared_ptr< SensESPApp > | app_ |
Protected Attributes inherited from sensesp::SensESPBaseAppBuilder | |
| String | hostname_ = "SensESP" |
A class for quickly configuring a SensESP application object before wiring up your sensors.
Definition at line 22 of file sensesp_app_builder.h.
|
inline |
Construct a new SensESPApp Builder object.
SensESPAppBuilder is used to instantiate a SensESPApp object with non-trivial configuration.
Definition at line 40 of file sensesp_app_builder.h.
|
inline |
Clear the default WiFi STA/AP settings.
Intended for use by non-WiFi provisioners (Ethernet, future PPP/cellular, …) that supply a factory via SensESPApp::set_network_provisioner_factory(). Without this call, the default WiFi-construction path in SensESPApp::setup() would still produce a WiFiProvisioner alongside the non-WiFi one.
set_ethernet() calls this implicitly, so most users do not have to invoke disable_wifi() directly.
Definition at line 116 of file sensesp_app_builder.h.
|
inline |
Enable the free memory sensor.
| prefix |
Definition at line 235 of file sensesp_app_builder.h.
|
inline |
Report the IP address of the device.
| prefix |
Definition at line 267 of file sensesp_app_builder.h.
|
inline |
Enable over-the-air updates for the device.
| password | OTA authentication password. |
Definition at line 326 of file sensesp_app_builder.h.
|
inline |
Enable the System Hz sensor.
The System Hz sensor is a built-in sensor that measures how many times the system loop is executed per second.
| prefix |
Definition at line 219 of file sensesp_app_builder.h.
|
inline |
Enable all built-in system info sensors.
| prefix |
Definition at line 310 of file sensesp_app_builder.h.
|
inline |
Report the system uptime in seconds since the last reboot.
| prefix |
Definition at line 251 of file sensesp_app_builder.h.
|
inline |
Report the Wi-Fi signal strength.
| prefix |
Definition at line 283 of file sensesp_app_builder.h.
|
inline |
Restart the device after a prolonged network outage.
The watchdog arms on the first station or Ethernet connection after boot, so a device that starts without a reachable access point keeps running. The soft-AP and the captive portal neither arm it nor count as an outage. Once armed, a continuous outage of at least timeout_s restarts the device. The timeout is exposed on the web UI Configuration page as the "WiFi Watchdog" card; a value saved there takes precedence over timeout_s on later boots. Call this before get_app().
Pick a timeout that outlasts an access point reboot; a too-short value costs an unnecessary restart during every AP outage.
| timeout_s | Initial outage duration in seconds before restarting, between 1 and WiFiWatchdog::kMaxTimeoutS. |
Definition at line 364 of file sensesp_app_builder.h.
|
inline |
Get the SensESPApp object.
Return a SensESPApp object that has been setup.
Definition at line 389 of file sensesp_app_builder.h.
|
inline |
Set admin username and password for the web interface.
Definition at line 191 of file sensesp_app_builder.h.
|
inline |
Set the button GPIO pin.
Definition at line 299 of file sensesp_app_builder.h.
|
inline |
Configure the app to use a non-WiFi NetworkProvisioner.
Today only Ethernet on ESP32-P4 is supported. Use as:
#include "sensesp/net/ethernet_provisioner.h"
...
builder.set_ethernet(EthernetConfig::waveshare_esp32p4_poe())
->get_app();
| ProvisionerConfigT | a configuration struct that exposes a nested using ProvisionerType = …; typedef pointing at the concrete NetworkProvisioner implementation. EthernetConfig from sensesp/net/ethernet_provisioner.h is the only such type today. Templated so this header does not need to pull in any provisioner implementation files — users who call set_ethernet() must include the relevant provisioner header in their own translation unit. |
Calling set_ethernet() on a target whose provisioner header is empty (e.g. classic ESP32, where EthernetConfig is not declared) produces a clean compile error at the use site rather than a silent runtime failure. Implicitly calls disable_wifi() so the WiFi-specific HTTP handlers and soft-AP fall-back are not registered.
Definition at line 151 of file sensesp_app_builder.h.
|
inlinefinaloverridevirtual |
Set the device hostname.
If not set, the device hostname is set to "SensESP".
| hostname |
Implements sensesp::SensESPBaseAppBuilder.
Definition at line 183 of file sensesp_app_builder.h.
|
inline |
Set the Signal K server address and port.
If not set, mDNS is used to discover the Signal K server.
| address | |
| port |
Definition at line 170 of file sensesp_app_builder.h.
|
inline |
Set the system status led object.
This allows custom status LED patterns to be used.
| system_status_led |
Definition at line 205 of file sensesp_app_builder.h.
|
inline |
|
inline |
Set the wifi access point object SSID and password.
To disable the SSID, set both to empty strings.
| ssid | |
| password |
Definition at line 97 of file sensesp_app_builder.h.
|
inline |
Set the Wi-Fi network SSID and password.
If not set, WiFiManager is used to create an access point for configuring the settings.
| ssid | |
| password |
Definition at line 54 of file sensesp_app_builder.h.
|
inline |
Set multiple Wi-Fi client (STA) networks for failover.
The device tries the networks in order, failing over to the next when one is unreachable (up to WiFiProvisioner::kMaxNumClientConfigs entries; extras are dropped, and entries with an empty SSID or password are ignored). This is the in-code equivalent of the multi-network list the web UI manages.
Like set_wifi_client(), these values only seed a device with no saved WiFi configuration; a configuration saved via the web UI always wins. Use this instead of set_wifi_client() when you need more than one network defined in code.
| wifi_client_configs | ordered list of client networks |
Definition at line 82 of file sensesp_app_builder.h.
|
inline |
Set the wifi manager password.
Set the password for the WiFi configuration access point that is enabled after device reset if no wifi configuration is provided in the application code.
| password |
Definition at line 342 of file sensesp_app_builder.h.
|
protected |
Definition at line 31 of file sensesp_app_builder.h.