Search in sources :

Example 6 with ApplicationData

use of CCDD.CcddClassesDataTable.ApplicationData in project CCDD by nasa.

the class CcddSchedulerEditorHandler method copyMessages.

/**
 ********************************************************************************************
 * Copy the specified (sub-)messages to the specified copy location
 *
 * @param messageList
 *            list of (sub-)messages to copy
 *
 * @param copyList
 *            reference to the list to which to copy the (sub-)messages
 *
 * @param parentMessage
 *            parent of the sub-message; null if this is not a sub-message
 ********************************************************************************************
 */
private void copyMessages(List<Message> messageList, List<Message> copyList, Message parentMessage) {
    // Step through each (sub-)message
    for (Message message : messageList) {
        // Create and store a copy of the (sub-)message
        copyList.add(new Message(message.getName(), message.getID(), message.getBytesRemaining(), parentMessage, parentMessage == null ? new ArrayList<Message>() : null));
        // Step through each variable in the (sub-)message
        for (Variable variable : message.getVariables()) {
            Variable copyVar = null;
            // Check if this is a telemetry scheduler
            if (schedulerHndlr.getSchedulerOption() == TELEMETRY_SCHEDULER) {
                TelemetryData tlmData = (TelemetryData) variable;
                // Create a copy of the telemetry data
                copyVar = VariableGenerator.generateTelemetryData(tlmData.getRate() + TLM_SCH_SEPARATOR + tlmData.getFullName());
            } else // Check if this is an application scheduler
            if (schedulerHndlr.getSchedulerOption() == APPLICATION_SCHEDULER) {
                ApplicationData appData = (ApplicationData) variable;
                // Create a copy of the application data
                copyVar = VariableGenerator.generateApplicationData(appData.getFullName() + "," + appData.getRate() + "," + appData.getSize() + "," + appData.getPriority() + "," + appData.getMessageRate() + "," + appData.getWakeUpID() + "," + appData.getWakeUpName() + "," + appData.getHkSendRate() + "," + appData.getHkWakeUpID() + "," + appData.getHkWakeUpName() + "," + appData.getSchGroup());
            }
            // Check if a copy was produced
            if (copyVar != null) {
                // Add the variable to the copy
                copyList.get(copyList.size() - 1).addVariable(copyVar);
            }
        }
    }
}
Also used : Variable(CCDD.CcddClassesDataTable.Variable) Message(CCDD.CcddClassesDataTable.Message) ApplicationData(CCDD.CcddClassesDataTable.ApplicationData) TelemetryData(CCDD.CcddClassesDataTable.TelemetryData)

Aggregations

ApplicationData (CCDD.CcddClassesDataTable.ApplicationData)6 Variable (CCDD.CcddClassesDataTable.Variable)5 Message (CCDD.CcddClassesDataTable.Message)3 ArrayList (java.util.ArrayList)3 FieldInformation (CCDD.CcddClassesDataTable.FieldInformation)1 GroupInformation (CCDD.CcddClassesDataTable.GroupInformation)1 TelemetryData (CCDD.CcddClassesDataTable.TelemetryData)1