Class Notifier
- All Implemented Interfaces:
AutoCloseable
If startSingle() is used, the callback will run once. If startPeriodic() is used, the callback will run repeatedly with the given period until stop() is called.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()voidsetCallback(Runnable callback) Change the callback function.static booleansetHALThreadPriority(boolean realTime, int priority) Sets the HAL notifier thread priority.voidSets the name of the notifier.voidstartPeriodic(double period) Run the callback periodically with the given period.voidstartPeriodic(Frequency frequency) Run the callback periodically with the given frequency.voidstartPeriodic(Time period) Run the callback periodically with the given period.voidstartSingle(double delay) Run the callback once after the given delay.voidstartSingle(Time delay) Run the callback once after the given delay.voidstop()Stop further callback invocations.
-
Constructor Details
-
Notifier
-
-
Method Details
-
close
- Specified by:
closein interfaceAutoCloseable
-
setName
-
setCallback
Change the callback function.- Parameters:
callback- The callback function.
-
startSingle
Run the callback once after the given delay.- Parameters:
delay- Time in seconds to wait before the callback is called.
-
startSingle
Run the callback once after the given delay.- Parameters:
delay- Time to wait before the callback is called.
-
startPeriodic
Run the callback periodically with the given period.The user-provided callback should be written so that it completes before the next time it's scheduled to run.
- Parameters:
period- Period in seconds after which to call the callback starting one period after the call to this method.
-
startPeriodic
Run the callback periodically with the given period.The user-provided callback should be written so that it completes before the next time it's scheduled to run.
- Parameters:
period- Period after which to call the callback starting one period after the call to this method.
-
startPeriodic
Run the callback periodically with the given frequency.The user-provided callback should be written so that it completes before the next time it's scheduled to run.
- Parameters:
frequency- Frequency at which to call the callback, starting one period after the call to this method.
-
stop
Stop further callback invocations.No further periodic callbacks will occur. Single invocations will also be cancelled if they haven't yet occurred.
-
setHALThreadPriority
Sets the HAL notifier thread priority.The HAL notifier thread is responsible for managing the FPGA's notifier interrupt and waking up user's Notifiers when it's their time to run. Giving the HAL notifier thread real-time priority helps ensure the user's real-time Notifiers, if any, are notified to run in a timely manner.
- Parameters:
realTime- Set to true to set a real-time priority, false for standard priority.priority- Priority to set the thread to. For real-time, this is 1-99 with 99 being highest. For non-real-time, this is forced to 0. See "man 7 sched" for more details.- Returns:
- True on success.
-