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));
}
}
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);
}
}
}
Aggregations