SensESP 3.0.1
Universal Signal K sensor toolkit ESP32
Loading...
Searching...
No Matches
system_status_controller.h
Go to the documentation of this file.
1#ifndef _SYSTEM_STATUS_CONTROLLER_H_
2#define _SYSTEM_STATUS_CONTROLLER_H_
3
8
9namespace sensesp {
10
20
28class SystemStatusController : public ValueProducer<SystemStatus> {
29 public:
31
35
39
40 protected:
58
60 switch (new_value) {
62 if (current_state_ != SystemStatus::kWifiDisconnected &&
63 current_state_ != SystemStatus::kWifiNoAP &&
64 current_state_ != SystemStatus::kWifiManagerActivated) {
65 // Wifi disconnection states override the higher level protocol state
67 }
68 break;
71 break;
74 break;
77 break;
78 }
79 }
80
82 [this](const WiFiState& new_value) { this->set_wifi_state(new_value); }};
87
88 void update_state(const SystemStatus new_state) {
89 current_state_ = new_state;
90 this->emit(new_state);
91 }
92
93 private:
95};
96
97} // namespace sensesp
98
99#endif
Provides an easy way of calling a function based on the output of any ValueProducer.
Base class for a controller that can react to system status events.
void set_sk_ws_connection_state(const SKWSConnectionState &new_value)
LambdaConsumer< WiFiState > wifi_state_consumer_
LambdaConsumer< SKWSConnectionState > ws_connection_state_consumer_
void update_state(const SystemStatus new_state)
void set_wifi_state(const WiFiState &new_value)
ValueConsumer< SKWSConnectionState > & get_ws_connection_state_consumer()
ValueConsumer< WiFiState > & get_wifi_state_consumer()
A base class for piece of code (like a transform) that accepts data for input. ValueConsumers can acc...
A base class for any sensor or piece of code that outputs a value for consumption elsewhere.
void emit(const SystemStatus &new_value)