public class RobotConfigFileManager
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static class |
RobotConfigFileManager.ConfigNameCheckResult |
Modifier and Type | Field and Description |
---|---|
static boolean |
DEBUG |
static java.lang.String |
FILE_EXT |
static java.lang.String |
FILE_LIST_COMMAND_DELIMITER |
java.lang.String |
noConfig |
static java.lang.String |
ROBOT_CONFIG_DESCRIPTION_GENERATE_XSLT |
static java.lang.String |
ROBOT_CONFIG_TAXONOMY_XML |
static java.lang.String |
TAG |
Constructor and Description |
---|
RobotConfigFileManager() |
RobotConfigFileManager(Activity activity) |
Modifier and Type | Method and Description |
---|---|
protected void |
addChild(org.w3c.dom.Document document,
org.w3c.dom.Element parent,
java.lang.String tag,
java.lang.String contents) |
void |
changeHeaderBackground(int idColorHolder) |
void |
createConfigFolder()
Builds the Folder on the sdcard that holds all of the configuration files
if it doesn't exist.
|
static RobotConfigFile |
deserializeConfig(java.lang.String serialized) |
static java.util.List<RobotConfigFile> |
deserializeXMLConfigList(java.lang.String objsSerialized) |
RobotConfigFile |
getActiveConfig() |
RobotConfigFile |
getActiveConfigAndUpdateUI() |
RobotConfigFile |
getConfigFromString(java.lang.String objSerialized) |
static java.io.File |
getFullPath(java.lang.String fileNameWithoutExtension) |
java.lang.String |
getRobotConfigDescription(XmlPullParser xpp)
Returns a high-level human-readable description of an XML robot configuration
or configuration template.
|
protected javax.xml.transform.Source |
getRobotConfigDescriptionTransform()
Returns a
Source to the XSLT transformation that will transform robot config
templates/configurations into human-readable descriptions. |
static java.lang.String |
getRobotConfigTemplateAttribute() |
static java.lang.String |
getRobotConfigTypeAttribute()
Returns the value of the Robot@type attribute of the XML resources that we are interested in
|
protected javax.xml.transform.Source |
getSourceFromPullParser(XmlPullParser xpp) |
java.util.ArrayList<RobotConfigFile> |
getXMLFiles()
Gets the list of files from the Configuration File directory, and populates the global list
used by the fileSpinner.
|
java.util.ArrayList<RobotConfigFile> |
getXMLTemplates() |
RobotConfigFileManager.ConfigNameCheckResult |
isPlausibleConfigName(RobotConfigFile existingConfig,
java.lang.String candidate,
java.util.List<RobotConfigFile> extantConfigurations)
Answers as to whether the candidate config name is a plausible one to use as the name
of a new robot configuration.
|
void |
sendActiveConfigToDriverStation() |
void |
sendRobotControllerActiveConfigAndUpdateUI(RobotConfigFile config) |
static java.lang.String |
serializeConfig(RobotConfigFile configFile) |
static java.lang.String |
serializeXMLConfigList(java.util.List<RobotConfigFile> configList) |
void |
setActiveConfig(boolean runningOnDriverStation,
RobotConfigFile config) |
void |
setActiveConfig(RobotConfigFile cfgFile) |
void |
setActiveConfigAndUpdateUI(boolean runningOnDriverStation,
RobotConfigFile configFile) |
void |
setActiveConfigAndUpdateUI(RobotConfigFile config) |
static void |
setXmlResourceIdSupplier(Supplier<java.util.Collection<java.lang.Integer>> supplier)
Sets the collection into which our class filter will insert the resource ids of
the resource-based robot XML configurations.
|
static void |
setXmlResourceTemplateIdSupplier(Supplier<java.util.Collection<java.lang.Integer>> supplier) |
static java.io.File |
stripFileNameExtension(java.io.File path) |
static java.lang.String |
stripFileNameExtension(java.lang.String fileName) |
java.lang.String |
toXml(java.util.Map<SerialNumber,ControllerConfiguration> deviceControllers)
Calls the writer to write the current list of devices out to a XML string.
|
java.lang.String |
toXml(RobotConfigMap robotConfigMap) |
void |
updateActiveConfigHeader(RobotConfigFile robotConfigFile) |
void |
updateActiveConfigHeader(java.lang.String fileNameIn,
boolean dirty) |
static java.lang.String |
withExtension(java.lang.String fileName) |
void |
writeToFile(RobotConfigFile cfgFile,
boolean runningOnDriverStation,
java.lang.String data) |
public static final java.lang.String TAG
public static final boolean DEBUG
public static final java.lang.String ROBOT_CONFIG_DESCRIPTION_GENERATE_XSLT
public static final java.lang.String ROBOT_CONFIG_TAXONOMY_XML
public static final java.lang.String FILE_LIST_COMMAND_DELIMITER
public static final java.lang.String FILE_EXT
public final java.lang.String noConfig
public RobotConfigFileManager(Activity activity)
public RobotConfigFileManager()
public void createConfigFolder()
public static java.lang.String getRobotConfigTypeAttribute()
public static java.lang.String getRobotConfigTemplateAttribute()
public static void setXmlResourceIdSupplier(Supplier<java.util.Collection<java.lang.Integer>> supplier)
RobotConfigResFilter
public static void setXmlResourceTemplateIdSupplier(Supplier<java.util.Collection<java.lang.Integer>> supplier)
public RobotConfigFile getConfigFromString(java.lang.String objSerialized)
public RobotConfigFile getActiveConfigAndUpdateUI()
public RobotConfigFile getActiveConfig()
public void sendActiveConfigToDriverStation()
public void setActiveConfigAndUpdateUI(boolean runningOnDriverStation, RobotConfigFile configFile)
public void setActiveConfigAndUpdateUI(RobotConfigFile config)
public void setActiveConfig(boolean runningOnDriverStation, RobotConfigFile config)
public void setActiveConfig(RobotConfigFile cfgFile)
public void sendRobotControllerActiveConfigAndUpdateUI(RobotConfigFile config)
public void updateActiveConfigHeader(RobotConfigFile robotConfigFile)
public void updateActiveConfigHeader(java.lang.String fileNameIn, boolean dirty)
public void changeHeaderBackground(int idColorHolder)
public RobotConfigFileManager.ConfigNameCheckResult isPlausibleConfigName(RobotConfigFile existingConfig, java.lang.String candidate, java.util.List<RobotConfigFile> extantConfigurations)
candidate
- the new name to testextantConfigurations
- the list of the currently existing robot configurationspublic static java.lang.String stripFileNameExtension(java.lang.String fileName)
public static java.io.File stripFileNameExtension(java.io.File path)
public static java.lang.String withExtension(java.lang.String fileName)
public static java.io.File getFullPath(java.lang.String fileNameWithoutExtension)
public java.util.ArrayList<RobotConfigFile> getXMLFiles()
public java.util.ArrayList<RobotConfigFile> getXMLTemplates()
public java.lang.String getRobotConfigDescription(XmlPullParser xpp)
protected javax.xml.transform.Source getRobotConfigDescriptionTransform() throws XmlPullParserException, java.io.IOException, javax.xml.transform.TransformerConfigurationException, javax.xml.transform.TransformerException
Source
to the XSLT transformation that will transform robot config
templates/configurations into human-readable descriptions.XmlPullParserException
java.io.IOException
javax.xml.transform.TransformerConfigurationException
javax.xml.transform.TransformerException
protected void addChild(org.w3c.dom.Document document, org.w3c.dom.Element parent, java.lang.String tag, java.lang.String contents)
protected javax.xml.transform.Source getSourceFromPullParser(XmlPullParser xpp) throws XmlPullParserException, java.io.IOException
XmlPullParserException
java.io.IOException
public static java.lang.String serializeXMLConfigList(java.util.List<RobotConfigFile> configList)
public static java.lang.String serializeConfig(RobotConfigFile configFile)
public static java.util.List<RobotConfigFile> deserializeXMLConfigList(java.lang.String objsSerialized)
public static RobotConfigFile deserializeConfig(java.lang.String serialized)
public java.lang.String toXml(java.util.Map<SerialNumber,ControllerConfiguration> deviceControllers)
public java.lang.String toXml(RobotConfigMap robotConfigMap)
public void writeToFile(RobotConfigFile cfgFile, boolean runningOnDriverStation, java.lang.String data) throws RobotCoreException, java.io.IOException
RobotCoreException
java.io.IOException