use of com.qualcomm.robotcore.hardware.configuration.WriteXMLFileHandler in project robotcode by OutoftheBoxFTC.
the class FtcEventLoopBase method handleCommandRequestParticularConfiguration.
/*
* The driver station wants the contents of the configuration file.
*/
protected void handleCommandRequestParticularConfiguration(String data) {
RobotConfigFile file = robotCfgFileMgr.getConfigFromString(data);
ReadXMLFileHandler parser = new ReadXMLFileHandler();
if (file.isNoConfig()) {
// don't try to parse if there's no file
return;
}
try {
WriteXMLFileHandler writeXMLFileHandler = new WriteXMLFileHandler(activityContext);
ArrayList<ControllerConfiguration> deviceList = (ArrayList<ControllerConfiguration>) parser.parse(file.getXml());
String xmlData = writeXMLFileHandler.toXml(deviceList);
RobotLog.vv(FtcConfigurationActivity.TAG, "FtcEventLoop: handleCommandRequestParticularConfigFile, data: " + xmlData);
networkConnectionHandler.sendCommand(new Command(CommandList.CMD_REQUEST_PARTICULAR_CONFIGURATION_RESP, xmlData));
} catch (RobotCoreException e) {
e.printStackTrace();
}
}
Aggregations