Search in sources :

Example 6 with Message

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

the class CcddAssignMessageIDDialog method assignTelemetryMessageIDs.

/**
 ********************************************************************************************
 * Assign the telemetry message IDs
 *
 * @param tlmID
 *            telemetry message ID tab information reference
 ********************************************************************************************
 */
private void assignTelemetryMessageIDs(MsgTabInfo tlmID) {
    // Get the starting message ID and ID interval values
    int startID = Integer.decode(tlmID.getStartFld().getText());
    int interval = Integer.valueOf(tlmID.getIntervalFld().getText());
    // Get the first unused message ID, beginning with the ID provided
    startID = getNextMessageID(startID, interval);
    // Step through each message
    for (Message message : messages) {
        // Set the message's ID to the next one in the sequence
        startID = setMessageID(tlmID, message, startID, interval);
        // since its ID gets set when the parent message's ID is set
        for (int index = 1; index < message.getSubMessages().size(); index++) {
            // Set the sub-message's ID to the next one in the sequence (for the default
            // sub-message use the parent message's ID
            startID = setMessageID(tlmID, message.getSubMessage(index), startID, interval);
        }
    }
}
Also used : Message(CCDD.CcddClassesDataTable.Message)

Example 7 with Message

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

the class CcddApplicationSchedulerTableHandler method createApplicationScheduleDefinitionTable.

/**
 ********************************************************************************************
 * Create the schedule definition table entries based on the time slot definitions
 ********************************************************************************************
 */
private void createApplicationScheduleDefinitionTable() {
    sdtEntries = new ArrayList<String[][]>();
    int numMsgsPerSlot = appHandler.getNumberOfMessagesPerTimeSlot();
    String[][] sdtEntry;
    // Step through each message
    for (Message message : getValidatedStoredData()) {
        sdtEntry = new String[numMsgsPerSlot][6];
        // Step through each message in the time slot
        for (int msgIndex = 0; msgIndex < numMsgsPerSlot; msgIndex++) {
            // Sort the messages based on their assigned priority values
            prioritizeApps(message);
            // Check if a message is assigned to this message/time slot
            if (message.getNumberOfVariables() > msgIndex) {
                // Store the message entry
                ApplicationData appData = (ApplicationData) message.getVariable(msgIndex);
                sdtEntry[msgIndex][0] = ENABLE;
                sdtEntry[msgIndex][1] = ACTIVITY;
                sdtEntry[msgIndex][2] = "1";
                sdtEntry[msgIndex][3] = "0";
                sdtEntry[msgIndex][4] = getMessageIndex(Integer.decode(appData.getWakeUpID()));
                sdtEntry[msgIndex][5] = appData.getSchGroup();
            } else // No message is assigned
            {
                // Store an "unused" entry
                sdtEntry[msgIndex][0] = UNUSED;
                sdtEntry[msgIndex][1] = "0";
                sdtEntry[msgIndex][2] = "0";
                sdtEntry[msgIndex][3] = "0";
                sdtEntry[msgIndex][4] = "0";
                sdtEntry[msgIndex][5] = GROUPNONE;
            }
        }
        // Add the message to the list of schedule definition table entries
        sdtEntries.add(sdtEntry);
    }
}
Also used : Message(CCDD.CcddClassesDataTable.Message) ApplicationData(CCDD.CcddClassesDataTable.ApplicationData)

Example 8 with Message

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

the class CcddApplicationSchedulerInput method selectTimeSlotbyApplication.

/**
 ********************************************************************************************
 * Select the message(s) in the assignment tree for which the selected variable in the variable
 * tree is a member
 ********************************************************************************************
 */
private void selectTimeSlotbyApplication() {
    // Check if only a single node is selected in the application tree
    if (applicationTree.getSelectionPaths().length == 1) {
        // Get the first selected application
        String application = applicationTree.getFullVariablePath(applicationTree.getSelectionPath().getPath(), applicationTree.getGroupNodeLevel());
        // belongs to a time slot
        if (application.contains(DISABLED_TEXT_COLOR)) {
            // Remove the HTML flags from the application name
            application = applicationTree.removeExtraText(application);
            // Clear any selected time slot(s) in the Scheduler table
            schedulerDlg.getSchedulerHandler().getSchedulerEditor().getTable().clearSelection();
            // first time slot containing the application gets the focus
            for (int row = schedulerDlg.getSchedulerHandler().getCurrentMessages().size() - 1; row >= 0; row--) {
                String option = "";
                // Get the time slot reference
                Message slot = schedulerDlg.getSchedulerHandler().getCurrentMessages().get(row);
                // Check if the application is a member of the time slot
                if (slot.isVariableInMessage(application)) {
                    // Set the option to the time slot name
                    option = slot.getName();
                    // Select the time slot in the Scheduler table
                    schedulerDlg.getSchedulerHandler().getSchedulerEditor().getTable().changeSelection(row, SchedulerColumn.NAME.ordinal(), true, false);
                }
                // Check if a matching option was found
                if (!option.isEmpty()) {
                    // Select the option in the options list
                    schedulerDlg.getSchedulerHandler().selectOptionByMessage(option);
                }
            }
        }
    }
}
Also used : Message(CCDD.CcddClassesDataTable.Message)

