Search in sources :

Example 11 with Command

use of com.qualcomm.robotcore.robocol.Command in project robotcode by OutoftheBoxFTC.

the class UserConfigurationTypeManager method sendUserDeviceTypes.

public void sendUserDeviceTypes() {
    String userDeviceTypes = this.serializeUserDeviceTypes();
    NetworkConnectionHandler.getInstance().sendCommand(new Command(RobotCoreCommandList.CMD_NOTIFY_USER_DEVICE_LIST, userDeviceTypes));
}
Also used : Command(com.qualcomm.robotcore.robocol.Command)

Example 12 with Command

use of com.qualcomm.robotcore.robocol.Command in project robotcode by OutoftheBoxFTC.

the class FtcLoadFileActivity method onStart.

@Override
protected void onStart() {
    super.onStart();
    if (!remoteConfigure) {
        robotConfigFileManager.createConfigFolder();
    }
    if (!remoteConfigure) {
        fileList = robotConfigFileManager.getXMLFiles();
        warnIfNoFiles();
    } else {
        // Ask the RC to send us (the DS) the list of configuration files
        networkConnectionHandler.sendCommand(new Command(CommandList.CMD_REQUEST_CONFIGURATIONS));
    }
    populate();
}
Also used : Command(com.qualcomm.robotcore.robocol.Command)

Example 13 with Command

use of com.qualcomm.robotcore.robocol.Command in project robotcode by OutoftheBoxFTC.

the class FtcLoadFileActivity method onFileActivateButtonPressed.

public void onFileActivateButtonPressed(View v) {
    RobotConfigFile file = getFile(v);
    robotConfigFileManager.setActiveConfigAndUpdateUI(remoteConfigure, file);
    if (remoteConfigure) {
        // DS tells the RC to activate a particular file
        networkConnectionHandler.sendCommand(new Command(CommandList.CMD_ACTIVATE_CONFIGURATION, file.toString()));
    }
}
Also used : Command(com.qualcomm.robotcore.robocol.Command)

Example 14 with Command

use of com.qualcomm.robotcore.robocol.Command in project robotcode by OutoftheBoxFTC.

the class FtcLoadFileActivity method doDeleteConfiguration.

/**
 * @see com.qualcomm.ftccommon.FtcEventLoop#handleCommandDeleteConfiguration(String)
 */
void doDeleteConfiguration(RobotConfigFile robotConfigFile) {
    if (remoteConfigure) {
        if (robotConfigFile.getLocation() == RobotConfigFile.FileLocation.LOCAL_STORAGE) {
            networkConnectionHandler.sendCommand(new Command(CommandList.CMD_DELETE_CONFIGURATION, robotConfigFile.toString()));
            fileList.remove(robotConfigFile);
            populate();
        }
        // For robustness, refresh the list from the robot controller
        networkConnectionHandler.sendCommand(new Command(CommandList.CMD_REQUEST_CONFIGURATIONS));
    } else {
        if (robotConfigFile.getLocation() == RobotConfigFile.FileLocation.LOCAL_STORAGE) {
            File file = robotConfigFile.getFullPath();
            if (file.delete()) {
            // all is well
            } else {
                String filenameWExt = file.getName();
                appUtil.showToast(UILocation.ONLY_LOCAL, context, String.format(getString(R.string.configToDeleteDoesNotExist), filenameWExt));
                RobotLog.ee(TAG, "Tried to delete a file that does not exist: " + filenameWExt);
            }
        }
        fileList = robotConfigFileManager.getXMLFiles();
        populate();
    }
    RobotConfigFile cfgFile = RobotConfigFile.noConfig(robotConfigFileManager);
    robotConfigFileManager.setActiveConfigAndUpdateUI(remoteConfigure, cfgFile);
}
Also used : Command(com.qualcomm.robotcore.robocol.Command) File(java.io.File)

Example 15 with Command

use of com.qualcomm.robotcore.robocol.Command in project robotcode by OutoftheBoxFTC.

the class RobotConfigFileManager method sendActiveConfigToDriverStation.

public void sendActiveConfigToDriverStation() {
    RobotConfigFile configFile = this.getActiveConfig();
    String serialized = configFile.toString();
    // RobotLog.vv(TAG, "reporting active config: %s", configFile.getName());
    networkConnectionHandler.sendCommand(new Command(CommandList.CMD_NOTIFY_ACTIVE_CONFIGURATION, serialized));
}
Also used : Command(com.qualcomm.robotcore.robocol.Command)

Aggregations

Command (com.qualcomm.robotcore.robocol.Command)25 RobotConfigFile (com.qualcomm.ftccommon.configuration.RobotConfigFile)5 USBScanManager (com.qualcomm.ftccommon.configuration.USBScanManager)2 RobotCoreException (com.qualcomm.robotcore.exception.RobotCoreException)2 ThreadPool (com.qualcomm.robotcore.util.ThreadPool)2 File (java.io.File)2 ArrayList (java.util.ArrayList)2 ScannedDevices (com.qualcomm.ftccommon.configuration.ScannedDevices)1 LynxModuleMetaList (com.qualcomm.robotcore.hardware.LynxModuleMetaList)1 ControllerConfiguration (com.qualcomm.robotcore.hardware.configuration.ControllerConfiguration)1 ReadXMLFileHandler (com.qualcomm.robotcore.hardware.configuration.ReadXMLFileHandler)1 WriteXMLFileHandler (com.qualcomm.robotcore.hardware.configuration.WriteXMLFileHandler)1 ReadWriteFile (com.qualcomm.robotcore.util.ReadWriteFile)1 SerialNumber (com.qualcomm.robotcore.util.SerialNumber)1 FileFilter (java.io.FileFilter)1 IOException (java.io.IOException)1 CancellationException (java.util.concurrent.CancellationException)1 Pattern (java.util.regex.Pattern)1 CallbackResult (org.firstinspires.ftc.robotcore.internal.network.CallbackResult)1 RecvLoopRunnable (org.firstinspires.ftc.robotcore.internal.network.RecvLoopRunnable)1