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));
}
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();
}
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()));
}
}
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);
}
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));
}
Aggregations