Search in sources :

Example 1 with BaseTypeSetType

use of org.ccsds.schema.sois.seds.BaseTypeSetType in project CCDD by nasa.

the class CcddEDSHandler method addCommand.

/**
 ********************************************************************************************
 * Add a command metadata set to the command metadata
 *
 * @param namespace
 *            name space
 *
 * @param commandName
 *            command name
 *
 * @param commandCode
 *            command code
 *
 * @param isCmdHeader
 *            true if this table represents the CCSDS command header
 *
 * @param applicationID
 *            application ID
 *
 * @param ccsdsAppID
 *            name of the command header argument containing the application ID
 *
 * @param ccsdsFuncCode
 *            name of the command header argument containing the command function code
 *
 * @param argumentNames
 *            list of command argument names
 *
 * @param description
 *            description of the command
 ********************************************************************************************
 */
private void addCommand(NamespaceType namespace, String commandName, // TODO WHERE DOES THIS GET PUT?
String commandCode, boolean isCmdHeader, // TODO WHERE DOES THIS GET PUT?
String applicationID, // TODO WHERE DOES THIS GET PUT?
String ccsdsAppID, // TODO WHERE DOES THIS GET PUT?
String ccsdsFuncCode, List<CommandArgumentType> arguments, String description) {
    // Build the command attributes
    InterfaceCommandType command = factory.createInterfaceCommandType();
    command.setName(commandName);
    // Check if a command description is provided
    if (description != null && !description.isEmpty()) {
        // Set the command description
        command.setLongDescription(description);
    }
    // Check if any arguments are supplied for this command
    if (!arguments.isEmpty()) {
        // Step through each argument type
        for (CommandArgumentType argType : arguments) {
            // Add the argument information to the command
            command.getArgument().add(argType);
        }
    }
    InterfaceDeclarationType intCmdType = null;
    // Step through the interfaces in order to locate the name space's command set
    for (InterfaceDeclarationType intfcDecType : namespace.getDeclaredInterfaceSet().getInterface()) {
        // Check if the interface contains a command set
        if (intfcDecType.getCommandSet() != null) {
            // Get the command set reference and stop searching
            intCmdType = intfcDecType;
            break;
        }
    }
    // Check if a command set exists
    if (intCmdType == null) {
        // Create the command set for this name space
        intCmdType = createCommandSet(namespace);
    }
    // Check if this isn't the command header table
    if (!namespace.getName().equals(cmdHeaderTable)) {
        // Set the command header as the base
        BaseTypeSetType baseType = factory.createBaseTypeSetType();
        InterfaceRefType intfcType = factory.createInterfaceRefType();
        intfcType.setType(cmdHeaderTable + "/" + COMMAND);
        baseType.getBaseType().add(intfcType);
        intCmdType.setBaseTypeSet(baseType);
    }
    // Add the command to the command set
    intCmdType.getCommandSet().getCommand().add(command);
}
Also used : CommandArgumentType(org.ccsds.schema.sois.seds.CommandArgumentType) InterfaceCommandType(org.ccsds.schema.sois.seds.InterfaceCommandType) InterfaceDeclarationType(org.ccsds.schema.sois.seds.InterfaceDeclarationType) BaseTypeSetType(org.ccsds.schema.sois.seds.BaseTypeSetType) InterfaceRefType(org.ccsds.schema.sois.seds.InterfaceRefType)

Aggregations

BaseTypeSetType (org.ccsds.schema.sois.seds.BaseTypeSetType)1 CommandArgumentType (org.ccsds.schema.sois.seds.CommandArgumentType)1 InterfaceCommandType (org.ccsds.schema.sois.seds.InterfaceCommandType)1 InterfaceDeclarationType (org.ccsds.schema.sois.seds.InterfaceDeclarationType)1 InterfaceRefType (org.ccsds.schema.sois.seds.InterfaceRefType)1