Search in sources :

Example 31 with RobotCoreException

use of com.qualcomm.robotcore.exception.RobotCoreException in project robotcode by OutoftheBoxFTC.

the class FtcLoadFileActivity method commandEvent.

// ------------------------------------------------------------------------------------------------
// Remote handling
// ------------------------------------------------------------------------------------------------
@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_REQUEST_CONFIGURATIONS_RESP)) {
            result = handleCommandRequestConfigFilesResp(extra);
        } else if (name.equals(CommandList.CMD_NOTIFY_ACTIVE_CONFIGURATION)) {
            result = handleCommandNotifyActiveConfig(extra);
        }
    } catch (RobotCoreException e) {
        RobotLog.logStacktrace(e);
    }
    return result;
}
Also used : CallbackResult(org.firstinspires.ftc.robotcore.internal.network.CallbackResult) RobotCoreException(com.qualcomm.robotcore.exception.RobotCoreException)

Example 32 with RobotCoreException

use of com.qualcomm.robotcore.exception.RobotCoreException 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;
}
Also used : CallbackResult(org.firstinspires.ftc.robotcore.internal.network.CallbackResult) RobotCoreException(com.qualcomm.robotcore.exception.RobotCoreException)

Aggregations

RobotCoreException (com.qualcomm.robotcore.exception.RobotCoreException)32 RobotUsbDevice (com.qualcomm.robotcore.hardware.usb.RobotUsbDevice)10 ModernRoboticsUsbDevice (com.qualcomm.hardware.modernrobotics.ModernRoboticsUsbDevice)5 IOException (java.io.IOException)5 CallbackResult (org.firstinspires.ftc.robotcore.internal.network.CallbackResult)4 DuplicateNameException (com.qualcomm.robotcore.exception.DuplicateNameException)3 ControllerConfiguration (com.qualcomm.robotcore.hardware.configuration.ControllerConfiguration)3 ByteBuffer (java.nio.ByteBuffer)3 Map (java.util.Map)3 RobotUsbException (org.firstinspires.ftc.robotcore.internal.usb.exception.RobotUsbException)3 RobotConfigFile (com.qualcomm.ftccommon.configuration.RobotConfigFile)2 LegacyModuleControllerConfiguration (com.qualcomm.robotcore.hardware.configuration.LegacyModuleControllerConfiguration)2 MotorControllerConfiguration (com.qualcomm.robotcore.hardware.configuration.MotorControllerConfiguration)2 ReadXMLFileHandler (com.qualcomm.robotcore.hardware.configuration.ReadXMLFileHandler)2 ServoControllerConfiguration (com.qualcomm.robotcore.hardware.configuration.ServoControllerConfiguration)2 Command (com.qualcomm.robotcore.robocol.Command)2 SerialNumber (com.qualcomm.robotcore.util.SerialNumber)2 ArrayList (java.util.ArrayList)2 CancellationException (java.util.concurrent.CancellationException)2 AlertDialog (android.app.AlertDialog)1