use of org.yamcs.protobuf.Yamcs.NamedObjectId in project yamcs-studio by yamcs.
the class ParameterSubscriptionBundler method run.
@Override
public void run() {
if (!yamcsClient.isConnected()) {
return;
}
ParameterWebSocketRequest a;
while ((a = pendingMessages.poll()) != null) {
while (pendingMessages.peek() != null && isMergeable(a, pendingMessages.peek())) {
ParameterWebSocketRequest b = pendingMessages.poll();
a.merge(b);
}
CompletableFuture<WebSocketReplyData> future = yamcsClient.getWebSocketClient().sendRequest(a);
future.whenComplete((reply, exc) -> {
if (exc != null) {
log.log(Level.SEVERE, "Server exception while subscribing to parameters", exc);
} else {
try {
ParameterSubscriptionResponse response = ParameterSubscriptionResponse.parseFrom(reply.getData());
for (NamedObjectId id : response.getInvalidList()) {
log.fine("No parameter for id " + id);
}
} catch (InvalidProtocolBufferException e) {
log.log(Level.WARNING, "Failed to decode parameter subscription response", e);
}
}
});
}
}
use of org.yamcs.protobuf.Yamcs.NamedObjectId in project yamcs-studio by yamcs.
the class PVComposite method createYamcsProperties.
private void createYamcsProperties(ParameterInfo pinfo) {
createKeyValueTextPair("Yamcs Data Source", capitalize(pinfo.getDataSource().toString()));
createKeyValueTextPair("Qualified Name", pinfo.getQualifiedName());
for (int i = 0; i < pinfo.getAliasCount(); i++) {
NamedObjectId alias = pinfo.getAlias(i);
String key = (i == 0) ? "Aliases" : null;
createKeyValueTextPair(key, alias.getNamespace() + "; " + alias.getName());
}
if (pinfo.hasShortDescription()) {
createKeyValueTextPair("Short Description", pinfo.getShortDescription());
}
if (pinfo.hasLongDescription()) {
createKeyValueTextPair("Long Description", pinfo.getLongDescription());
}
createSeparator();
createHeader("MDB");
ParameterTypeInfo type = pinfo.getType();
createKeyValueTextPair("Data Encoding", capitalize(type.getDataEncoding().getType().toString()));
createKeyValueTextPair("Engineering Type", capitalize(type.getEngType()));
if (type.getUnitSetCount() > 0) {
String units = "";
for (UnitInfo unit : type.getUnitSetList()) {
units += unit.getUnit() + " ";
}
createKeyValueTextPair("Units", units);
}
if (type.getDefaultAlarm() != null && type.getDefaultAlarm().getStaticAlarmRangeCount() > 0) {
createSeparator();
createHeader("Default Alarm");
AlarmInfo defaultAlarm = type.getDefaultAlarm();
createKeyValueTextPair("Min. Violations", "" + defaultAlarm.getMinViolations());
// Backwards for lower limits
for (int i = defaultAlarm.getStaticAlarmRangeCount() - 1; i >= 0; i--) {
AlarmRange range = defaultAlarm.getStaticAlarmRange(i);
if (range.hasMinInclusive()) {
String label = capitalize(range.getLevel().toString()) + " Low";
String limit = new DecimalFormat("#.############").format(range.getMinInclusive());
createKeyValueTextPair(label, limit);
}
}
// Now forwards for upper limits
for (AlarmRange range : defaultAlarm.getStaticAlarmRangeList()) {
if (range.hasMaxInclusive()) {
String label = capitalize(range.getLevel().toString()) + " High";
String limit = new DecimalFormat("#.############").format(range.getMaxInclusive());
createKeyValueTextPair(label, limit);
}
}
}
createSeparator();
createHeader("Last Received Value");
// Anybody knows better way to reserve space??
gentimeField = createKeyValueTextPair("Generation Time", "--- ");
rectimeField = createKeyValueTextPair("Reception Time", "--- ");
statusField = createKeyValueTextPair("Status", "--- ");
engValueField = createKeyValueTextPair("Engineering Value", "--- ");
engTypeField = createKeyValueTextPair("Engineering Type", "--- ");
rawValueField = createKeyValueTextPair("Raw Value", "--- ");
rawTypeField = createKeyValueTextPair("Raw Type", "--- ");
}
Aggregations