use of org.yamcs.protobuf.Commanding.CommandHistoryEntry 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.CommandHistoryEntry in project yamcs-studio by yamcs.
the class ImportPastCommandsDialog method okPressed.
@Override
protected void okPressed() {
YamcsClient yamcsClient = YamcsPlugin.getYamcsClient();
if (yamcsClient == null) {
MessageDialog.openError(Display.getCurrent().getActiveShell(), "Could not import commands\n", "Disconnected from Yamcs");
return;
}
getButton(IDialogConstants.OK_ID).setEnabled(false);
long start = TimeEncoding.fromCalendar(RCPUtils.toCalendar(startDate, startTime));
long stop = TimeEncoding.fromCalendar(RCPUtils.toCalendar(stopDate, stopTime));
TimeInterval interval = new TimeInterval(start, stop);
ArchiveCatalogue catalogue = ArchiveCatalogue.getInstance();
catalogue.downloadCommands(interval, data -> {
try {
CommandHistoryEntry commandHistoryEntry = CommandHistoryEntry.parseFrom(data);
Display.getDefault().asyncExec(() -> {
cmdhistView.processCommandHistoryEntry(commandHistoryEntry);
});
} catch (InvalidProtocolBufferException e) {
throw new YamcsApiException("Failed to decode server message", e);
}
}).whenComplete((data, exc) -> {
if (exc == null) {
Display.getDefault().asyncExec(() -> {
ImportPastCommandsDialog.super.okPressed();
});
} else {
getButton(IDialogConstants.OK_ID).setEnabled(true);
}
});
}
Aggregations