diff --git a/app/pvtable/src/main/java/org/phoebus/applications/pvtable/model/PVTableItem.java b/app/pvtable/src/main/java/org/phoebus/applications/pvtable/model/PVTableItem.java
index d9f8f4b009..f099be879c 100644
--- a/app/pvtable/src/main/java/org/phoebus/applications/pvtable/model/PVTableItem.java
+++ b/app/pvtable/src/main/java/org/phoebus/applications/pvtable/model/PVTableItem.java
@@ -20,6 +20,7 @@
import org.epics.vtype.AlarmStatus;
import org.epics.vtype.Display;
import org.epics.vtype.DisplayProvider;
+import org.epics.vtype.DescriptionProvider;
import org.epics.vtype.EnumDisplay;
import org.epics.vtype.Time;
import org.epics.vtype.VBoolean;
@@ -83,9 +84,9 @@ public class PVTableItem
/** Listener to description PV */
private volatile Disposable desc_flow;
-
+
private volatile String[] valueOptions = null;
-
+
private static final String DESC_FIELD = "DESC";
private static final String DOT = ".";
@@ -178,7 +179,7 @@ private void createPVs(final String name)
// Determine DESC field include dot in case of variable name such as variableEGUName
desc_name = name.replace(DOT + fieldVal, DOT + DESC_FIELD);
}
-
+
try
{
final PV new_desc_pv = PVPool.getPV(desc_name);
@@ -200,31 +201,15 @@ private void createPVs(final String name)
}
}
}
-
+
private void updateDescription() {
- if(desc_value == null) {
- //update description from value or pv
- VType currentValue = getValue();
- if(currentValue != null) {
- String description = null;
- // DisplayProvider is an optional interface for VType values,
- // not PVs, but the custum datasource as Muscade happens to implement
- // DisplayProvider for enum and bool PVs, so check for that here
- Display display = currentValue instanceof DisplayProvider ? ((DisplayProvider) currentValue).getDisplay(): null;
- if(display == null && currentValue instanceof VEnum){
- EnumDisplay enumdisplay = ((VEnum) currentValue).getDisplay();
- if(enumdisplay instanceof DisplayProvider){
- display = ((DisplayProvider)enumdisplay).getDisplay();
- }
- }
- if (display != null) {
- description = display.getDescription();
- }
- desc_value = description != null ? description : null;
- desc_name = desc_value != null ? "Description of " + name + " PV" : "no description";
- desc_flow = value_flow;
- }
- }
+ desc_value = switch (getValue()) {
+ case VEnum vEnum when vEnum.getDisplay() instanceof DescriptionProvider descriptionProvider -> descriptionProvider.getDescription().orElse("");
+ case DescriptionProvider descriptionProvider -> descriptionProvider.getDescription().orElse("");
+ default -> "";
+ };
+ desc_name = desc_value != null ? "Description of " + name + " PV" : "no description";
+ desc_flow = value_flow;
}
/** @return true if item is selected to be restored */
@@ -295,7 +280,7 @@ public String getDescription() {
updateDescription();
return desc_value == null ? "" : desc_value;
}
-
+
/** @return description pv name **/
public String getDescriptionName() {
return desc_name;
@@ -320,7 +305,7 @@ else if(copy instanceof VBoolean) {
}
return valueOptions;
}
-
+
/** @return index in case of Enum value */
public int getIndex() {
int index = - 1;
diff --git a/core/pv-pva/src/main/java/org/phoebus/pv/pva/Decoders.java b/core/pv-pva/src/main/java/org/phoebus/pv/pva/Decoders.java
index e5a4a559bf..b8a3b3593e 100644
--- a/core/pv-pva/src/main/java/org/phoebus/pv/pva/Decoders.java
+++ b/core/pv-pva/src/main/java/org/phoebus/pv/pva/Decoders.java
@@ -13,6 +13,7 @@
import java.time.Instant;
import java.util.Arrays;
import java.util.Map;
+import java.util.Optional;
import java.util.concurrent.ConcurrentHashMap;
import org.epics.pva.data.PVAArray;
@@ -33,6 +34,7 @@
import org.epics.pva.data.PVAString;
import org.epics.pva.data.PVAStringArray;
import org.epics.pva.data.PVAStructure;
+import org.epics.pvdata.pv.PVStructure;
import org.epics.util.array.ArrayByte;
import org.epics.util.array.ArrayDouble;
import org.epics.util.array.ArrayFloat;
@@ -243,6 +245,20 @@ public Number parse(String source, ParsePosition parsePosition)
}
}
+ private static Optional decodeDescription(final PVAStructure struct) {
+ if (struct.get("display") instanceof PVAStructure display) {
+ if (display.get("description") instanceof PVAString pvaString) {
+ return Optional.ofNullable(pvaString.get());
+ }
+ else {
+ return Optional.empty();
+ }
+ }
+ else {
+ return Optional.empty();
+ }
+ }
+
private static Display decodeDisplay(final PVAStructure struct)
{
String units;
@@ -341,7 +357,7 @@ private static Display decodeDisplay(final PVAStructure struct)
*/
public static VType decodeBool(PVAStructure struct, PVABool field)
{
- return VBoolean.of(field.get(), decodeAlarm(struct), decodeTime(struct));
+ return VBoolean.of(field.get(), decodeAlarm(struct), decodeTime(struct), decodeDescription(struct));
}
/** @param struct Structure
@@ -350,7 +366,7 @@ public static VType decodeBool(PVAStructure struct, PVABool field)
*/
public static VType decodeString(PVAStructure struct, PVAString field)
{
- return VString.of(field.get(), decodeAlarm(struct), decodeTime(struct));
+ return VString.of(field.get(), decodeAlarm(struct), decodeTime(struct), decodeDescription(struct));
}
/** @param struct Structure for enum
@@ -366,7 +382,7 @@ public static VEnum decodeEnum(final PVAStructure struct) throws Exception
final int value = ((PVAInt)section.get("index")).get();
final PVAStringArray choices = section.get("choices");
- return VEnum.of(value, EnumDisplay.of(choices.get()), alarm, time);
+ return VEnum.of(value, EnumDisplay.of(choices.get()), alarm, time, decodeDescription(struct));
}
/** @param struct Structure
diff --git a/pom.xml b/pom.xml
index 060b046f3d..b9b89f019b 100644
--- a/pom.xml
+++ b/pom.xml
@@ -67,7 +67,7 @@
2026-10-06T19:17:33Z
7.0.11
1.0.8
- 1.0.8
+ 1.0.9-SNAPSHOT
25.0.4