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));
}
}
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);
}
});
}
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;
}
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;
}
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;
}
Aggregations