Lamp-Da 0.1
A compact lantern project
Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | List of all members
lampda::logic::alerts::AlertBase Struct Referenceabstract

Base class for all alerts. Must be overloaded to define an alert. More...

Inheritance diagram for lampda::logic::alerts::AlertBase:
lampda::logic::alerts::Alert_BatteryCritical lampda::logic::alerts::Alert_BatteryLow lampda::logic::alerts::Alert_BatteryMissing lampda::logic::alerts::Alert_BatteryReadingIncoherent lampda::logic::alerts::Alert_BluetoothAdvertisement lampda::logic::alerts::Alert_ChargerError lampda::logic::alerts::Alert_FavoriteSet lampda::logic::alerts::Alert_HardwareAlert lampda::logic::alerts::Alert_LongLoopUpdate lampda::logic::alerts::Alert_MainLoopFreeze lampda::logic::alerts::Alert_OtgFailed lampda::logic::alerts::Alert_SkippedCleanSleep lampda::logic::alerts::Alert_SunsetTimerSet lampda::logic::alerts::Alert_SystemInErrorState lampda::logic::alerts::Alert_SystemInLockout lampda::logic::alerts::Alert_SystemShutdownFailed lampda::logic::alerts::Alert_TempCritical lampda::logic::alerts::Alert_TempTooHigh lampda::logic::alerts::Alert_UsbPortShort

Public Member Functions

virtual ~AlertBase ()=default
 virtual destructor for a pure virtual class
 
virtual uint32_t alert_shutdown_timeout () const
 Return the timeout after which an alert will make the system auto-shutdown.
 
virtual void execute () const
 function executed when this alert is raised
 
virtual bool should_be_raised () const
 return true if this alert type should be raised
 
virtual bool should_be_cleared () const
 return true if this alert type should be cleared
 
virtual bool show () const
 display this alert on the indicator
 
virtual Type get_type () const =0
 return the Defined type of this alert
 
virtual bool should_shutdown_system (const uint32_t time) final
 Return true if the system should shutdown from this alert.
 
virtual bool handle_raised_state (const uint32_t time)
 Handler for the raised state of the alert. If the alert is not raised, raise the alert.
 
void update_raise_time (const uint32_t time)
 Update the raised time of this alert. An alert continuously firing as to be updated.
 
virtual bool handle_lowered_state (const uint32_t time)
 Handler for the lowered state of the alert. If the alert is raised, lower the alert.
 
virtual bool should_prevent_lamp_output () const
 override to prevent lamp output power if this alert if raised. Default to False
 
virtual bool should_prevent_battery_charge () const
 override to prevent battery charge if this alert if raised. Default to False
 
virtual bool should_prevent_usb_port_use () const
 override to prevent USB port usage if this alert if raised. Default to False
 

Public Attributes

bool _isRaisedHandled = false
 Alert raise signal has been handled.
 
bool _isLoweredHandled = false
 Alert lower signal has been handled.
 
uint32_t raisedTime = 0
 Store the latest time at which this alert raise() was called.
 
uint32_t loweredTime = 0
 Store the latest time at which this alert lower() was called.
 

Detailed Description

Base class for all alerts. Must be overloaded to define an alert.

Member Function Documentation

◆ alert_shutdown_timeout()

virtual uint32_t lampda::logic::alerts::AlertBase::alert_shutdown_timeout ( ) const
inlinevirtual

Return the timeout after which an alert will make the system auto-shutdown.

Reimplemented in lampda::logic::alerts::Alert_BatteryCritical, and lampda::logic::alerts::Alert_TempCritical.

◆ execute()

virtual void lampda::logic::alerts::AlertBase::execute ( ) const
inlinevirtual

function executed when this alert is raised

Reimplemented in lampda::logic::alerts::Alert_BatteryLow, and lampda::logic::alerts::Alert_TempTooHigh.

◆ get_type()

virtual Type lampda::logic::alerts::AlertBase::get_type ( ) const
pure virtual

◆ handle_lowered_state()

virtual bool lampda::logic::alerts::AlertBase::handle_lowered_state ( const uint32_t  time)
inlinevirtual

Handler for the lowered state of the alert. If the alert is raised, lower the alert.

Returns
True if the alert was lowered by this function call

◆ handle_raised_state()

virtual bool lampda::logic::alerts::AlertBase::handle_raised_state ( const uint32_t  time)
inlinevirtual

Handler for the raised state of the alert. If the alert is not raised, raise the alert.

Returns
True if the alert was raised by this function call

◆ should_be_cleared()

virtual bool lampda::logic::alerts::AlertBase::should_be_cleared ( ) const
inlinevirtual

◆ should_be_raised()

virtual bool lampda::logic::alerts::AlertBase::should_be_raised ( ) const
inlinevirtual

◆ should_prevent_battery_charge()

virtual bool lampda::logic::alerts::AlertBase::should_prevent_battery_charge ( ) const
inlinevirtual

◆ should_prevent_lamp_output()

virtual bool lampda::logic::alerts::AlertBase::should_prevent_lamp_output ( ) const
inlinevirtual

◆ should_prevent_usb_port_use()

virtual bool lampda::logic::alerts::AlertBase::should_prevent_usb_port_use ( ) const
inlinevirtual

◆ show()

virtual bool lampda::logic::alerts::AlertBase::show ( ) const
inlinevirtual

The documentation for this struct was generated from the following file: