38 explicit Notifier(std::function<
void()> callback);
40 template <
typename Arg,
typename... Args>
41 Notifier(std::invocable<Arg, Args...>
auto&& callback, Arg&&
arg,
45 std::forward<Args>(args)...)) {}
61 explicit Notifier(
int priority, std::function<
void()> callback);
63 template <
typename Arg,
typename... Args>
64 Notifier(
int priority, std::invocable<Arg, Args...>
auto&& callback,
65 Arg&&
arg, Args&&... args)
66 :
Notifier(priority,
std::bind(
std::forward<decltype(callback)>(callback),
68 std::forward<Args>(args)...)) {}
91 [[deprecated(
"Use SetCallback() instead.")]]
153 void UpdateAlarm(uint64_t triggerTime);
161 std::thread m_thread;
167 std::atomic<HAL_NotifierHandle> m_notifier{0};
170 std::function<void()> m_callback;
174 units::second_t m_expirationTime = 0_s;
178 units::second_t m_period = 0_s;
181 bool m_periodic =
false;
Notifiers run a user-provided callback function on a separate thread.
Definition: Notifier.h:29
Notifier(std::invocable< Arg, Args... > auto &&callback, Arg &&arg, Args &&... args)
Definition: Notifier.h:41
Notifier(std::function< void()> callback)
Create a Notifier with the given callback.
void StartPeriodic(units::second_t period)
Run the callback periodically with the given period.
void SetName(std::string_view name)
Sets the name of the notifier.
void Stop()
Stop further callback invocations.
Notifier(int priority, std::function< void()> callback)
Create a Notifier with the given callback.
static bool SetHALThreadPriority(bool realTime, int32_t priority)
Sets the HAL notifier thread priority.
void StartSingle(units::second_t delay)
Run the callback once after the given delay.
void SetCallback(std::function< void()> callback)
Change the callback function.
Notifier(int priority, std::invocable< Arg, Args... > auto &&callback, Arg &&arg, Args &&... args)
Definition: Notifier.h:64
~Notifier()
Free the resources for a timer event.
Notifier & operator=(Notifier &&rhs)
void SetHandler(std::function< void()> callback)
Change the callback function.
basic_string_view< char > string_view
Definition: core.h:501
auto arg(const Char *name, const T &arg) -> detail::named_arg< Char, T >
\rst Returns a named argument to be used in a formatting function.
Definition: core.h:1841
Definition: AprilTagPoseEstimator.h:15
::std::mutex mutex
Definition: mutex.h:17