1#ifndef TIMER_BASED_DEBOUNCER_H
2#define TIMER_BASED_DEBOUNCER_H
6#include <condition_variable>
8#include "./debouncer.h"
31 std::unique_lock<std::mutex> mLock;
32 std::condition_variable mConditionVariable;
34 std::atomic_uint32_t mElapsedMs;
37 void tick(std::chrono::milliseconds duration,
bool passing);
38 void start(uint32_t threshold);
45 std::function<
void(
bool)> callback,
58 virtual void Freeze()
override;
60 virtual void Reset()
override;
Debouncing mechanism interface.
Definition: debouncer.h:24
Definition: timer_based_debouncer.h:26
virtual void Freeze() override
Freeze the debouncing mechanism.
Definition: timer_based_debouncer.cpp:114
virtual void ReportPassed() override
Report finally passed of the monitored event.
Definition: timer_based_debouncer.cpp:86
virtual void Reset() override
Reset the debouncing mechanism.
Definition: timer_based_debouncer.cpp:123
virtual void ReportPrepassed() override
Report pre-passed of the monitored event.
Definition: timer_based_debouncer.cpp:74
virtual void ReportPrefailed() override
Report pre-failed of the monitored event.
Definition: timer_based_debouncer.cpp:94
TimerBasedDebouncer(std::function< void(bool)> callback, TimeBased defaultValues)
Constructor.
Definition: timer_based_debouncer.cpp:10
virtual void ReportFailed() override
Report finally failed of the monitored event.
Definition: timer_based_debouncer.cpp:106
Time-based debouncing parameters.
Definition: timer_based_debouncer.h:16
uint32_t failedMs
Time threshold in milliseconds to report failure.
Definition: timer_based_debouncer.h:20
uint32_t passedMs
Time threshold in milliseconds to report passing.
Definition: timer_based_debouncer.h:18