ESPHome  2024.12.2
Data Structures | Public Member Functions | Protected Member Functions | Protected Attributes
esphome::Scheduler Class Reference

#include <scheduler.h>

Data Structures

struct  SchedulerItem
 

Public Member Functions

void set_timeout (Component *component, const std::string &name, uint32_t timeout, std::function< void()> func)
 
bool cancel_timeout (Component *component, const std::string &name)
 
void set_interval (Component *component, const std::string &name, uint32_t interval, std::function< void()> func)
 
bool cancel_interval (Component *component, const std::string &name)
 
void set_retry (Component *component, const std::string &name, uint32_t initial_wait_time, uint8_t max_attempts, std::function< RetryResult(uint8_t)> func, float backoff_increase_factor=1.0f)
 
bool cancel_retry (Component *component, const std::string &name)
 
optional< uint32_t > next_schedule_in ()
 
void call ()
 
void process_to_add ()
 

Protected Member Functions

uint32_t millis_ ()
 
void cleanup_ ()
 
void pop_raw_ ()
 
void push_ (std::unique_ptr< SchedulerItem > item)
 
bool cancel_item_ (Component *component, const std::string &name, SchedulerItem::Type type)
 
bool empty_ ()
 

Protected Attributes

Mutex lock_
 
std::vector< std::unique_ptr< SchedulerItem > > items_
 
std::vector< std::unique_ptr< SchedulerItem > > to_add_
 
uint32_t last_millis_ {0}
 
uint8_t millis_major_ {0}
 
uint32_t to_remove_ {0}
 

Detailed Description

Definition at line 13 of file scheduler.h.

Member Function Documentation

◆ call()

void HOT esphome::Scheduler::call ( )

Definition at line 147 of file scheduler.cpp.

◆ cancel_interval()

bool HOT esphome::Scheduler::cancel_interval ( Component component,
const std::string &  name 
)

Definition at line 78 of file scheduler.cpp.

◆ cancel_item_()

bool HOT esphome::Scheduler::cancel_item_ ( Component component,
const std::string &  name,
SchedulerItem::Type  type 
)
protected

Definition at line 305 of file scheduler.cpp.

◆ cancel_retry()

bool HOT esphome::Scheduler::cancel_retry ( Component component,
const std::string &  name 
)

Definition at line 133 of file scheduler.cpp.

◆ cancel_timeout()

bool HOT esphome::Scheduler::cancel_timeout ( Component component,
const std::string &  name 
)

Definition at line 45 of file scheduler.cpp.

◆ cleanup_()

void HOT esphome::Scheduler::cleanup_ ( )
protected

Definition at line 283 of file scheduler.cpp.

◆ empty_()

bool esphome::Scheduler::empty_ ( )
inlineprotected

Definition at line 71 of file scheduler.h.

◆ millis_()

uint32_t esphome::Scheduler::millis_ ( )
protected

Definition at line 325 of file scheduler.cpp.

◆ next_schedule_in()

optional< uint32_t > HOT esphome::Scheduler::next_schedule_in ( )

Definition at line 137 of file scheduler.cpp.

◆ pop_raw_()

void HOT esphome::Scheduler::pop_raw_ ( )
protected

Definition at line 297 of file scheduler.cpp.

◆ process_to_add()

void HOT esphome::Scheduler::process_to_add ( )

Definition at line 271 of file scheduler.cpp.

◆ push_()

void HOT esphome::Scheduler::push_ ( std::unique_ptr< SchedulerItem item)
protected

Definition at line 301 of file scheduler.cpp.

◆ set_interval()

void HOT esphome::Scheduler::set_interval ( Component component,
const std::string &  name,
uint32_t  interval,
std::function< void()>  func 
)

Definition at line 48 of file scheduler.cpp.

◆ set_retry()

void HOT esphome::Scheduler::set_retry ( Component component,
const std::string &  name,
uint32_t  initial_wait_time,
uint8_t  max_attempts,
std::function< RetryResult(uint8_t)>  func,
float  backoff_increase_factor = 1.0f 
)

Definition at line 102 of file scheduler.cpp.

◆ set_timeout()

void HOT esphome::Scheduler::set_timeout ( Component component,
const std::string &  name,
uint32_t  timeout,
std::function< void()>  func 
)

Definition at line 22 of file scheduler.cpp.

Field Documentation

◆ items_

std::vector<std::unique_ptr<SchedulerItem> > esphome::Scheduler::items_
protected

Definition at line 77 of file scheduler.h.

◆ last_millis_

uint32_t esphome::Scheduler::last_millis_ {0}
protected

Definition at line 79 of file scheduler.h.

◆ lock_

Mutex esphome::Scheduler::lock_
protected

Definition at line 76 of file scheduler.h.

◆ millis_major_

uint8_t esphome::Scheduler::millis_major_ {0}
protected

Definition at line 80 of file scheduler.h.

◆ to_add_

std::vector<std::unique_ptr<SchedulerItem> > esphome::Scheduler::to_add_
protected

Definition at line 78 of file scheduler.h.

◆ to_remove_

uint32_t esphome::Scheduler::to_remove_ {0}
protected

Definition at line 81 of file scheduler.h.


The documentation for this class was generated from the following files: