49 static std::shared_ptr<SensESPApp>
get() {
53 return std::static_pointer_cast<SensESPApp>(
instance_);
49 static std::shared_ptr<SensESPApp>
get() {
…}
57 bool outside_users =
instance_.use_count() > 2;
61 "SensESPApp instance has active references and won't be properly "
67 return !outside_users;
119 std::shared_ptr<SystemStatusLed>& system_status_led) {
124 this->
http_server_->set_auth_credentials(username, password,
true);
161 bool captive_portal_enabled =
networking_->is_captive_portal_enabled();
165 this->
http_server_->set_captive_portal(captive_portal_enabled);
180 this->
ws_client_ = std::make_shared<SKWSClient>(
187 this->
networking_->get_wifi_state_producer()->connect_to(
200#elif defined(LED_BUILTIN)
207 this->
ws_client_->get_delta_tx_count_producer().connect_to(
232 int event_loop_queue_size =
event_loop_->getEventQueueSize();
233 int event_loop_timed_queue_size =
event_loop_->getTimedEventQueueSize();
234 int event_loop_untimed_queue_size =
238 uint64_t current_tick_count =
event_loop_->getTickCount();
242 uint64_t current_event_count =
event_loop_->getEventCount();
243 uint64_t current_timed_event_count =
event_loop_->getTimedEventCount();
244 uint64_t current_untimed_event_count =
251 static uint64_t last_tick_count = 0;
252 static uint64_t last_event_count = 0;
253 static uint64_t last_timed_event_count = 0;
254 static uint64_t last_untimed_event_count = 0;
255 static uint64_t last_millis = 0;
256 uint64_t current_millis = millis();
257 float interval_seconds = (current_millis - last_millis) / 1000.0;
259 uint64_t ticks_diff = current_tick_count - last_tick_count;
260 uint64_t events_diff = current_event_count - last_event_count;
261 uint64_t timed_events_diff =
262 current_timed_event_count - last_timed_event_count;
263 uint64_t untimed_events_diff =
264 current_untimed_event_count - last_untimed_event_count;
276 int(timed_events_diff / interval_seconds));
278 int(untimed_events_diff / interval_seconds));
281 last_tick_count = current_tick_count;
282 last_event_count = current_event_count;
283 last_timed_event_count = current_timed_event_count;
284 last_untimed_event_count = current_untimed_event_count;
285 last_millis = current_millis;
291 ws_client_->get_delta_tx_count_producer().connect_to(
293 ws_client_->get_delta_rx_count_producer().connect_to(
310 std::make_shared<SystemStatusController>();
326 "MAC Address", WiFi.macAddress(),
"Network", 1300};
333 "",
"Signal K", 1600};
337 "",
"Signal K", 1800};
344 "Event Loop queue size", 0,
"Event Loop Queues", 2100};
346 "Event Loop timed queue size", 0,
"Event Loop Queues", 2200};
348 "Event Loop untimed queue size", 0,
"Event Loop Queues", 2300};
350 "Event Loop interrupt queue size", 0,
"Event Loop Queues", 2400};
353 "Total ticks processed", 0,
"Event Loop Lifetime", 2500};
355 "Event Loop Lifetime", 2600};
357 "Timed events processed", 0,
"Event Loop Lifetime", 2700};
359 "Untimed events processed", 0,
"Event Loop Lifetime", 2800};
361 "Ticks per second", 0,
"Event Loop Performance", 2900};
363 "Events per second", 0,
"Event Loop Performance", 3000};
365 "Timed events per second", 0,
"Event Loop Performance", 3100};
367 "Untimed events per second", 0,
"Event Loop Performance", 3200};
372 "Build date", __DATE__
" " __TIME__,
"Software", 3400};
void set(const T &value) override
A class for quickly configuring a SensESP application object before wiring up your sensors.
StatusPageItem< int > event_loop_interrupt_queue_ui_output_
const SensESPApp * set_sk_server_port(uint16_t sk_server_port)
StatusPageItem< String > sensesp_version_ui_output_
static std::shared_ptr< SensESPApp > get()
Get the singleton instance of the SensESPApp.
SensESPApp()
SensESPApp constructor.
void connect_status_page_items()
void operator=(const SensESPApp &)=delete
std::shared_ptr< SKDeltaQueue > sk_delta_queue_
const SensESPApp * set_hostname(String hostname)
StatusPageItem< uint64_t > timed_event_count_ui_output_
std::shared_ptr< HTTPServer > http_server_
StatusPageItem< String > wifi_ssid_ui_output_
const SensESPApp * set_sk_server_address(String sk_server_address)
StatusPageItem< float > ticks_per_second_ui_output_
StatusPageItem< int8_t > wifi_rssi_ui_output_
virtual bool destroy() override
Destroy the SensESPBaseApp instance.
void setup()
Perform initialization of SensESPApp once builder configuration is done.
std::shared_ptr< ValueProducer< String > > ip_address_sensor_
String sk_server_address_
StatusPageItem< uint64_t > untimed_event_count_ui_output_
std::shared_ptr< ValueProducer< float > > uptime_sensor_
StatusPageItem< String > hostname_ui_output_
const SensESPApp * set_wifi_password(String wifi_password)
StatusPageItem< uint16_t > sk_server_port_ui_output_
StatusPageItem< String > sk_server_address_ui_output_
StatusPageItem< int > event_loop_timed_queue_ui_output_
std::shared_ptr< ValueProducer< uint32_t > > free_mem_sensor_
StatusPageItem< String > mac_address_ui_output_
std::shared_ptr< SKWSClient > get_ws_client()
const char * ota_password_
String wifi_client_password_
StatusPageItem< uint64_t > total_tick_count_ui_output_
std::shared_ptr< BaseSystemStatusLed > system_status_led_
StatusPageItem< int > uptime_ui_output_
std::shared_ptr< ValueProducer< int > > wifi_signal_sensor_
StatusPageItem< int > delta_rx_count_ui_output_
StatusPageItem< int > event_loop_untimed_queue_ui_output_
StatusPageItem< int > free_memory_ui_output_
StatusPageItem< float > timed_events_per_second_ui_output_
StatusPageItem< int > event_loop_queue_size_ui_output_
const SensESPApp * enable_ota(const char *password)
const SensESPApp * set_ap_password(const String &password)
const SensESPApp * set_admin_user(const char *username, const char *password)
std::shared_ptr< Networking > & get_networking()
StatusPageItem< uint64_t > event_count_ui_output_
std::shared_ptr< SystemStatusController > get_system_status_controller()
std::shared_ptr< SKWSClient > ws_client_
StatusPageItem< String > build_info_ui_output_
StatusPageItem< float > untimed_events_per_second_ui_output_
const SensESPApp * set_system_status_led(std::shared_ptr< SystemStatusLed > &system_status_led)
StatusPageItem< String > sk_server_connection_ui_output_
std::shared_ptr< SystemStatusController > system_status_controller_
std::shared_ptr< ButtonHandler > button_handler_
std::shared_ptr< MDNSDiscovery > mdns_discovery_
const SensESPApp * set_ap_ssid(const String &ssid)
const SensESPApp * set_ssid(String ssid)
StatusPageItem< float > events_per_second_ui_output_
std::shared_ptr< OTA > ota_
SensESPApp(SensESPApp &other)=delete
std::shared_ptr< SKDeltaQueue > get_sk_delta()
std::shared_ptr< Networking > networking_
StatusPageItem< int > delta_tx_count_ui_output_
std::shared_ptr< ValueProducer< float > > system_hz_sensor_
const SensESPApp * set_button_pin(int pin)
The base class for SensESP applications.
static String get_hostname()
Get the current hostname.
static std::shared_ptr< SensESPBaseApp > instance_
std::shared_ptr< reactesp::EventLoop > event_loop_
const SensESPBaseApp * set_hostname(String hostname)
std::shared_ptr< PersistingObservableValue< String > > hostname_
virtual void setup()
Perform initialization of SensESPBaseApp once builder configuration is done.
Item that renders its own value on the web UI status page.
void add_static_file_handlers(std::shared_ptr< HTTPServer > server)
Provide handlers for static web content.
void add_config_handlers(std::shared_ptr< HTTPServer > &server)
Handle HTTP requests to /config.
const char *const kSensESPVersion
std::shared_ptr< SensESPApp > sensesp_app
void add_app_http_command_handlers(std::shared_ptr< HTTPServer > &server, std::shared_ptr< Networking > &networking)
void add_base_app_http_command_handlers(std::shared_ptr< HTTPServer > &server)
std::shared_ptr< ConfigItemT< T > > ConfigItem(std::shared_ptr< T >)
Register a ConfigItemT with the ConfigItemBase.