use of org.yamcs.protobuf.Mdb.AlarmInfo 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