|
Elma
An event loop manager for embedded systems
|
A class the models the power component of a microwave oven. See examples/microwave.cc. More...
Inheritance diagram for microwave_example::Power:
Collaboration diagram for microwave_example::Power:Public Member Functions | |
| Power () | |
| Create a new power component. | |
| void | init () |
| void | start () |
| Set running to false and power_level to zero. | |
| void | update () |
| Nothing to do to update. | |
| void | stop () |
| Nothing to do to stop. | |
Public Member Functions inherited from elma::Process | |
| Process (int n=0) | |
| Default constructor. Names process "no name". | |
| Process (std::string name, int n=0) | |
| Constructor that takes a name for the process. More... | |
| string | name () |
| void | set_name (std::string str) |
| status_type | status () |
| high_resolution_clock::duration | period () |
| int | num_updates () |
| time_point< high_resolution_clock > | start_time () |
| high_resolution_clock::duration | last_update () |
| high_resolution_clock::duration | previous_update () |
| Channel & | channel (string name) |
| Access a channel with the given name. More... | |
| double | milli_time () |
| The time since the last update in millisconds, as a double. More... | |
| double | delta () |
| The most recent amount of time between updates. More... | |
| void | watch (string event_name, std::function< void(Event &)> handler) |
| void | emit (const Event &event) |
| void | http_get (std::string url, std::function< void(json &)> handler) |
| void | halt () |
| void | set_manager (Manager *m_ptr) |
Public Attributes | |
| bool | running |
| Keep track of whether the power is on. | |
| double | power_level |
| Keep track of the power level. | |
Additional Inherited Members | |
Public Types inherited from elma::Process | |
| enum | status_type { UNINITIALIZED, STOPPED, RUNNING } |
Protected Attributes inherited from elma::Process | |
| Manager * | _manager_ptr |
A class the models the power component of a microwave oven. See examples/microwave.cc.
Definition at line 14 of file microwave.cc.
|
inlinevirtual |
Set up watches for three events: "on", "off", and "set power". The "set power" watcher expects events whose values are numerical.
Implements elma::Process.
Definition at line 23 of file microwave.cc.