use of org.firstinspires.ftc.robotcore.internal.network.CallbackResult in project robotcode by OutoftheBoxFTC.
the class ConfigureFromTemplateActivity method commandEvent.
// ----------------------------------------------------------------------------------------------
// Network listener
// ----------------------------------------------------------------------------------------------
@Override
public CallbackResult commandEvent(Command command) {
CallbackResult result = CallbackResult.NOT_HANDLED;
try {
String name = command.getName();
String extra = command.getExtra();
if (name.equals(CommandList.CMD_SCAN_RESP)) {
result = handleCommandScanResp(extra);
} else if (name.equals(CommandList.CMD_REQUEST_CONFIGURATIONS_RESP)) {
result = handleCommandRequestConfigurationsResp(extra);
} else if (name.equals(CommandList.CMD_REQUEST_CONFIGURATION_TEMPLATES_RESP)) {
result = handleCommandRequestTemplatesResp(extra);
} else if (name.equals(CommandList.CMD_REQUEST_PARTICULAR_CONFIGURATION_RESP)) {
result = handleCommandRequestParticularConfigurationResp(extra);
} else if (name.equals(CommandList.CMD_NOTIFY_ACTIVE_CONFIGURATION)) {
result = handleCommandNotifyActiveConfig(extra);
}
} catch (RobotCoreException e) {
RobotLog.logStacktrace(e);
}
return result;
}
use of org.firstinspires.ftc.robotcore.internal.network.CallbackResult in project robotcode by OutoftheBoxFTC.
the class FtcEventLoop method processCommand.
/**
* If the driver station sends over a command, it will be routed to this method. You can choose
* what to do with this command, or you can just ignore it completely.
* <p>
* Called on RecvRunnable.run() thread. Method is thread safe, non-interfering
*/
@Override
public CallbackResult processCommand(Command command) throws InterruptedException, RobotCoreException {
ftcEventLoopHandler.sendBatteryInfo();
CallbackResult result = super.processCommand(command);
if (!result.stopDispatch()) {
CallbackResult localResult = CallbackResult.HANDLED;
String name = command.getName();
String extra = command.getExtra();
if (name.equals(CommandList.CMD_INIT_OP_MODE)) {
handleCommandInitOpMode(extra);
} else if (name.equals(CommandList.CMD_RUN_OP_MODE)) {
handleCommandRunOpMode(extra);
} else if (name.equals(CommandList.CMD_SCAN)) {
handleCommandScan(extra);
} else if (name.equals(CommandList.CMD_DISCOVER_LYNX_MODULES)) {
handleCommandDiscoverLynxModules(extra);
} else {
localResult = CallbackResult.NOT_HANDLED;
}
if (localResult == CallbackResult.HANDLED) {
result = localResult;
}
}
return result;
}
Aggregations