hvl_ccb.utils.poller
- class Poller(spoll_handler: Callable, polling_delay_sec: int | float = 0, polling_interval_sec: int | float = 1, polling_timeout_sec: int | float | None = None)[source]
Bases:
object
Poller class wrapping concurrent.futures.ThreadPoolExecutor which enables passing of results and errors out of the polling thread.
- is_polling() bool [source]
Check if device status is being polled.
- Returns:
True when polling thread is set and alive
- start_polling() bool [source]
Start polling.
- Returns:
True if was not polling before, False otherwise
- stop_polling() bool [source]
Stop polling.
Wait for until polling function returns a result as well as any exception / error that might have been raised within a thread.
- Returns:
True if was polling before, False otherwise, and last result of the polling function call.
- Raises:
polling function exceptions