|
Lamp-Da 0.1
A compact lantern project
|
Handle the whole alerts logic. Use this to raise and clear alerts, and make decisions based on those alerts. Alerts can be raised and cleared on their own. More...
#include <alerts.h>
Public Member Functions | |
| void | raise (const Type type) |
| Raise an alert. | |
| void | clear (const Type type) |
| Clear an alert. | |
| bool | clear_unless_refreshed (const Type type, const std::atomic< uint32_t > &refreshCount, const uint32_t refreshCountAtDecision) |
| Clear an alert, unless it was refreshed by a raise() since the clear decision was taken. | |
| bool | is_raised (const Type type) const |
| Return true if the target alert is raised. | |
| bool | is_clear () const |
| Return true if no alerts are raised. | |
| uint32_t | get_time_since_raised (const Type type) const |
| the time in milliseconds since this alert was raised, or zero if it's not. This raise time is updated by a raise() function call. | |
| bool | can_use_output_power () const |
| Return true if a raised alert prevents power set to output. | |
| bool | can_charge_battery () const |
| Return true if a raised alert prevents battery charging. | |
| bool | can_use_usb_port () const |
| Return true if no raised alerts block the use of power through USB port. | |
| AlertManager_t (const AlertManager_t &)=delete | |
| AlertManager_t & | operator= (AlertManager_t const &)=delete |
Handle the whole alerts logic. Use this to raise and clear alerts, and make decisions based on those alerts. Alerts can be raised and cleared on their own.
| bool lampda::logic::alerts::AlertManager_t::clear_unless_refreshed | ( | const Type | type, |
| const std::atomic< uint32_t > & | refreshCount, | ||
| const uint32_t | refreshCountAtDecision | ||
| ) |
Clear an alert, unless it was refreshed by a raise() since the clear decision was taken.
| [in] | type | The alert to clear |
| [in] | refreshCount | The refresh counter of this alert, incremented by every raise() of a raised alert |
| [in] | refreshCountAtDecision | Value of refreshCount read before deciding to clear the alert |