1
2
3
4
5 package org.epics.pvmanager.jca;
6
7 import gov.aps.jca.dbr.DBR_TIME_Byte;
8 import gov.aps.jca.dbr.DBR_TIME_String;
9 import org.epics.vtype.VString;
10 import org.epics.vtype.VTypeToString;
11
12
13
14
15
16 class VStringFromDbr extends VMetadata<DBR_TIME_String> implements VString {
17
18 public VStringFromDbr(DBR_TIME_String dbrValue, JCAConnectionPayload connPayload) {
19 super(dbrValue, connPayload);
20 }
21
22 VStringFromDbr(DBR_TIME_Byte dbrValue, JCAConnectionPayload JCAConnectionPayload) {
23 this(convert(dbrValue), JCAConnectionPayload);
24 }
25
26 private static DBR_TIME_String convert(DBR_TIME_Byte dbrValue) {
27 DBR_TIME_String converted = new DBR_TIME_String(new String[] {JCAChannelHandler.toString(dbrValue.getByteValue())});
28 converted.setTimeStamp(dbrValue.getTimeStamp());
29 converted.setStatus(dbrValue.getStatus());
30 converted.setSeverity(dbrValue.getSeverity());
31 return converted;
32 }
33
34 @Override
35 public String getValue() {
36 return dbrValue.getStringValue()[0];
37 }
38
39 @Override
40 public String toString() {
41 return VTypeToString.toString(this);
42 }
43
44 }