Search in sources :

Example 1 with ProcessorInfo

use of org.yamcs.protobuf.YamcsManagement.ProcessorInfo in project yamcs-studio by yamcs.

the class ManagementCatalogue method onMessage.

@Override
public void onMessage(WebSocketSubscriptionData msg) {
    if (msg.hasConnectionInfo()) {
        ConnectionInfo connectionInfo = msg.getConnectionInfo();
        YamcsInstance instance = connectionInfo.getInstance();
        log.fine("Instance " + instance.getName() + ": " + instance.getState());
        managementListeners.forEach(l -> l.instanceUpdated(connectionInfo));
    }
    if (msg.hasClientInfo()) {
        ClientInfo clientInfo = msg.getClientInfo();
        if (clientInfo.getState() == ClientState.DISCONNECTED) {
            ClientInfo previousClientInfo = clientInfoById.remove(clientInfo.getId());
            checkOwnClientState(previousClientInfo, clientInfo);
            managementListeners.forEach(l -> l.clientDisconnected(clientInfo));
        } else {
            ClientInfo previousClientInfo = clientInfoById.put(clientInfo.getId(), clientInfo);
            checkOwnClientState(previousClientInfo, clientInfo);
            managementListeners.forEach(l -> l.clientUpdated(clientInfo));
        }
    }
    if (msg.hasProcessorInfo()) {
        ProcessorInfo processorInfo = msg.getProcessorInfo();
        String instance = processorInfo.getInstance();
        Map<String, ProcessorInfo> instanceProcessors = processorInfoByInstance.get(instance);
        if (instanceProcessors == null) {
            instanceProcessors = new ConcurrentHashMap<>();
            processorInfoByInstance.put(instance, instanceProcessors);
        }
        if (processorInfo.getState() == ServiceState.TERMINATED) {
            instanceProcessors.remove(processorInfo.getName());
        } else {
            instanceProcessors.put(processorInfo.getName(), processorInfo);
        }
        managementListeners.forEach(l -> l.processorUpdated(processorInfo));
    }
    if (msg.hasStatistics()) {
        Statistics statistics = msg.getStatistics();
        managementListeners.forEach(l -> l.statisticsUpdated(statistics));
    }
}
Also used : ProcessorInfo(org.yamcs.protobuf.YamcsManagement.ProcessorInfo) YamcsInstance(org.yamcs.protobuf.YamcsManagement.YamcsInstance) ConnectionInfo(org.yamcs.protobuf.Web.ConnectionInfo) ClientInfo(org.yamcs.protobuf.YamcsManagement.ClientInfo) Statistics(org.yamcs.protobuf.YamcsManagement.Statistics)

Example 2 with ProcessorInfo

use of org.yamcs.protobuf.YamcsManagement.ProcessorInfo in project yamcs-studio by yamcs.

the class YamcsUIPlugin method updateGlobalProcessingState.

private void updateGlobalProcessingState(ClientInfo clientInfo) {
    // TODO Not sure which one of this method or the previous would trigger first, and whether that's deterministic
    // therefore, just have similar logic here.
    IWorkbench workbench = PlatformUI.getWorkbench();
    workbench.getDisplay().asyncExec(() -> {
        if (clientInfo.getCurrentClient()) {
            ManagementCatalogue catalogue = ManagementCatalogue.getInstance();
            ProcessorInfo processorInfo = catalogue.getProcessorInfo(clientInfo.getProcessorName());
            doUpdateGlobalProcessingState(workbench, processorInfo);
        }
    });
}
Also used : IWorkbench(org.eclipse.ui.IWorkbench) ManagementCatalogue(org.yamcs.studio.core.model.ManagementCatalogue) ProcessorInfo(org.yamcs.protobuf.YamcsManagement.ProcessorInfo)

Example 3 with ProcessorInfo

use of org.yamcs.protobuf.YamcsManagement.ProcessorInfo in project yamcs-studio by yamcs.

the class ForwardHandler method execute.

