public abstract class FtcEventLoopBase extends java.lang.Object implements EventLoop
FtcEventLoopBase
is an abstract base that handles defines core event processing
logic that's available whether or not a Robot is currently extant or notModifier and Type | Class and Description |
---|---|
protected static class |
FtcEventLoopBase.LynxUsbDeviceContainer
abstracts whether we've got a live LynxUsbDeviceImpl or we just opened something locally ourselves.
|
Modifier and Type | Field and Description |
---|---|
protected android.app.Activity |
activityContext |
protected FtcEventLoopHandler |
ftcEventLoopHandler |
protected NetworkConnectionHandler |
networkConnectionHandler |
protected ProgrammingModeController |
programmingModeController |
protected RegisteredOpModes |
registeredOpModes |
protected RobotConfigFileManager |
robotCfgFileMgr |
protected boolean |
runningOnDriverStation |
static java.lang.String |
TAG |
protected USBScanManager |
usbScanManager |
protected OpModeRegister |
userOpmodeRegister |
TELEMETRY_DEFAULT_INTERVAL
Modifier | Constructor and Description |
---|---|
protected |
FtcEventLoopBase(HardwareFactory hardwareFactory,
OpModeRegister userOpmodeRegister,
UpdateUI.Callback callback,
android.app.Activity activityContext,
ProgrammingModeController programmingModeController) |
Modifier and Type | Method and Description |
---|---|
protected void |
checkForChangedOpModes() |
protected boolean |
enterFirmwareUpdateMode(RobotUsbDevice robotUsbDevice) |
protected FtcEventLoopBase.LynxUsbDeviceContainer |
getLynxUsbDeviceForFirmwareUpdate(SerialNumber serialNumber) |
protected java.util.List<USBAccessibleLynxModule> |
getUSBAccessibleLynxDevices(boolean forFirmwareUpdate) |
protected void |
handleCommandActivateConfiguration(java.lang.String data) |
protected void |
handleCommandClearRememberedGroups()
Clear the list of remembered groups
|
protected void |
handleCommandDeleteConfiguration(java.lang.String fileInfo) |
protected void |
handleCommandDisconnectWifiDirect() |
protected void |
handleCommandDismissAllDialogs(Command command) |
protected void |
handleCommandDismissDialog(Command command) |
protected void |
handleCommandDismissProgress(Command command) |
protected void |
handleCommandGetCandidateLynxFirmwareImages(Command commandRequest) |
protected void |
handleCommandGetUSBAccessibleLynxModules(Command commandRequest) |
protected void |
handleCommandLynxChangeModuleAddresses(Command commandRequest) |
protected void |
handleCommandLynxFirmwareUpdate(Command commandRequest)
Update the firmware of the device indicated in the command.
|
protected void |
handleCommandRequestAboutInfo(Command command) |
protected void |
handleCommandRequestConfigurations()
Serialize the entire list of config file metadata and send to the driver station
|
protected void |
handleCommandRequestConfigurationTemplates()
Serialize the entire list of config file metadata and send to the driver station
|
protected void |
handleCommandRequestInspectionReport()
Return an inspection report of this (robot controller) device back to the caller
|
protected void |
handleCommandRequestParticularConfiguration(java.lang.String data) |
protected void |
handleCommandRequestRememberedGroups()
Serialize the list of remembered Wifi Direct groups and send it to the driver station
|
protected void |
handleCommandRestartRobot() |
protected void |
handleCommandSaveConfiguration(java.lang.String fileInfo) |
protected void |
handleCommandShowDialog(Command command) |
protected void |
handleCommandShowProgress(Command command) |
protected void |
handleCommandShowToast(Command command) |
protected void |
handleCommandStartDriverStationProgramAndManage() |
protected void |
handleCommandStartProgrammingMode()
Starts programming mode on the robot controller, as requested by driver station.
|
protected void |
handleCommandStopProgrammingMode()
Stops programming mode on the robot controller, as requested by driver station.
|
protected CallbackResult |
handleCommandVisuallyConfirmWifiReset() |
protected CallbackResult |
handleCommandVisuallyIdentify(Command command) |
void |
init(EventLoopManager eventLoopManager)
Init method, this will be called before the first call to loop.
|
CallbackResult |
processCommand(Command command)
Process command method, this will be called if the event loop manager receives a user defined
command.
|
protected void |
sendUIState() |
protected USBScanManager |
startUsbScanMangerIfNecessary() |
protected void |
talkToParentLynxModule(DeviceManager deviceManager,
LynxUsbDevice lynxUsbDevice,
int moduleAddress,
Consumer<LynxModule> consumer) |
void |
teardown()
Teardown method, this will be called after the last call to loop.
|
protected boolean |
updateFirmwareOnce(FtcEventLoopBase.LynxUsbDeviceContainer lynxUsbDevice,
java.lang.String imageFileName,
byte[] firmwareImage,
SerialNumber serialNumber) |
protected boolean |
updateLynxFirmware(SerialNumber serialNumber,
com.qualcomm.ftccommon.CommandList.FWImage imageFileName)
Updates the firmware of the Expansion Hub in the indicated USB-attached device
to be the indicated firmware.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getOpModeManager, handleUsbModuleAttach, handleUsbModuleDetach, loop, onUsbDeviceAttached, pendUsbDeviceAttachment, processedRecentlyAttachedUsbDevices, refreshUserTelemetry, requestOpModeStop
public static final java.lang.String TAG
protected NetworkConnectionHandler networkConnectionHandler
protected android.app.Activity activityContext
protected RobotConfigFileManager robotCfgFileMgr
protected FtcEventLoopHandler ftcEventLoopHandler
protected boolean runningOnDriverStation
protected final ProgrammingModeController programmingModeController
protected USBScanManager usbScanManager
protected final OpModeRegister userOpmodeRegister
protected final RegisteredOpModes registeredOpModes
protected FtcEventLoopBase(HardwareFactory hardwareFactory, OpModeRegister userOpmodeRegister, UpdateUI.Callback callback, android.app.Activity activityContext, ProgrammingModeController programmingModeController)
protected USBScanManager startUsbScanMangerIfNecessary() throws RobotCoreException
RobotCoreException
public void teardown() throws RobotCoreException, java.lang.InterruptedException
EventLoop
teardown
in interface EventLoop
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 CallbackResult processCommand(Command command) throws java.lang.InterruptedException, RobotCoreException
EventLoop
processCommand
in interface EventLoop
command
- command to processjava.lang.InterruptedException
RobotCoreException
protected void handleCommandActivateConfiguration(java.lang.String data)
protected void sendUIState()
protected void checkForChangedOpModes()
public void init(EventLoopManager eventLoopManager) throws RobotCoreException, java.lang.InterruptedException
EventLoop
init
in interface EventLoop
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
protected void handleCommandRestartRobot()
protected void handleCommandRequestParticularConfiguration(java.lang.String data)
protected void handleCommandDeleteConfiguration(java.lang.String fileInfo)
protected void handleCommandSaveConfiguration(java.lang.String fileInfo)
protected void handleCommandRequestConfigurations()
protected void handleCommandRequestRememberedGroups()
protected void handleCommandClearRememberedGroups()
protected void handleCommandLynxFirmwareUpdate(Command commandRequest)
protected boolean updateLynxFirmware(SerialNumber serialNumber, com.qualcomm.ftccommon.CommandList.FWImage imageFileName)
protected boolean updateFirmwareOnce(FtcEventLoopBase.LynxUsbDeviceContainer lynxUsbDevice, java.lang.String imageFileName, byte[] firmwareImage, SerialNumber serialNumber)
protected boolean enterFirmwareUpdateMode(RobotUsbDevice robotUsbDevice)
protected void handleCommandGetUSBAccessibleLynxModules(Command commandRequest)
protected FtcEventLoopBase.LynxUsbDeviceContainer getLynxUsbDeviceForFirmwareUpdate(SerialNumber serialNumber)
protected java.util.List<USBAccessibleLynxModule> getUSBAccessibleLynxDevices(boolean forFirmwareUpdate) throws RobotCoreException
RobotCoreException
protected void handleCommandLynxChangeModuleAddresses(Command commandRequest)
protected void talkToParentLynxModule(DeviceManager deviceManager, LynxUsbDevice lynxUsbDevice, int moduleAddress, Consumer<LynxModule> consumer) throws RobotCoreException, java.lang.InterruptedException, LynxNackException
RobotCoreException
java.lang.InterruptedException
LynxNackException
protected void handleCommandGetCandidateLynxFirmwareImages(Command commandRequest)
protected void handleCommandRequestConfigurationTemplates()
protected void handleCommandStartProgrammingMode()
protected void handleCommandStartDriverStationProgramAndManage()
protected void handleCommandStopProgrammingMode()
protected void handleCommandShowDialog(Command command)
protected void handleCommandDismissDialog(Command command)
protected void handleCommandDismissAllDialogs(Command command)
protected void handleCommandShowProgress(Command command)
protected void handleCommandDismissProgress(Command command)
protected void handleCommandShowToast(Command command)
protected void handleCommandRequestInspectionReport()
protected void handleCommandRequestAboutInfo(Command command)
protected void handleCommandDisconnectWifiDirect()
protected CallbackResult handleCommandVisuallyIdentify(Command command)
protected CallbackResult handleCommandVisuallyConfirmWifiReset()