public class FtcEventLoopIdle extends FtcEventLoopBase
FtcEventLoopIdle
is an eventloop that runs whenever a full FtcEventLoop
is inappropriate.
This event loop should be robust in the face of errors and exceptions, staying up until
it's explicitly shut down.FtcEventLoopBase.LynxUsbDeviceContainer
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
TAG |
activityContext, ftcEventLoopHandler, networkConnectionHandler, programmingModeController, registeredOpModes, robotCfgFileMgr, runningOnDriverStation, usbScanManager, userOpmodeRegister
TELEMETRY_DEFAULT_INTERVAL
Constructor and Description |
---|
FtcEventLoopIdle(HardwareFactory hardwareFactory,
OpModeRegister userOpmodeRegister,
UpdateUI.Callback callback,
android.app.Activity activityContext,
ProgrammingModeController programmingModeController) |
Modifier and Type | Method and Description |
---|---|
OpModeManagerImpl |
getOpModeManager()
Returns the OpModeManager associated with this event loop
|
void |
handleUsbModuleAttach(RobotUsbModule module)
Process the fact that (we believe) that the indicated module has now reappeared after a
previously observed detachment.
|
void |
handleUsbModuleDetach(RobotUsbModule module)
Process the fact that a usb module has now become detached from the system.
|
void |
init(EventLoopManager eventLoopManager)
Init method, this will be called before the first call to loop.
|
void |
loop()
This method will be repeatedly called by the event loop manager.
|
void |
onUsbDeviceAttached(android.hardware.usb.UsbDevice usbDevice)
Notifies the event loop that a UsbDevice has just been attached to the system.
|
void |
pendUsbDeviceAttachment(SerialNumber serialNumber,
long time,
java.util.concurrent.TimeUnit unit) |
void |
processedRecentlyAttachedUsbDevices()
Process the batch of newly arrived USB devices.
|
void |
refreshUserTelemetry(TelemetryMessage telemetry,
double sInterval)
Update's the user portion of the driver station screen with the contents of the telemetry object
here provided if a sufficiently long duration has passed since the last update.
|
void |
requestOpModeStop(OpMode opModeToStopIfActive)
Requests that an OpMode be stopped if it's the currently active one
|
void |
teardown()
Teardown method, this will be called after the last call to loop.
|
checkForChangedOpModes, enterFirmwareUpdateMode, getLynxUsbDeviceForFirmwareUpdate, getUSBAccessibleLynxDevices, handleCommandActivateConfiguration, handleCommandClearRememberedGroups, handleCommandDeleteConfiguration, handleCommandDisconnectWifiDirect, handleCommandDismissAllDialogs, handleCommandDismissDialog, handleCommandDismissProgress, handleCommandGetCandidateLynxFirmwareImages, handleCommandGetUSBAccessibleLynxModules, handleCommandLynxChangeModuleAddresses, handleCommandLynxFirmwareUpdate, handleCommandRequestAboutInfo, handleCommandRequestConfigurations, handleCommandRequestConfigurationTemplates, handleCommandRequestInspectionReport, handleCommandRequestParticularConfiguration, handleCommandRequestRememberedGroups, handleCommandRestartRobot, handleCommandSaveConfiguration, handleCommandShowDialog, handleCommandShowProgress, handleCommandShowToast, handleCommandStartDriverStationProgramAndManage, handleCommandStartProgrammingMode, handleCommandStopProgrammingMode, handleCommandVisuallyConfirmWifiReset, handleCommandVisuallyIdentify, processCommand, sendUIState, startUsbScanMangerIfNecessary, talkToParentLynxModule, updateFirmwareOnce, updateLynxFirmware
public static final java.lang.String TAG
public FtcEventLoopIdle(HardwareFactory hardwareFactory, OpModeRegister userOpmodeRegister, UpdateUI.Callback callback, android.app.Activity activityContext, ProgrammingModeController programmingModeController)
public void init(EventLoopManager eventLoopManager) throws RobotCoreException, java.lang.InterruptedException
EventLoop
init
in interface EventLoop
init
in class FtcEventLoopBase
eventLoopManager
- event loop manager that is responsible for this event loopRobotCoreException
- if a RobotCoreException is thrown, it will be handled
by the event loop manager. The manager will report that the robot failed
to start.java.lang.InterruptedException
public void loop() throws RobotCoreException, java.lang.InterruptedException
EventLoop
RobotCoreException
- if a RobotCoreException is thrown, it will be handled
by the event loop manager. The manager may decide to either stop processing
this iteration of the loop, or it may decide to shut down the robot.java.lang.InterruptedException
public void refreshUserTelemetry(TelemetryMessage telemetry, double sInterval)
EventLoop
telemetry
- the telemetry object to sendsInterval
- the required minimum interval. NaN indicates that a system default interval should be used.public void teardown() throws RobotCoreException, java.lang.InterruptedException
EventLoop
teardown
in interface EventLoop
teardown
in class FtcEventLoopBase
RobotCoreException
- if a RobotCoreException is thrown, it will be handled by the event
loop manager. The manager will then attempt to shut down the robot without the benefit
of the teardown method.java.lang.InterruptedException
public void pendUsbDeviceAttachment(SerialNumber serialNumber, long time, java.util.concurrent.TimeUnit unit)
public void onUsbDeviceAttached(android.hardware.usb.UsbDevice usbDevice)
EventLoop
Implementations of this method should avoid doing significant processing during this notification. Rather, they should squirrel the device away for processing during a later processedRecentlyAttachedUsbDevices call.
usbDevice
- the newly arrived deviceEventLoop.processedRecentlyAttachedUsbDevices()
public void processedRecentlyAttachedUsbDevices() throws RobotCoreException, java.lang.InterruptedException
EventLoop
RobotCoreException
java.lang.InterruptedException
EventLoop.handleUsbModuleDetach(RobotUsbModule)
,
EventLoop.onUsbDeviceAttached(UsbDevice)
public void handleUsbModuleDetach(RobotUsbModule module) throws RobotCoreException, java.lang.InterruptedException
EventLoop
RobotCoreException
java.lang.InterruptedException
EventLoop.processedRecentlyAttachedUsbDevices()
public void handleUsbModuleAttach(RobotUsbModule module) throws RobotCoreException, java.lang.InterruptedException
EventLoop
RobotCoreException
java.lang.InterruptedException
public OpModeManagerImpl getOpModeManager()
EventLoop