17 #include <hal/Types.h>
18 #include <units/units.h>
19 #include <wpi/Twine.h>
20 #include <wpi/deprecated.h>
21 #include <wpi/mutex.h>
23 #include "frc/ErrorBase.h"
35 explicit Notifier(std::function<
void()> handler);
37 template <
typename Callable,
typename Arg,
typename... Args>
38 Notifier(Callable&& f, Arg&& arg, Args&&... args)
39 :
Notifier(std::bind(std::forward<Callable>(f), std::forward<Arg>(arg),
40 std::forward<Args>(args)...)) {}
62 void SetHandler(std::function<
void()> handler);
71 WPI_DEPRECATED(
"Use unit-safe StartSingle method instead.")
93 WPI_DEPRECATED(
"Use unit-safe StartPeriodic method instead.")
125 void UpdateAlarm(uint64_t triggerTime);
133 std::thread m_thread;
136 wpi::mutex m_processMutex;
139 std::atomic<HAL_NotifierHandle> m_notifier{0};
142 std::function<void()> m_handler;
145 double m_expirationTime = 0;
151 bool m_periodic =
false;
void StartPeriodic(double period)
Register for periodic event notification.
void SetHandler(std::function< void()> handler)
Change the handler function.
void Stop()
Stop timer events from occuring.
virtual ~Notifier()
Free the resources for a timer event.
Notifier(std::function< void()> handler)
Create a Notifier for timer event notification.
void StartSingle(double delay)
Register for single event notification.
Base class for most objects.
Definition: ErrorBase.h:104
void SetName(const wpi::Twine &name)
Sets the name of the notifier.
A class that enforces constraints on the differential drive kinematics.
Definition: SPIAccelerometerSim.h:16
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
Definition: Twine.h:85
Definition: Notifier.h:27