本文整理汇总了Java中org.eclipse.milo.opcua.stack.core.types.structured.ReadValueId类的典型用法代码示例。如果您正苦于以下问题:Java ReadValueId类的具体用法?Java ReadValueId怎么用?Java ReadValueId使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ReadValueId类属于org.eclipse.milo.opcua.stack.core.types.structured包,在下文中一共展示了ReadValueId类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: read
import org.eclipse.milo.opcua.stack.core.types.structured.ReadValueId; //导入依赖的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);
}
开发者ID:ctron,项目名称:milo-ece2017,代码行数:24,代码来源:CustomNamespace.java
示例2: testStack
import org.eclipse.milo.opcua.stack.core.types.structured.ReadValueId; //导入依赖的package包/类
public CompletableFuture<ReadResponse> testStack(NodeId nodeId) {
RequestHeader header = new RequestHeader(
NodeId.NULL_VALUE,
DateTime.now(),
uint(requestHandle.getAndIncrement()),
uint(0),
null,
uint(60000),
null
);
ReadRequest request = new ReadRequest(
header,
0.0,
TimestampsToReturn.Neither,
new ReadValueId[]{
new ReadValueId(
nodeId,
AttributeId.Value.uid(),
null,
null)
}
);
return client.sendRequest(request);
}
开发者ID:eclipse,项目名称:milo,代码行数:27,代码来源:ClientExample.java
示例3: setReadRequestHandler
import org.eclipse.milo.opcua.stack.core.types.structured.ReadValueId; //导入依赖的package包/类
private void setReadRequestHandler(Variant variant) {
server.addRequestHandler(ReadRequest.class, service -> {
ReadRequest request = service.getRequest();
ResponseHeader header = new ResponseHeader(
DateTime.now(),
request.getRequestHeader().getRequestHandle(),
StatusCode.GOOD,
null,
null,
null
);
List<ReadValueId> nodesToRead = l(request.getNodesToRead());
List<DataValue> results = Collections.nCopies(nodesToRead.size(), new DataValue(variant));
ReadResponse response = new ReadResponse(header, a(results, DataValue.class), null);
service.setResponse(response);
});
}
开发者ID:eclipse,项目名称:milo,代码行数:22,代码来源:ClientServerTest.java
示例4: read
import org.eclipse.milo.opcua.stack.core.types.structured.ReadValueId; //导入依赖的package包/类
/**
* This service is used to read one or more attributes of one or more nodes.
*
* @param maxAge the requested max age of the value, in milliseconds. If maxAge is set to 0, the Server
* shall attempt to read a new value from the data source. If maxAge is set to the max
* Int32 value or greater, the Server shall attempt to get a cached value. Negative values
* are invalid for maxAge.
* @param timestampsToReturn the requested {@link TimestampsToReturn}.
* @param nodeIds the {@link NodeId}s identifying the nodes to read.
* @param attributeIds the attribute ids to read, the size and order matching the provided {@link NodeId}s.
* @return a {@link CompletableFuture} containing a list of {@link DataValue}s, the size and order matching the
* provided {@link NodeId}s.
*/
default CompletableFuture<List<DataValue>> read(double maxAge,
TimestampsToReturn timestampsToReturn,
List<NodeId> nodeIds,
List<UInteger> attributeIds) {
if (nodeIds.size() != attributeIds.size()) {
CompletableFuture<List<DataValue>> failed = new CompletableFuture<>();
failed.completeExceptionally(new IllegalArgumentException("nodeIds.size() != attributeIds.size()"));
return failed;
} else {
Stream<ReadValueId> stream = StreamUtils.zip(
nodeIds.stream(), attributeIds.stream(),
(nId, aId) -> new ReadValueId(nId, aId, null, QualifiedName.NULL_VALUE));
return read(maxAge, timestampsToReturn, stream.collect(Collectors.toList()))
.thenApply(r -> l(r.getResults()));
}
}
开发者ID:eclipse,项目名称:milo,代码行数:32,代码来源:AttributeServices.java
示例5: OpcUaMonitoredItem
import org.eclipse.milo.opcua.stack.core.types.structured.ReadValueId; //导入依赖的package包/类
public OpcUaMonitoredItem(
OpcUaClient client,
UInteger clientHandle,
ReadValueId readValueId,
UInteger monitoredItemId,
StatusCode statusCode,
double revisedSamplingInterval,
UInteger revisedQueueSize,
ExtensionObject filterResult,
MonitoringMode monitoringMode,
ExtensionObject monitoringFilter) {
this.client = client;
this.clientHandle = clientHandle;
this.readValueId = readValueId;
this.monitoredItemId = monitoredItemId;
this.statusCode = statusCode;
this.revisedSamplingInterval = revisedSamplingInterval;
this.revisedQueueSize = revisedQueueSize;
this.filterResult = filterResult;
this.monitoringMode = monitoringMode;
this.monitoringFilter = monitoringFilter;
}
开发者ID:eclipse,项目名称:milo,代码行数:24,代码来源:OpcUaMonitoredItem.java
示例6: readAttribute
import org.eclipse.milo.opcua.stack.core.types.structured.ReadValueId; //导入依赖的package包/类
protected CompletableFuture<DataValue> readAttribute(AttributeId attributeId) {
Optional<DataValue> opt =
AttributeId.BASE_NODE_ATTRIBUTES.contains(attributeId) ?
nodeCache.getAttribute(nodeId, attributeId) : Optional.empty();
return opt.map(CompletableFuture::completedFuture).orElseGet(() -> {
ReadValueId readValueId = new ReadValueId(
nodeId, attributeId.uid(), null, QualifiedName.NULL_VALUE);
CompletableFuture<ReadResponse> future =
client.read(0.0, TimestampsToReturn.Both, newArrayList(readValueId));
return future.thenApply(response -> {
DataValue value = l(response.getResults()).get(0);
if (attributeId != AttributeId.Value) {
nodeCache.putAttribute(nodeId, attributeId, value);
}
return value;
});
});
}
开发者ID:eclipse,项目名称:milo,代码行数:24,代码来源:UaNode.java
示例7: createNode
import org.eclipse.milo.opcua.stack.core.types.structured.ReadValueId; //导入依赖的package包/类
@Override
public CompletableFuture<UaNode> createNode(NodeId nodeId) {
ReadValueId readValueId = new ReadValueId(
nodeId, AttributeId.NodeClass.uid(), null, QualifiedName.NULL_VALUE);
CompletableFuture<ReadResponse> future =
client.read(0.0, TimestampsToReturn.Neither, newArrayList(readValueId));
return future.thenCompose(response -> {
DataValue value = l(response.getResults()).get(0);
NodeClass nodeClass = NodeClass.from((Integer) value.getValue().getValue());
if (nodeClass != null) {
client.getNodeCache().putAttribute(nodeId, AttributeId.NodeClass, value);
return completedFuture(createNode(nodeId, nodeClass));
} else {
return failedFuture(new UaException(value.getStatusCode(), "NodeClass was null"));
}
});
}
开发者ID:eclipse,项目名称:milo,代码行数:22,代码来源:DefaultAddressSpace.java
示例8: readDataAttributes
import org.eclipse.milo.opcua.stack.core.types.structured.ReadValueId; //导入依赖的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;
}
开发者ID:eclipse,项目名称:milo,代码行数:19,代码来源:SubscriptionManager.java
示例9: read
import org.eclipse.milo.opcua.stack.core.types.structured.ReadValueId; //导入依赖的package包/类
@Override
public void read(
ReadContext context,
Double maxAge,
TimestampsToReturn timestamps,
List<ReadValueId> readValueIds) {
List<DataValue> results = Lists.newArrayListWithCapacity(readValueIds.size());
for (ReadValueId id : readValueIds) {
ServerNode node = nodeMap.get(id.getNodeId());
DataValue value = (node != null) ?
node.readAttribute(new AttributeContext(context), id.getAttributeId()) :
new DataValue(StatusCodes.Bad_NodeIdUnknown);
results.add(value);
}
context.complete(results);
}
开发者ID:eclipse,项目名称:milo,代码行数:22,代码来源:VendorNamespace.java
示例10: MonitoredDataItem
import org.eclipse.milo.opcua.stack.core.types.structured.ReadValueId; //导入依赖的package包/类
public MonitoredDataItem(
UInteger id,
UInteger subscriptionId,
ReadValueId readValueId,
MonitoringMode monitoringMode,
TimestampsToReturn timestamps,
UInteger clientHandle,
double samplingInterval,
ExtensionObject filter,
UInteger queueSize,
boolean discardOldest) throws UaException {
super(id, subscriptionId, readValueId, monitoringMode,
timestamps, clientHandle, samplingInterval, queueSize, discardOldest);
installFilter(filter);
}
开发者ID:eclipse,项目名称:milo,代码行数:18,代码来源:MonitoredDataItem.java
示例11: MonitoredEventItem
import org.eclipse.milo.opcua.stack.core.types.structured.ReadValueId; //导入依赖的package包/类
public MonitoredEventItem(
UInteger id,
UInteger subscriptionId,
ReadValueId readValueId,
MonitoringMode monitoringMode,
TimestampsToReturn timestamps,
UInteger clientHandle,
double samplingInterval,
UInteger queueSize,
boolean discardOldest,
ExtensionObject filter) throws UaException {
super(id, subscriptionId, readValueId, monitoringMode,
timestamps, clientHandle, samplingInterval, queueSize, discardOldest);
installFilter(filter);
}
开发者ID:eclipse,项目名称:milo,代码行数:18,代码来源:MonitoredEventItem.java
示例12: BaseMonitoredItem
import org.eclipse.milo.opcua.stack.core.types.structured.ReadValueId; //导入依赖的package包/类
protected BaseMonitoredItem(
UInteger id,
UInteger subscriptionId,
ReadValueId readValueId,
MonitoringMode monitoringMode,
TimestampsToReturn timestamps,
UInteger clientHandle,
double samplingInterval,
UInteger queueSize,
boolean discardOldest) {
this.id = id;
this.subscriptionId = subscriptionId;
this.readValueId = readValueId;
this.monitoringMode = monitoringMode;
this.timestamps = timestamps;
this.clientHandle = clientHandle.longValue();
this.samplingInterval = samplingInterval;
this.discardOldest = discardOldest;
setQueueSize(queueSize);
queue = new RingBuffer<>(this.queueSize);
}
开发者ID:eclipse,项目名称:milo,代码行数:25,代码来源:BaseMonitoredItem.java
示例13: getVariants
import org.eclipse.milo.opcua.stack.core.types.structured.ReadValueId; //导入依赖的package包/类
@DataProvider
public Object[][] getVariants() {
return new Object[][]{
{new Variant(true)},
{new Variant((byte) 1)},
{new Variant(ubyte(1))},
{new Variant((short) 1)},
{new Variant(ushort(1))},
{new Variant(1)},
{new Variant(uint(1))},
{new Variant(1L)},
{new Variant(ulong(1L))},
{new Variant(3.14f)},
{new Variant(6.12d)},
{new Variant("hello, world")},
{new Variant(DateTime.now())},
{new Variant(UUID.randomUUID())},
{new Variant(ByteString.of(new byte[]{1, 2, 3, 4}))},
{new Variant(new XmlElement("<tag>hello</tag>"))},
{new Variant(new NodeId(0, 42))},
{new Variant(new ExpandedNodeId(1, 42, "uri", 1))},
{new Variant(StatusCode.GOOD)},
{new Variant(new QualifiedName(0, "QualifiedName"))},
{new Variant(LocalizedText.english("LocalizedText"))},
{new Variant(ExtensionObject.encode(new ReadValueId(NodeId.NULL_VALUE, uint(1), null, new QualifiedName(0, "DataEncoding"))))},
};
}
开发者ID:eclipse,项目名称:milo,代码行数:28,代码来源:ClientServerTest.java
示例14: read
import org.eclipse.milo.opcua.stack.core.types.structured.ReadValueId; //导入依赖的package包/类
@Override
public void read(ReadContext context, Double maxAge, TimestampsToReturn timestamps, List<ReadValueId> readValueIds) {
List<DataValue> results = Lists.newArrayListWithCapacity(readValueIds.size());
for (ReadValueId id : readValueIds) {
ServerNode node = nodeManager.get(id.getNodeId());
if (node != null) {
DataValue value = node.readAttribute(
new AttributeContext(context),
id.getAttributeId(),
timestamps,
id.getIndexRange()
);
if (logger.isTraceEnabled()) {
Variant variant = value.getValue();
Object o = variant != null ? variant.getValue() : null;
logger.trace("Read value={} from attributeId={} of {}",
o, id.getAttributeId(), id.getNodeId());
}
results.add(value);
} else {
results.add(new DataValue(new StatusCode(StatusCodes.Bad_NodeIdUnknown)));
}
}
context.complete(results);
}
开发者ID:eclipse,项目名称:milo,代码行数:31,代码来源:TestNamespace.java
示例15: createItemAndWait
import org.eclipse.milo.opcua.stack.core.types.structured.ReadValueId; //导入依赖的package包/类
private void createItemAndWait(
UaSubscription.NotificationListener notificationListener,
Object notificationLock) throws InterruptedException, ExecutionException {
// create a subscription and a monitored item
UaSubscription subscription = client.getSubscriptionManager().createSubscription(1000.0).get();
subscription.addNotificationListener(notificationListener);
ReadValueId readValueId = new ReadValueId(
Identifiers.Server_ServerStatus_State,
AttributeId.Value.uid(), null, QualifiedName.NULL_VALUE);
MonitoringParameters parameters = new MonitoringParameters(
uint(1), // client handle
1000.0, // sampling interval
null, // no (default) filter
uint(10), // queue size
true); // discard oldest
MonitoredItemCreateRequest request = new MonitoredItemCreateRequest(
readValueId, MonitoringMode.Reporting, parameters);
synchronized (notificationLock) {
subscription.createMonitoredItems(TimestampsToReturn.Both, newArrayList(request)).get();
notificationLock.wait(5000);
}
}
开发者ID:eclipse,项目名称:milo,代码行数:28,代码来源:OpcUaClientIT.java
示例16: testReadDataTypeDictionaryBytes
import org.eclipse.milo.opcua.stack.core.types.structured.ReadValueId; //导入依赖的package包/类
private void testReadDataTypeDictionaryBytes(ByteString dictionary, int fragmentSize) throws Exception {
Mockito
.when(stackClient.<ReadResponse>sendRequest(any(ReadRequest.class)))
.then(invocationOnMock -> {
ReadRequest readRequest = invocationOnMock.getArgument(0);
List<ReadValueId> readValueIds =
Arrays.stream(Objects.requireNonNull(readRequest.getNodesToRead()))
.collect(Collectors.toList());
ReadValueId readValueId = readValueIds.get(0);
NumericRange numericRange = NumericRange.parse(readValueId.getIndexRange());
try {
Object fragment = NumericRange.readFromValueAtRange(new Variant(dictionary), numericRange);
return completedFuture(new ReadResponse(
null,
new DataValue[]{new DataValue(new Variant(fragment))},
null
));
} catch (UaException e) {
return completedFuture(new ReadResponse(
null,
new DataValue[]{new DataValue(e.getStatusCode())},
null
));
}
});
ByteString typeDictionaryBs = dictionaryReader.readDataTypeDictionaryBytes(
NodeId.NULL_VALUE,
fragmentSize
).get();
assertEquals(typeDictionaryBs, dictionary);
}
开发者ID:eclipse,项目名称:milo,代码行数:39,代码来源:DataTypeDictionaryReaderTest.java
示例17: read
import org.eclipse.milo.opcua.stack.core.types.structured.ReadValueId; //导入依赖的package包/类
@Override
public CompletableFuture<ReadResponse> read(double maxAge,
TimestampsToReturn timestampsToReturn,
List<ReadValueId> readValueIds) {
return getSession().thenCompose(session -> {
ReadRequest request = new ReadRequest(
newRequestHeader(session.getAuthenticationToken()),
maxAge,
timestampsToReturn,
a(readValueIds, ReadValueId.class));
return sendRequest(request);
});
}
开发者ID:eclipse,项目名称:milo,代码行数:16,代码来源:OpcUaClient.java
示例18: readDataTypeDescriptionValues
import org.eclipse.milo.opcua.stack.core.types.structured.ReadValueId; //导入依赖的package包/类
private CompletableFuture<List<String>> readDataTypeDescriptionValues(List<NodeId> nodeIds) {
CompletableFuture<UInteger> maxNodesPerRead = readNode(
new ReadValueId(
Identifiers.Server_ServerCapabilities_OperationLimits_MaxNodesPerRead,
AttributeId.Value.uid(),
null,
QualifiedName.NULL_VALUE
)
).thenApply(dv -> (UInteger) dv.getValue().getValue());
CompletableFuture<Integer> getPartitionSize = maxNodesPerRead
.thenApply(m -> Math.max(1, Ints.saturatedCast(m.longValue())))
.exceptionally(ex -> PARTITION_SIZE);
return getPartitionSize.thenCompose(partitionSize -> {
List<List<NodeId>> partitions = Lists.partition(nodeIds, partitionSize);
CompletableFuture<List<List<DataValue>>> sequence = FutureUtils.sequence(
partitions.stream().map(list -> {
List<ReadValueId> readValueIds = list.stream()
.map(nodeId ->
new ReadValueId(
nodeId,
AttributeId.Value.uid(),
null,
QualifiedName.NULL_VALUE))
.collect(Collectors.toList());
return readNodes(readValueIds);
})
);
return sequence.thenApply(values ->
values.stream()
.flatMap(List::stream)
.map(v -> (String) v.getValue().getValue())
.collect(Collectors.toList())
);
});
}
开发者ID:eclipse,项目名称:milo,代码行数:41,代码来源:DataTypeDictionaryReader.java
示例19: readNodes
import org.eclipse.milo.opcua.stack.core.types.structured.ReadValueId; //导入依赖的package包/类
private CompletableFuture<List<DataValue>> readNodes(List<ReadValueId> readValueIds) {
RequestHeader requestHeader = stackClient.newRequestHeader(
session.getAuthenticationToken(),
uint(60000)
);
ReadRequest readRequest = new ReadRequest(
requestHeader,
0.0,
TimestampsToReturn.Neither,
readValueIds.toArray(new ReadValueId[0])
);
return stackClient.<ReadResponse>sendRequest(readRequest).thenApply(r -> l(r.getResults()));
}
开发者ID:eclipse,项目名称:milo,代码行数:16,代码来源:DataTypeDictionaryReader.java
示例20: ReadContext
import org.eclipse.milo.opcua.stack.core.types.structured.ReadValueId; //导入依赖的package包/类
public ReadContext(OpcUaServer server,
@Nullable Session session,
CompletableFuture<List<DataValue>> future,
DiagnosticsContext<ReadValueId> diagnosticsContext) {
super(server, session, future, diagnosticsContext);
}
开发者ID:eclipse,项目名称:milo,代码行数:8,代码来源:AttributeManager.java
注:本文中的org.eclipse.milo.opcua.stack.core.types.structured.ReadValueId类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论