Search in sources :

Example 21 with YamcsClient

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

the class CommandingCatalogue method onYamcsConnected.

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

Example 22 with YamcsClient

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

the class ContainerCatalogue method loadContainers.

private void loadContainers() {
    log.fine("Fetching available Containers");
    YamcsClient yamcsClient = YamcsPlugin.getYamcsClient();
    String instance = ManagementCatalogue.getCurrentYamcsInstance();
    yamcsClient.get("/mdb/" + instance + "/containers", null).whenComplete((data, exc) -> {
        try {
            ListContainerInfoResponse response = ListContainerInfoResponse.parseFrom(data);
            processContainers(response.getContainerList());
        } 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) ListContainerInfoResponse(org.yamcs.protobuf.Rest.ListContainerInfoResponse)

Example 23 with YamcsClient

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

the class EventCatalogue method onYamcsConnected.

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

Example 24 with YamcsClient

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

the class EventCatalogue method fetchLatestEvents.

public CompletableFuture<byte[]> fetchLatestEvents(String instance) {
    String resource = "/archive/" + instance + "/events";
    YamcsClient yamcsClient = YamcsPlugin.getYamcsClient();
    return yamcsClient.get(resource, null);
}
Also used : YamcsClient(org.yamcs.studio.core.client.YamcsClient)

Example 25 with YamcsClient

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

the class EventCatalogue method createEvent.

public CompletableFuture<byte[]> createEvent(String source, int sequenceNumber, String message, long generationTime, long receptionTime, EventSeverity severity) {
    String instance = ManagementCatalogue.getCurrentYamcsInstance();
    String resource = "/archive/" + instance + "/events/";
    Event event = Event.newBuilder().setSource(source).setSeqNumber(sequenceNumber).setMessage(message).setGenerationTime(generationTime).setReceptionTime(receptionTime).setSeverity(severity).build();
    YamcsClient yamcsClient = YamcsPlugin.getYamcsClient();
    return yamcsClient.post(resource, event);
}
Also used : YamcsClient(org.yamcs.studio.core.client.YamcsClient) Event(org.yamcs.protobuf.Yamcs.Event)

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