Example 9 with Message

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

the class CcddAssignMessageIDDialog method assignTelemetryMessageNames.

/**
 ********************************************************************************************
 * Assign the telemetry message names
 *
 * @param tlmName
 *            telemetry message name tab information reference
 ********************************************************************************************
 */
private void assignTelemetryMessageNames(MsgTabInfo tlmName) {
    // Get the message starting number and interval values
    int startNum = Integer.valueOf(tlmName.getStartFld().getText());
    int interval = Integer.valueOf(tlmName.getIntervalFld().getText());
    // Step through each message
    for (Message message : messages) {
        // Use the pattern and current message number to create the message name
        String msgName = String.format(tlmName.getPatternFld().getText(), startNum);
        // Adjust the message number by the interval amount
        startNum += interval;
        // Store the message's current name, then change the name to the new one
        String originalName = message.getName();
        message.setName(msgName);
        // Check if the message has sub-messages other than the default
        if (message.getNumberOfSubMessages() > 1) {
            // Step through each of the message's sub-messages
            for (Message subMessage : message.getSubMessages()) {
                // Update the sub-message name to match the new pattern
                subMessage.setName(subMessage.getName().replaceFirst(Pattern.quote(originalName), msgName));
            }
        }
    }
}
Also used : Message(CCDD.CcddClassesDataTable.Message)

Example 10 with Message

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

the class CcddSchedulerDbIOHandler method getApplicationData.

/**
 ********************************************************************************************
 * Get the list of the current messages. Each list item is a string arrays containing the
 * message name and a space-separated list of applications in that message
 *
 * @param messages
 *            list of messages
 *
 * @return List of current messages
 ********************************************************************************************
 */
private List<String[]> getApplicationData(List<Message> messages) {
    List<String[]> currentMsg = new ArrayList<String[]>();
    // Step through each message
    for (Message message : messages) {
        // Check if the time slot has no applications assigned
        if (message.getVariables().isEmpty()) {
            // Create a placeholder for the application information
            currentMsg.add(new String[] { message.getName(), "" });
        } else // The time slot has applications assigned
        {
            // Step through each application in the message
            for (Variable variable : message.getVariables()) {
                ApplicationData appData = (ApplicationData) variable;
                // Create new array for the row
                String[] app = new String[2];
                // Store the message name, and application name, rate, run time, priority,
                // wake-up name, wake-up ID, send rate, housekeeping wake-up name, housekeeping
                // wake-up ID, and schedule group name
                app[AppSchedulerColumn.TIME_SLOT.ordinal()] = message.getName();
                app[AppSchedulerColumn.APP_INFO.ordinal()] = appData.getFullName() + "," + appData.getRate() + "," + appData.getSize() + "," + appData.getPriority() + "," + appData.getMessageRate() + "," + appData.getWakeUpName() + "," + appData.getWakeUpID() + "," + appData.getHkSendRate() + "," + appData.getHkWakeUpName() + "," + appData.getHkWakeUpID() + "," + appData.getSchGroup();
                // Add the application to the list
                currentMsg.add(app);
            }
        }
    }
    return currentMsg;
}
Also used : Variable(CCDD.CcddClassesDataTable.Variable) Message(CCDD.CcddClassesDataTable.Message) ArrayList(java.util.ArrayList) ApplicationData(CCDD.CcddClassesDataTable.ApplicationData)

Aggregations

Message (CCDD.CcddClassesDataTable.Message)24 Variable (CCDD.CcddClassesDataTable.Variable)8 ArrayList (java.util.ArrayList)8 ApplicationData (CCDD.CcddClassesDataTable.ApplicationData)3 DataStream (CCDD.CcddClassesDataTable.DataStream)2 DefaultListModel (javax.swing.DefaultListModel)2 CustomSplitPane (CCDD.CcddClassesComponent.CustomSplitPane)1 CCDDException (CCDD.CcddClassesDataTable.CCDDException)1 FieldInformation (CCDD.CcddClassesDataTable.FieldInformation)1 RateInformation (CCDD.CcddClassesDataTable.RateInformation)1 TelemetryData (CCDD.CcddClassesDataTable.TelemetryData)1 SchedulerType (CCDD.CcddConstants.SchedulerType)1 TypeDefinition (CCDD.CcddTableTypeHandler.TypeDefinition)1 Component (java.awt.Component)1 Dimension (java.awt.Dimension)1 GridBagConstraints (java.awt.GridBagConstraints)1 GridBagLayout (java.awt.GridBagLayout)1 Insets (java.awt.Insets)1 JComponent (javax.swing.JComponent)1 JLabel (javax.swing.JLabel)1