SensESP 2.7.2
Universal Signal K sensor toolkit ESP32
Loading...
Searching...
No Matches
sensesp_app.h
Go to the documentation of this file.
1#ifndef _sensesp_app_H_
2#define _sensesp_app_H_
3
4#ifdef LED_BUILTIN
5#define LED_PIN LED_BUILTIN
6#define ENABLE_LED true
7#else
8#define LED_PIN 0
9#define ENABLE_LED false
10#endif
11
17#include "sensesp/net/ota.h"
25#include "sensesp_base_app.h"
26
27namespace sensesp {
28
34class SensESPApp : public SensESPBaseApp {
35 public:
40
44 void operator=(const SensESPApp&) = delete;
45
49 static SensESPApp* get();
50
52
53 // getters for internal members
59 WSClient* get_ws_client() { return this->ws_client_; }
60
61 protected:
72
73 // setters for all constructor arguments
74
76 this->SensESPBaseApp::set_hostname(hostname);
77 return this;
78 }
80 this->ssid_ = ssid;
81 return this;
82 }
84 this->wifi_password_ = wifi_password;
85 return this;
86 }
88 this->sk_server_address_ = sk_server_address;
89 return this;
90 }
92 this->sk_server_port_ = sk_server_port;
93 return this;
94 }
96 this->system_status_led_ = system_status_led;
97 return this;
98 }
99 const SensESPApp* enable_ota(const char* password) {
101 return this;
102 }
103 const SensESPApp* set_button_pin(int pin) {
104 button_gpio_pin_ = pin;
105 return this;
106 }
109 return this;
110 }
111
112 void setup();
113
118 const char* ota_password_ = nullptr;
119 const char* wifi_manager_password_ = "thisisfine";
120
129
134
136 new UIOutput<String>("Built at", __DATE__ " " __TIME__, "Software", 2000);
138 "SenseESP version", kSensESPVersion, "Software", 1900);
140 new UIOutput<String>("Hostname", "", "Network", 500);
142 new UIOutput<String>("MAC Address", WiFi.macAddress(), "Network", 1100);
144 "SSID", [this]() { return WiFi.SSID(); }, "Network", 1200);
146 "WiFi signal strength", [this]() { return WiFi.RSSI(); }, "Network",
147 1300);
150 "Signal K server address",
151 [this]() { return ws_client_->get_server_address(); }, "Network",
152 1400);
155 "Signal K server port",
156 [this]() { return ws_client_->get_server_port(); }, "Network", 1500);
159 "SK connection status",
160 [this]() { return ws_client_->get_connection_status(); }, "Network",
161 1600);
162
163 friend class HTTPServer;
164 friend class SensESPAppBuilder;
165};
166
167extern SensESPApp* sensesp_app;
168
169} // namespace sensesp
170
171#endif
Default Button Handler for SensESPApp applications.
Definition button.h:23
Initialize logging/debug output.
Handles external interactions with the device via the web interface.
Definition http_server.h:17
Construct a new transform based on a single function.
Manages the ESP's connection to the Wifi network.
Definition networking.h:105
Signal K delta queue.
A class for quickly configuring a SensESP application object before wiring up your sensors.
const SensESPApp * set_sk_server_port(uint16_t sk_server_port)
Definition sensesp_app.h:91
SensESPApp()
SensESPApp constructor.
Definition sensesp_app.h:69
static SensESPApp * get()
Get the singleton instance of the SensESPApp.
void operator=(const SensESPApp &)=delete
const SensESPApp * set_hostname(String hostname)
Definition sensesp_app.h:75
WSClient * ws_client_
SKDeltaQueue * sk_delta_queue_
const SensESPApp * set_sk_server_address(String sk_server_address)
Definition sensesp_app.h:87
const SensESPApp * set_system_status_led(SystemStatusLed *system_status_led)
Definition sensesp_app.h:95
UILambdaOutput< String > * wifi_ssid_ui_output_
void setup()
Perform initialization of SensESPApp once builder configuration is done.
const SensESPApp * set_wifi_manager_password(const char *password)
DebugOutput * debug_output_
SystemStatusController * get_system_status_controller()
Definition sensesp_app.h:55
UILambdaOutput< uint16_t > * sk_server_port_ui_output_
UILambdaOutput< String > * sk_server_connection_ui_output_
const SensESPApp * set_wifi_password(String wifi_password)
Definition sensesp_app.h:83
UILambdaOutput< String > * sk_server_address_ui_output_
Filesystem * filesystem_
HTTPServer * http_server_
const char * ota_password_
UIOutput< String > * sensesp_version_ui_output_
UILambdaOutput< int8_t > * wifi_rssi_ui_output_
SystemStatusLed * system_status_led_
UIOutput< String > * mac_address_ui_output_
SystemStatusController system_status_controller_
ObservableValue< String > * get_hostname_observable()
UIOutput< String > * build_info_ui_output_
const SensESPApp * enable_ota(const char *password)
Definition sensesp_app.h:99
Networking * get_networking()
Definition sensesp_app.h:58
ButtonHandler * button_handler_
const char * wifi_manager_password_
SKDeltaQueue * get_sk_delta()
Definition sensesp_app.h:54
MDNSDiscovery * mdns_discovery_
Networking * networking_
const SensESPApp * set_ssid(String ssid)
Definition sensesp_app.h:79
WSClient * get_ws_client()
Definition sensesp_app.h:59
SensESPApp(SensESPApp &other)=delete
UIOutput< String > * hostname_ui_output_
const SensESPApp * set_button_pin(int pin)
The base class for SensESP applications.
ObservableValue< String > * hostname_
const SensESPBaseApp * set_hostname(String hostname)
Base class for a controller that can react to system status events.
Consumes the networking and websocket states and delta counts and updates the device LED accordingly....
void connect_to(ValueConsumer< T > *consumer, uint8_t input_channel=0)
The websocket connection to the Signal K server.
Definition ws_client.h:33
String get_connection_status()
Get a String representation of the current connection state.
const String get_server_address() const
Definition ws_client.h:42
const uint16_t get_server_port() const
Definition ws_client.h:43
const char *const kSensESPVersion
SensESPApp * sensesp_app
#define SENSESP_BUTTON_PIN