Search in sources :

Example 26 with YamcsClient

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

the class LinkCatalogue method onYamcsConnected.

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

Example 27 with YamcsClient

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

the class LinkCatalogue method disableLink.

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

Example 28 with YamcsClient

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

the class ManagementCatalogue method getCurrentYamcsInstance.

// Careful we must support the case where Yamcs itself changes the instance of our client
// TODO maybe remove this and instead just store an instance field in YamcsClient ?
public static String getCurrentYamcsInstance() {
    ManagementCatalogue catalogue = getInstance();
    if (catalogue == null) {
        return null;
    }
    ClientInfo ci = catalogue.getCurrentClientInfo();
    if (ci != null) {
        return ci.getInstance();
    } else {
        // Fallback (initial connection properties
        YamcsClient yamcsClient = YamcsPlugin.getYamcsClient();
        YamcsConnectionProperties props = yamcsClient.getYamcsConnectionProperties();
        return (props != null) ? props.getInstance() : null;
    }
}
Also used : YamcsClient(org.yamcs.studio.core.client.YamcsClient) YamcsConnectionProperties(org.yamcs.api.YamcsConnectionProperties) ClientInfo(org.yamcs.protobuf.YamcsManagement.ClientInfo)

Example 29 with YamcsClient

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

the class ParameterCatalogue method loadMetaParameters.

private void loadMetaParameters() {
    log.fine("Fetching available parameters");
    YamcsClient yamcsClient = YamcsPlugin.getYamcsClient();
    String instance = ManagementCatalogue.getCurrentYamcsInstance();
    yamcsClient.get("/mdb/" + instance + "/parameters?details", null).whenComplete((data, exc) -> {
        if (exc == null) {
            try {
                ListParameterInfoResponse response = ListParameterInfoResponse.parseFrom(data);
                processMetaParameters(response.getParameterList());
            } 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) ListParameterInfoResponse(org.yamcs.protobuf.Rest.ListParameterInfoResponse)

Example 30 with YamcsClient

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

the class ParameterCatalogue method setParameter.

public CompletableFuture<byte[]> setParameter(String processor, NamedObjectId id, Value value) {
    String pResource = toURISegments(id);
    YamcsClient yamcsClient = YamcsPlugin.getYamcsClient();
    String instance = ManagementCatalogue.getCurrentYamcsInstance();
    return yamcsClient.put("/processors/" + instance + "/" + processor + "/parameters" + pResource, value);
}
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