Search in sources :

Example 1 with CommandQueueInfo

use of org.yamcs.protobuf.Commanding.CommandQueueInfo in project yamcs-studio by yamcs.

the class CommandingCatalogue method onMessage.

@Override
public void onMessage(WebSocketSubscriptionData msg) {
    if (msg.hasCommand()) {
        CommandHistoryEntry cmdhistEntry = msg.getCommand();
        cmdhistListeners.forEach(l -> l.processCommandHistoryEntry(cmdhistEntry));
    }
    if (msg.hasCommandQueueEvent()) {
        CommandQueueEvent queueEvent = msg.getCommandQueueEvent();
        switch(queueEvent.getType()) {
            case COMMAND_ADDED:
                queueListeners.forEach(l -> l.commandAdded(queueEvent.getData()));
                break;
            case COMMAND_REJECTED:
                queueListeners.forEach(l -> l.commandRejected(queueEvent.getData()));
                break;
            case COMMAND_SENT:
                queueListeners.forEach(l -> l.commandSent(queueEvent.getData()));
                break;
            default:
                log.log(Level.SEVERE, "Unsupported queue event type " + queueEvent.getType());
        }
    }
    if (msg.hasCommandQueueInfo()) {
        CommandQueueInfo queueInfo = msg.getCommandQueueInfo();
        queuesByName.put(queueInfo.getName(), queueInfo);
        queueListeners.forEach(l -> l.updateQueue(queueInfo));
    }
}
Also used : CommandHistoryEntry(org.yamcs.protobuf.Commanding.CommandHistoryEntry) CommandQueueEvent(org.yamcs.protobuf.Commanding.CommandQueueEvent) CommandQueueInfo(org.yamcs.protobuf.Commanding.CommandQueueInfo)

Example 2 with CommandQueueInfo

use of org.yamcs.protobuf.Commanding.CommandQueueInfo in project yamcs-studio by yamcs.

the class CommandQueuesTableViewer method updateCommandQueueState.

private void updateCommandQueueState(CommandQueue commandQueue, QueueState newState) {
    /* only set new value if it differs from old one */
    if (!commandQueue.getState().equals(newState)) {
        commandQueue.setState(newState);
        CommandQueueInfo q = null;
        for (RowCommandQueueInfo rcqi : commandQueueView.currentQueuesModel.queues) {
            if (rcqi.cq == commandQueue)
                q = rcqi.commandQueueInfo;
        }
        // CommandQueueInfo q = queues.get(row);
        if (newState == QueueState.BLOCKED) {
            blockQueue(q);
        } else if (newState == QueueState.DISABLED) {
            disableQueue(q);
        } else if (newState == QueueState.ENABLED) {
            enableQueue(q);
        }
    }
}
Also used : CommandQueueInfo(org.yamcs.protobuf.Commanding.CommandQueueInfo) RowCommandQueueInfo(org.yamcs.studio.commanding.queue.QueuesTableModel.RowCommandQueueInfo) RowCommandQueueInfo(org.yamcs.studio.commanding.queue.QueuesTableModel.RowCommandQueueInfo)

Aggregations

CommandQueueInfo (org.yamcs.protobuf.Commanding.CommandQueueInfo)2 CommandHistoryEntry (org.yamcs.protobuf.Commanding.CommandHistoryEntry)1 CommandQueueEvent (org.yamcs.protobuf.Commanding.CommandQueueEvent)1 RowCommandQueueInfo (org.yamcs.studio.commanding.queue.QueuesTableModel.RowCommandQueueInfo)1