@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
    ProcessorInfo processorInfo = ManagementCatalogue.getInstance().getCurrentProcessorInfo();
    String newSpeed;
    if (processorInfo.getReplayRequest().hasSpeed()) {
        ReplaySpeed currentSpeed = processorInfo.getReplayRequest().getSpeed();
        float speedValue = currentSpeed.getParam() * 2f;
        if (speedValue > 17)
            speedValue = 1.0f;
        newSpeed = (speedValue == 0f ? 1f : speedValue) + "x";
    } else {
        newSpeed = "2x";
    }
    EditProcessorRequest req = EditProcessorRequest.newBuilder().setSpeed(newSpeed).build();
    ManagementCatalogue catalogue = ManagementCatalogue.getInstance();
    catalogue.editProcessorRequest(processorInfo.getInstance(), processorInfo.getName(), req);
    return null;
}
Also used : ManagementCatalogue(org.yamcs.studio.core.model.ManagementCatalogue) EditProcessorRequest(org.yamcs.protobuf.Rest.EditProcessorRequest) ProcessorInfo(org.yamcs.protobuf.YamcsManagement.ProcessorInfo) ReplaySpeed(org.yamcs.protobuf.Yamcs.ReplaySpeed)

Example 4 with ProcessorInfo

use of org.yamcs.protobuf.YamcsManagement.ProcessorInfo in project yamcs-studio by yamcs.

the class PauseHandler method execute.

@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
    ManagementCatalogue catalogue = ManagementCatalogue.getInstance();
    ProcessorInfo processorInfo = catalogue.getCurrentProcessorInfo();
    EditProcessorRequest req = EditProcessorRequest.newBuilder().setState("PAUSED").build();
    catalogue.editProcessorRequest(processorInfo.getInstance(), processorInfo.getName(), req);
    return null;
}
Also used : ManagementCatalogue(org.yamcs.studio.core.model.ManagementCatalogue) EditProcessorRequest(org.yamcs.protobuf.Rest.EditProcessorRequest) ProcessorInfo(org.yamcs.protobuf.YamcsManagement.ProcessorInfo)

Example 5 with ProcessorInfo

use of org.yamcs.protobuf.YamcsManagement.ProcessorInfo in project yamcs-studio by yamcs.

the class PlayHandler method execute.

@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
    ManagementCatalogue catalogue = ManagementCatalogue.getInstance();
    ProcessorInfo processorInfo = catalogue.getCurrentProcessorInfo();
    EditProcessorRequest req = EditProcessorRequest.newBuilder().setState("RUNNING").build();
    catalogue.editProcessorRequest(processorInfo.getInstance(), processorInfo.getName(), req);
    return null;
}
Also used : ManagementCatalogue(org.yamcs.studio.core.model.ManagementCatalogue) EditProcessorRequest(org.yamcs.protobuf.Rest.EditProcessorRequest) ProcessorInfo(org.yamcs.protobuf.YamcsManagement.ProcessorInfo)

Aggregations

ProcessorInfo (org.yamcs.protobuf.YamcsManagement.ProcessorInfo)15 ManagementCatalogue (org.yamcs.studio.core.model.ManagementCatalogue)10 EditProcessorRequest (org.yamcs.protobuf.Rest.EditProcessorRequest)4 ClientInfo (org.yamcs.protobuf.YamcsManagement.ClientInfo)3 Shell (org.eclipse.swt.widgets.Shell)2 IWorkbench (org.eclipse.ui.IWorkbench)2 EditClientRequest (org.yamcs.protobuf.Rest.EditClientRequest)2 ConnectionInfo (org.yamcs.protobuf.Web.ConnectionInfo)2 Statistics (org.yamcs.protobuf.YamcsManagement.Statistics)2 YamcsInstance (org.yamcs.protobuf.YamcsManagement.YamcsInstance)2 InvalidProtocolBufferException (com.google.protobuf.InvalidProtocolBufferException)1 ArrayList (java.util.ArrayList)1 Command (org.eclipse.core.commands.Command)1 ExecutionException (org.eclipse.core.commands.ExecutionException)1 IContributionItem (org.eclipse.jface.action.IContributionItem)1 Separator (org.eclipse.jface.action.Separator)1 TableColumnLayout (org.eclipse.jface.layout.TableColumnLayout)1 ColumnLabelProvider (org.eclipse.jface.viewers.ColumnLabelProvider)1 ColumnPixelData (org.eclipse.jface.viewers.ColumnPixelData)1 ColumnWeightData (org.eclipse.jface.viewers.ColumnWeightData)1