use of org.yamcs.studio.core.client.YamcsClient in project yamcs-studio by yamcs.
the class YamcsAuthorizations method isAuthorizationEnabled.
public boolean isAuthorizationEnabled() {
YamcsClient yamcsClient = YamcsPlugin.getYamcsClient();
// TODO we should probably control this from the server, rather than here. Just because
// the creds are null, does not really mean anything. We could also send creds to an
// unsecured yamcs server. It would just ignore it, and then our client state would
// be wrong
YamcsConnectionProperties yprops = yamcsClient.getYamcsConnectionProperties();
return (yprops == null) ? false : yprops.getAuthenticationToken() != null;
}
use of org.yamcs.studio.core.client.YamcsClient 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);
}
});
}
use of org.yamcs.studio.core.client.YamcsClient in project yamcs-studio by yamcs.
the class DisconnectHandler method execute.
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
YamcsClient yamcsClient = YamcsPlugin.getYamcsClient();
yamcsClient.disconnect();
return null;
}
use of org.yamcs.studio.core.client.YamcsClient in project yamcs-studio by yamcs.
the class YamcsPlugin method start.
@Override
public void start(BundleContext context) throws Exception {
super.start(context);
plugin = this;
TimeEncoding.setUp();
yamcsClient = new YamcsClient(getProductString(), true);
yamcsClient.addConnectionListener(new UIConnectionListener());
ManagementCatalogue managementCatalogue = new ManagementCatalogue();
catalogues.put(ManagementCatalogue.class, managementCatalogue);
addYamcsConnectionListener(managementCatalogue);
registerCatalogue(new TimeCatalogue());
registerCatalogue(new ParameterCatalogue());
registerCatalogue(new CommandingCatalogue());
registerCatalogue(new AlarmCatalogue());
registerCatalogue(new EventCatalogue());
registerCatalogue(new LinkCatalogue());
registerCatalogue(new ArchiveCatalogue());
}
use of org.yamcs.studio.core.client.YamcsClient in project yamcs-studio by yamcs.
the class AlarmCatalogue method onYamcsConnected.
@Override
public void onYamcsConnected() {
YamcsClient yamcsClient = YamcsPlugin.getYamcsClient();
yamcsClient.subscribe(new WebSocketRequest("alarms", "subscribe"), this);
}
Aggregations