本文整理汇总了Java中org.eclipse.milo.opcua.stack.core.types.builtin.DataValue类的典型用法代码示例。如果您正苦于以下问题:Java DataValue类的具体用法?Java DataValue怎么用?Java DataValue使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DataValue类属于org.eclipse.milo.opcua.stack.core.types.builtin包,在下文中一共展示了DataValue类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onSubscriptionValue
import org.eclipse.milo.opcua.stack.core.types.builtin.DataValue; //导入依赖的package包/类
private void onSubscriptionValue(UaMonitoredItem item, DataValue dataValue) {
log.debug("Subscription value received: item={}, value={}",
item.getReadValueId().getNodeId(), dataValue.getValue());
NodeId tagId = item.getReadValueId().getNodeId();
devicesByTags.getOrDefault(tagId, Collections.emptyList()).forEach(
device -> {
device.updateTag(tagId, dataValue);
List<KvEntry> attributes = device.getAffectedAttributes(tagId, dataValue);
if (attributes.size() > 0) {
gateway.onDeviceAttributesUpdate(device.getDeviceName(), attributes);
}
List<TsKvEntry> timeseries = device.getAffectedTimeseries(tagId, dataValue);
if (timeseries.size() > 0) {
gateway.onDeviceTelemetry(device.getDeviceName(), timeseries);
}
}
);
}
示例2: dumpValues
import org.eclipse.milo.opcua.stack.core.types.builtin.DataValue; //导入依赖的package包/类
public static void dumpValues(final PrintStream out, final List<NodeId> nodeIds, final List<DataValue> values) {
final int len = Integer.max(nodeIds.size(), values.size());
final List<List<String>> data = new ArrayList<>(len);
for (int i = 0; i < Integer.min(nodeIds.size(), values.size()); i++) {
final List<String> row = new ArrayList<>(5);
data.add(row);
final DataValue value = values.get(i);
row.add(nodeIds.get(i).toParseableString());
row.add(toString(value.getValue()));
row.add(toString(value.getStatusCode()));
row.add(TIMESTAMP_FORMATTER.format(value.getServerTime().getJavaDate().toInstant()));
row.add(TIMESTAMP_FORMATTER.format(value.getSourceTime().getJavaDate().toInstant()));
}
Tables.showTable(out,
Arrays.asList("Node Id", "Value", "State", "Timestamp(Server)", "Timestamp(Source)"),
data,
2);
System.out.println();
}
示例3: read
import org.eclipse.milo.opcua.stack.core.types.builtin.DataValue; //导入依赖的package包/类
@Override
public void read(
final ReadContext context,
final Double maxAge,
final TimestampsToReturn timestamps,
final List<ReadValueId> readValueIds) {
final List<DataValue> results = new ArrayList<>(readValueIds.size());
for (final ReadValueId id : readValueIds) {
final ServerNode node = this.nodeMap.get(id.getNodeId());
final DataValue value = node != null
? node.readAttribute(new AttributeContext(context), id.getAttributeId())
: new DataValue(StatusCodes.Bad_NodeIdUnknown);
results.add(value);
}
// report back with result
context.complete(results);
}
示例4: VariableTypeNodeAttributes
import org.eclipse.milo.opcua.stack.core.types.builtin.DataValue; //导入依赖的package包/类
public VariableTypeNodeAttributes(
NodeId nodeId,
QualifiedName browseName,
LocalizedText displayName,
LocalizedText description,
UInteger writeMask,
UInteger userWriteMask,
DataValue value,
NodeId dataType,
int valueRank,
UInteger[] arrayDimensions,
boolean isAbstract) {
super(nodeId, NodeClass.VariableType, browseName, displayName, description, writeMask, userWriteMask);
this.value = value;
this.dataType = dataType;
this.valueRank = valueRank;
this.arrayDimensions = arrayDimensions;
this.isAbstract = isAbstract;
}
示例5: parseValue
import org.eclipse.milo.opcua.stack.core.types.builtin.DataValue; //导入依赖的package包/类
public static DataValue parseValue(Object value, Marshaller marshaller) {
JAXBElement<?> jaxbElement = JAXBElement.class.cast(value);
StringWriter sw = new StringWriter();
try {
marshaller.marshal(jaxbElement, sw);
} catch (JAXBException e) {
LOGGER.warn("unable to marshal JAXB element: " + jaxbElement, e);
return new DataValue(Variant.NULL_VALUE);
}
String xmlString = sw.toString();
try {
XmlDecoder xmlDecoder = new XmlDecoder(new StringReader(xmlString));
Object valueObject = xmlDecoder.decodeVariantValue();
return new DataValue(new Variant(valueObject));
} catch (Throwable t) {
LOGGER.warn("unable to parse Value: " + xmlString, t);
return new DataValue(Variant.NULL_VALUE);
}
}
示例6: buildNode680
import org.eclipse.milo.opcua.stack.core.types.builtin.DataValue; //导入依赖的package包/类
private void buildNode680()
throws Exception {
UaVariableNode node = new BuildInfoNode(this.nodeMap, NodeId.parse("ns=0;i=2260"), new QualifiedName(0, "BuildInfo"), new LocalizedText("en", "BuildInfo"), LocalizedText.NULL_VALUE, UInteger.valueOf(0L), UInteger.valueOf(0L), new DataValue(Variant.NULL_VALUE), NodeId.parse("ns=0;i=338"), -1, new UInteger[]{}, UByte.valueOf(1), UByte.valueOf(1), 0.0D, false);
node.addReference(new Reference(NodeId.parse("ns=0;i=2260"), NodeId.parse("ns=0;i=47"), ExpandedNodeId.parse("svr=0;i=2256"), NodeClass.Variable, false));
node.addReference(new Reference(NodeId.parse("ns=0;i=2260"), NodeId.parse("ns=0;i=47"), ExpandedNodeId.parse("svr=0;i=2262"), NodeClass.Variable, true));
node.addReference(new Reference(NodeId.parse("ns=0;i=2260"), NodeId.parse("ns=0;i=47"), ExpandedNodeId.parse("svr=0;i=2263"), NodeClass.Variable, true));
node.addReference(new Reference(NodeId.parse("ns=0;i=2260"), NodeId.parse("ns=0;i=47"), ExpandedNodeId.parse("svr=0;i=2261"), NodeClass.Variable, true));
node.addReference(new Reference(NodeId.parse("ns=0;i=2260"), NodeId.parse("ns=0;i=47"), ExpandedNodeId.parse("svr=0;i=2264"), NodeClass.Variable, true));
node.addReference(new Reference(NodeId.parse("ns=0;i=2260"), NodeId.parse("ns=0;i=47"), ExpandedNodeId.parse("svr=0;i=2265"), NodeClass.Variable, true));
node.addReference(new Reference(NodeId.parse("ns=0;i=2260"), NodeId.parse("ns=0;i=47"), ExpandedNodeId.parse("svr=0;i=2266"), NodeClass.Variable, true));
node.addReference(new Reference(NodeId.parse("ns=0;i=2260"), NodeId.parse("ns=0;i=40"), ExpandedNodeId.parse("svr=0;i=3051"), NodeClass.VariableType, true));
node.addReference(new Reference(NodeId.parse("ns=0;i=2260"), NodeId.parse("ns=0;i=47"), ExpandedNodeId.parse("svr=0;i=2256"), NodeClass.Variable, false));
node.addReference(new Reference(NodeId.parse("ns=0;i=2260"), NodeId.parse("ns=0;i=47"), ExpandedNodeId.parse("svr=0;i=2262"), NodeClass.Variable, true));
node.addReference(new Reference(NodeId.parse("ns=0;i=2260"), NodeId.parse("ns=0;i=47"), ExpandedNodeId.parse("svr=0;i=2263"), NodeClass.Variable, true));
node.addReference(new Reference(NodeId.parse("ns=0;i=2260"), NodeId.parse("ns=0;i=47"), ExpandedNodeId.parse("svr=0;i=2261"), NodeClass.Variable, true));
node.addReference(new Reference(NodeId.parse("ns=0;i=2260"), NodeId.parse("ns=0;i=47"), ExpandedNodeId.parse("svr=0;i=2264"), NodeClass.Variable, true));
node.addReference(new Reference(NodeId.parse("ns=0;i=2260"), NodeId.parse("ns=0;i=47"), ExpandedNodeId.parse("svr=0;i=2265"), NodeClass.Variable, true));
node.addReference(new Reference(NodeId.parse("ns=0;i=2260"), NodeId.parse("ns=0;i=47"), ExpandedNodeId.parse("svr=0;i=2266"), NodeClass.Variable, true));
this.nodeMap.addNode(node);
}
示例7: readDataAttributes
import org.eclipse.milo.opcua.stack.core.types.builtin.DataValue; //导入依赖的package包/类
private CompletableFuture<List<DataValue>> readDataAttributes(Session session, Namespace namespace, NodeId itemId) {
Function<AttributeId, ReadValueId> f = id ->
new ReadValueId(itemId, id.uid(), null, QualifiedName.NULL_VALUE);
CompletableFuture<List<DataValue>> future = new CompletableFuture<>();
ReadContext readContext = new ReadContext(
server, session, future, new DiagnosticsContext<>());
List<ReadValueId> attributes = newArrayList(
f.apply(AttributeId.AccessLevel),
f.apply(AttributeId.UserAccessLevel),
f.apply(AttributeId.MinimumSamplingInterval));
namespace.read(readContext, 0.0, TimestampsToReturn.Neither, attributes);
return future;
}
示例8: setViewAttribute
import org.eclipse.milo.opcua.stack.core.types.builtin.DataValue; //导入依赖的package包/类
default void setViewAttribute(
AttributeContext context,
ViewNode node,
AttributeId attributeId,
DataValue value) throws UaException {
switch (attributeId) {
case ContainsNoLoops:
setContainsNoLoops(context, node, AttributeUtil.extract(value));
break;
case EventNotifier:
setEventNotifier(context, node, AttributeUtil.extract(value));
break;
default:
setBaseAttribute(context, node, attributeId, value);
}
}
示例9: getAffectedAttributes
import org.eclipse.milo.opcua.stack.core.types.builtin.DataValue; //导入依赖的package包/类
public List<KvEntry> getAffectedAttributes(NodeId tagId, DataValue dataValue) {
List<AttributesMapping> attributes = getAttributesMapping(tagId);
if (attributes.size() > 0) {
return getKvEntries(attributes);
} else {
return Collections.emptyList();
}
}
示例10: getAffectedTimeseries
import org.eclipse.milo.opcua.stack.core.types.builtin.DataValue; //导入依赖的package包/类
public List<TsKvEntry> getAffectedTimeseries(NodeId tagId, DataValue dataValue) {
List<AttributesMapping> attributes = getAttributesMapping(tagId);
if (attributes.size() > 0) {
return getKvEntries(attributes).stream()
.map(kv -> new BasicTsKvEntry(dataValue.getSourceTime().getJavaTime(), kv))
.collect(Collectors.toList());
} else {
return Collections.emptyList();
}
}
示例11: read
import org.eclipse.milo.opcua.stack.core.types.builtin.DataValue; //导入依赖的package包/类
public static CompletableFuture<List<DataValue>> read(
final OpcUaClient client,
final AttributeId attributeId,
final NodeId... nodeIds) {
return client
.read(
0,
Both,
asList(nodeIds),
nCopies(nodeIds.length, attributeId.uid()));
}
示例12: write
import org.eclipse.milo.opcua.stack.core.types.builtin.DataValue; //导入依赖的package包/类
public static CompletableFuture<StatusCode> write(
final OpcUaClient client,
final NodeId nodeId,
final Object value) {
return client.writeValue(nodeId, new DataValue(new Variant(value)));
}
示例13: VariableNodeAttributes
import org.eclipse.milo.opcua.stack.core.types.builtin.DataValue; //导入依赖的package包/类
public VariableNodeAttributes(
NodeId nodeId,
QualifiedName browseName,
LocalizedText displayName,
LocalizedText description,
UInteger writeMask,
UInteger userWriteMask,
DataValue value,
NodeId dataType,
int valueRank,
UInteger[] arrayDimensions,
UByte accessLevel,
UByte userAccessLevel,
Double minimumSamplingInterval,
boolean historizing) {
super(nodeId, NodeClass.Variable, browseName, displayName, description, writeMask, userWriteMask);
this.value = value;
this.dataType = dataType;
this.valueRank = valueRank;
this.arrayDimensions = arrayDimensions;
this.accessLevel = accessLevel;
this.userAccessLevel = userAccessLevel;
this.minimumSamplingInterval = minimumSamplingInterval;
this.historizing = historizing;
}
示例14: buildNode587
import org.eclipse.milo.opcua.stack.core.types.builtin.DataValue; //导入依赖的package包/类
private void buildNode587()
throws Exception {
UaVariableNode node = new PropertyNode(this.nodeMap, NodeId.parse("ns=0;i=2103"), new QualifiedName(0, "NewValue"), new LocalizedText("en", "NewValue"), LocalizedText.NULL_VALUE, UInteger.valueOf(0L), UInteger.valueOf(0L), new DataValue(Variant.NULL_VALUE), NodeId.parse("ns=0;i=24"), -1, new UInteger[]{}, UByte.valueOf(1), UByte.valueOf(1), 0.0D, false);
node.addReference(new Reference(NodeId.parse("ns=0;i=2103"), NodeId.parse("ns=0;i=46"), ExpandedNodeId.parse("svr=0;i=2100"), NodeClass.ObjectType, false));
node.addReference(new Reference(NodeId.parse("ns=0;i=2103"), NodeId.parse("ns=0;i=40"), ExpandedNodeId.parse("svr=0;i=68"), NodeClass.VariableType, true));
node.addReference(new Reference(NodeId.parse("ns=0;i=2103"), NodeId.parse("ns=0;i=37"), ExpandedNodeId.parse("svr=0;i=78"), NodeClass.Object, true));
node.addReference(new Reference(NodeId.parse("ns=0;i=2103"), NodeId.parse("ns=0;i=46"), ExpandedNodeId.parse("svr=0;i=2100"), NodeClass.ObjectType, false));
this.nodeMap.addNode(node);
}
示例15: buildNode590
import org.eclipse.milo.opcua.stack.core.types.builtin.DataValue; //导入依赖的package包/类
private void buildNode590()
throws Exception {
UaVariableNode node = new PropertyNode(this.nodeMap, NodeId.parse("ns=0;i=2129"), new QualifiedName(0, "InputArguments"), new LocalizedText("en", "InputArguments"), LocalizedText.NULL_VALUE, UInteger.valueOf(0L), UInteger.valueOf(0L), new DataValue(Variant.NULL_VALUE), NodeId.parse("ns=0;i=24"), 1, new UInteger[]{}, UByte.valueOf(1), UByte.valueOf(1), 0.0D, false);
node.addReference(new Reference(NodeId.parse("ns=0;i=2129"), NodeId.parse("ns=0;i=46"), ExpandedNodeId.parse("svr=0;i=2127"), NodeClass.ObjectType, false));
node.addReference(new Reference(NodeId.parse("ns=0;i=2129"), NodeId.parse("ns=0;i=40"), ExpandedNodeId.parse("svr=0;i=68"), NodeClass.VariableType, true));
node.addReference(new Reference(NodeId.parse("ns=0;i=2129"), NodeId.parse("ns=0;i=37"), ExpandedNodeId.parse("svr=0;i=78"), NodeClass.Object, true));
node.addReference(new Reference(NodeId.parse("ns=0;i=2129"), NodeId.parse("ns=0;i=46"), ExpandedNodeId.parse("svr=0;i=2127"), NodeClass.ObjectType, false));
this.nodeMap.addNode(node);
}