Package edu.wpi.first.wpilibj
Class Notifier
- java.lang.Object
-
- edu.wpi.first.wpilibj.Notifier
-
- All Implemented Interfaces:
AutoCloseable
public class Notifier extends Object implements AutoCloseable
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
protected void
finalize()
void
setHandler(Runnable handler)
Change the handler function.void
startPeriodic(double period)
Register for periodic event notification.void
startSingle(double delay)
Register for single event notification.void
stop()
Stop timer events from occurring.
-
-
-
Constructor Detail
-
Notifier
public Notifier(Runnable run)
Create a Notifier for timer event notification.- Parameters:
run
- The handler that is called at the notification time which is set using StartSingle or StartPeriodic.
-
-
Method Detail
-
close
public void close()
- Specified by:
close
in interfaceAutoCloseable
-
setHandler
public void setHandler(Runnable handler)
Change the handler function.- Parameters:
handler
- Handler
-
startSingle
public void startSingle(double delay)
Register for single event notification. A timer event is queued for a single event after the specified delay.- Parameters:
delay
- Seconds to wait before the handler is called.
-
startPeriodic
public void startPeriodic(double period)
Register for periodic event notification. A timer event is queued for periodic event notification. Each time the interrupt occurs, the event will be immediately requeued for the same time interval.- Parameters:
period
- Period in seconds to call the handler starting one period after the call to this method.
-
stop
public void stop()
Stop timer events from occurring. Stop any repeating timer events from occurring. This will also remove any single notification events from the queue. If a timer-based call to the registered handler is in progress, this function will block until the handler call is complete.
-
-