Search in sources :

Example 6 with YamcsClient

use of org.yamcs.studio.core.client.YamcsClient in project yamcs-studio by yamcs.

the class CommandingCatalogue method initialiseState.

private void initialiseState() {
    log.fine("Fetching available commands");
    YamcsClient restClient = YamcsPlugin.getYamcsClient();
    String instance = ManagementCatalogue.getCurrentYamcsInstance();
    restClient.get("/mdb/" + instance + "/commands", null).whenComplete((data, exc) -> {
        try {
            ListCommandInfoResponse response = ListCommandInfoResponse.parseFrom(data);
            processMetaCommands(response.getCommandList());
        } catch (InvalidProtocolBufferException e) {
            log.log(Level.SEVERE, "Failed to decode server response", e);
        }
    });
}
Also used : YamcsClient(org.yamcs.studio.core.client.YamcsClient) InvalidProtocolBufferException(com.google.protobuf.InvalidProtocolBufferException) ListCommandInfoResponse(org.yamcs.protobuf.Rest.ListCommandInfoResponse)

Example 7 with YamcsClient

use of org.yamcs.studio.core.client.YamcsClient in project yamcs-studio by yamcs.

the class EventCatalogue method downloadEvents.

/**
 * Downloads a batch of events in the specified time range. These events are not distributed to registered
 * listeners, but only to the provided listener.
 */
public CompletableFuture<Void> downloadEvents(long start, long stop, BulkEventListener listener) {
    String instance = ManagementCatalogue.getCurrentYamcsInstance();
    String resource = "/archive/" + instance + "/downloads/events";
    if (start != TimeEncoding.INVALID_INSTANT) {
        resource += "?start=" + start;
        if (stop != TimeEncoding.INVALID_INSTANT) {
            resource += "&stop=" + stop;
        }
    } else if (stop != TimeEncoding.INVALID_INSTANT) {
        resource += "?stop=" + stop;
    }
    YamcsClient yamcsClient = YamcsPlugin.getYamcsClient();
    EventBatchGenerator batchGenerator = new EventBatchGenerator(listener);
    return yamcsClient.streamGet(resource, null, batchGenerator).whenComplete((data, exc) -> {
        if (!batchGenerator.events.isEmpty()) {
            listener.processEvents(new ArrayList<>(batchGenerator.events));
        }
    });
}
Also used : YamcsClient(org.yamcs.studio.core.client.YamcsClient)

Example 8 with YamcsClient

use of org.yamcs.studio.core.client.YamcsClient in project yamcs-studio by yamcs.

the class LinkCatalogue method enableLink.

public CompletableFuture<byte[]> enableLink(String instance, String name) {
    YamcsClient yamcsClient = YamcsPlugin.getYamcsClient();
    EditLinkRequest req = EditLinkRequest.newBuilder().setState("enabled").build();
    return yamcsClient.patch("/links/" + instance + "/" + name, req);
}
Also used : YamcsClient(org.yamcs.studio.core.client.YamcsClient) EditLinkRequest(org.yamcs.protobuf.Rest.EditLinkRequest)

Example 9 with YamcsClient

use of org.yamcs.studio.core.client.YamcsClient in project yamcs-studio by yamcs.

the class ManagementCatalogue method onYamcsConnected.

@Override
public void onYamcsConnected() {
    YamcsClient yamcsClient = YamcsPlugin.getYamcsClient();
    yamcsClient.subscribe(new WebSocketRequest("management", "subscribe"), this);
}
Also used : YamcsClient(org.yamcs.studio.core.client.YamcsClient) WebSocketRequest(org.yamcs.api.ws.WebSocketRequest)

Example 10 with YamcsClient

use of org.yamcs.studio.core.client.YamcsClient in project yamcs-studio by yamcs.

the class ParameterCatalogue method requestParameterDetail.

public CompletableFuture<byte[]> requestParameterDetail(String qualifiedName) {
    YamcsClient yamcsClient = YamcsPlugin.getYamcsClient();
    String instance = ManagementCatalogue.getCurrentYamcsInstance();
    return yamcsClient.get("/mdb/" + instance + "/parameters" + qualifiedName, null);
}
Also used : YamcsClient(org.yamcs.studio.core.client.YamcsClient)

Aggregations

YamcsClient (org.yamcs.studio.core.client.YamcsClient)31 WebSocketRequest (org.yamcs.api.ws.WebSocketRequest)6 InvalidProtocolBufferException (com.google.protobuf.InvalidProtocolBufferException)4 URLBuilder (org.yamcs.studio.core.client.URLBuilder)3 YamcsConnectionProperties (org.yamcs.api.YamcsConnectionProperties)2 EditLinkRequest (org.yamcs.protobuf.Rest.EditLinkRequest)2 ArchiveCatalogue (org.yamcs.studio.core.model.ArchiveCatalogue)2 TimeCatalogue (org.yamcs.studio.core.model.TimeCatalogue)2 Calendar (java.util.Calendar)1 List (java.util.List)1 IDialogConstants (org.eclipse.jface.dialogs.IDialogConstants)1 MessageDialog (org.eclipse.jface.dialogs.MessageDialog)1 TitleAreaDialog (org.eclipse.jface.dialogs.TitleAreaDialog)1 SWT (org.eclipse.swt.SWT)1 GridData (org.eclipse.swt.layout.GridData)1 GridLayout (org.eclipse.swt.layout.GridLayout)1 RowLayout (org.eclipse.swt.layout.RowLayout)1 Composite (org.eclipse.swt.widgets.Composite)1 Control (org.eclipse.swt.widgets.Control)1 DateTime (org.eclipse.swt.widgets.DateTime)1