• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java TimestampsToReturn类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.eclipse.milo.opcua.stack.core.types.enumerated.TimestampsToReturn的典型用法代码示例。如果您正苦于以下问题:Java TimestampsToReturn类的具体用法?Java TimestampsToReturn怎么用?Java TimestampsToReturn使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



TimestampsToReturn类属于org.eclipse.milo.opcua.stack.core.types.enumerated包,在下文中一共展示了TimestampsToReturn类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: pollForData

import org.eclipse.milo.opcua.stack.core.types.enumerated.TimestampsToReturn; //导入依赖的package包/类
private void pollForData() {
  if (destroyed) {
    return;
  }
  refreshNodeIds();
  opcUaClient.readValues(0.0, TimestampsToReturn.Both, nodeIds)
      .thenAccept(values -> {
        try {
          process(values, System.currentTimeMillis() + "." + counter.getAndIncrement(), null);
        } catch (Exception ex) {
          LOG.error(Errors.OPC_UA_09.getMessage(), ex.getMessage(), ex);
          errorQueue.offer(new StageException(Errors.OPC_UA_09, ex.getMessage(), ex));
        }
        if (ThreadUtil.sleep(conf.pollingInterval)) {
          pollForData();
        }
      })
      .exceptionally(ex -> {
        LOG.warn(Errors.OPC_UA_12.getMessage(), ex.getMessage());
        reConnect();
        pollForData();
        return null;
      });
}
 
开发者ID:streamsets,项目名称:datacollector,代码行数:25,代码来源:OpcUaClientSource.java


示例2: read

import org.eclipse.milo.opcua.stack.core.types.enumerated.TimestampsToReturn; //导入依赖的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


示例3: testStack

import org.eclipse.milo.opcua.stack.core.types.enumerated.TimestampsToReturn; //导入依赖的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


示例4: historyRead

import org.eclipse.milo.opcua.stack.core.types.enumerated.TimestampsToReturn; //导入依赖的package包/类
@Override
public CompletableFuture<HistoryReadResponse> historyRead(HistoryReadDetails historyReadDetails,
                                                          TimestampsToReturn timestampsToReturn,
                                                          boolean releaseContinuationPoints,
                                                          List<HistoryReadValueId> nodesToRead) {

    return getSession().thenCompose(session -> {
        HistoryReadRequest request = new HistoryReadRequest(
            newRequestHeader(session.getAuthenticationToken()),
            ExtensionObject.encode(historyReadDetails),
            timestampsToReturn,
            releaseContinuationPoints,
            a(nodesToRead, HistoryReadValueId.class));

        return sendRequest(request);
    });
}
 
开发者ID:eclipse,项目名称:milo,代码行数:18,代码来源:OpcUaClient.java


示例5: createMonitoredItems

import org.eclipse.milo.opcua.stack.core.types.enumerated.TimestampsToReturn; //导入依赖的package包/类
@Override
public CompletableFuture<CreateMonitoredItemsResponse> createMonitoredItems(
    UInteger subscriptionId,
    TimestampsToReturn timestampsToReturn,
    List<MonitoredItemCreateRequest> itemsToCreate) {

    return getSession().thenCompose(session -> {
        CreateMonitoredItemsRequest request = new CreateMonitoredItemsRequest(
            newRequestHeader(session.getAuthenticationToken()),
            subscriptionId,
            timestampsToReturn,
            a(itemsToCreate, MonitoredItemCreateRequest.class));

        return sendRequest(request);
    });
}
 
开发者ID:eclipse,项目名称:milo,代码行数:17,代码来源:OpcUaClient.java


示例6: modifyMonitoredItems

import org.eclipse.milo.opcua.stack.core.types.enumerated.TimestampsToReturn; //导入依赖的package包/类
@Override
public CompletableFuture<ModifyMonitoredItemsResponse> modifyMonitoredItems(
    UInteger subscriptionId,
    TimestampsToReturn timestampsToReturn,
    List<MonitoredItemModifyRequest> itemsToModify) {

    return getSession().thenCompose(session -> {
        ModifyMonitoredItemsRequest request = new ModifyMonitoredItemsRequest(
            newRequestHeader(session.getAuthenticationToken()),
            subscriptionId,
            timestampsToReturn,
            a(itemsToModify, MonitoredItemModifyRequest.class));

        return sendRequest(request);
    });
}
 
开发者ID:eclipse,项目名称:milo,代码行数:17,代码来源:OpcUaClient.java


示例7: read

import org.eclipse.milo.opcua.stack.core.types.enumerated.TimestampsToReturn; //导入依赖的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


示例8: createMonitoredItems

import org.eclipse.milo.opcua.stack.core.types.enumerated.TimestampsToReturn; //导入依赖的package包/类
@Override
public CompletableFuture<List<UaMonitoredItem>> createMonitoredItems(
    TimestampsToReturn timestampsToReturn,
    List<MonitoredItemCreateRequest> itemsToCreate,
    ItemCreationCallback itemCreationCallback) {

    return notificationSemaphore.acquire().thenCompose(permit -> {
        CompletableFuture<List<UaMonitoredItem>> itemsFuture =
            createMonitoredItems(timestampsToReturn, itemsToCreate);

        return itemsFuture.whenComplete((items, ex) -> {
            try {
                if (items != null) {
                    for (int i = 0; i < items.size(); i++) {
                        UaMonitoredItem item = items.get(i);

                        itemCreationCallback.onItemCreated(client.getDataTypeManager(), item, i);
                    }
                }
            } finally {
                permit.release();
            }
        });
    });
}
 
开发者ID:eclipse,项目名称:milo,代码行数:26,代码来源:OpcUaSubscription.java


示例9: readAttribute

import org.eclipse.milo.opcua.stack.core.types.enumerated.TimestampsToReturn; //导入依赖的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


示例10: createNode

import org.eclipse.milo.opcua.stack.core.types.enumerated.TimestampsToReturn; //导入依赖的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


示例11: readDataAttributes

import org.eclipse.milo.opcua.stack.core.types.enumerated.TimestampsToReturn; //导入依赖的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


示例12: read

import org.eclipse.milo.opcua.stack.core.types.enumerated.TimestampsToReturn; //导入依赖的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


示例13: MonitoredDataItem

import org.eclipse.milo.opcua.stack.core.types.enumerated.TimestampsToReturn; //导入依赖的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


示例14: MonitoredEventItem

import org.eclipse.milo.opcua.stack.core.types.enumerated.TimestampsToReturn; //导入依赖的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


示例15: BaseMonitoredItem

import org.eclipse.milo.opcua.stack.core.types.enumerated.TimestampsToReturn; //导入依赖的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


示例16: modify

import org.eclipse.milo.opcua.stack.core.types.enumerated.TimestampsToReturn; //导入依赖的package包/类
public synchronized void modify(TimestampsToReturn timestamps,
                                UInteger clientHandle,
                                double samplingInterval,
                                ExtensionObject filter,
                                UInteger queueSize,
                                boolean discardOldest) throws UaException {

    installFilter(filter);

    this.timestamps = timestamps;
    this.clientHandle = clientHandle.longValue();
    this.samplingInterval = samplingInterval;
    this.discardOldest = discardOldest;

    if (queueSize.intValue() != this.queueSize) {
        setQueueSize(queueSize);

        RingBuffer<T> oldQueue = queue;
        queue = new RingBuffer<>(this.queueSize);

        while (oldQueue.size() > 0) {
            enqueue(oldQueue.remove());
        }
    }
}
 
开发者ID:eclipse,项目名称:milo,代码行数:26,代码来源:BaseMonitoredItem.java


示例17: run

import org.eclipse.milo.opcua.stack.core.types.enumerated.TimestampsToReturn; //导入依赖的package包/类
@Override
public void run(OpcUaClient client, CompletableFuture<OpcUaClient> future) throws Exception {
    client.connect().get();

    DataValue dataValue = client.readValue(
        0.0,
        TimestampsToReturn.Neither,
        NodeId.parse("ns=2;s=Demo.Static.Scalar.WorkOrder")
    ).get();

    ExtensionObject xo = (ExtensionObject) dataValue.getValue().getValue();

    // Decoding a struct with custom DataType requires a DataTypeManager
    // that has the codec registered with it. OpcUaClient automatically
    // reads any DataTypeDictionary nodes present in the server upon
    // connecting and dynamically generates codecs for custom structures.
    Object value = xo.decode(client.getDataTypeManager());

    logger.info("value: {}", value);

    future.complete(client);
}
 
开发者ID:eclipse,项目名称:milo,代码行数:23,代码来源:UnifiedAutomationReadCustomDataTypeExample.java


示例18: derivedValue

import org.eclipse.milo.opcua.stack.core.types.enumerated.TimestampsToReturn; //导入依赖的package包/类
/**
 * Derive a new {@link DataValue} from a given {@link DataValue}.
 *
 * @param from       the {@link DataValue} to derive from.
 * @param timestamps the timestamps to return in the derived value.
 * @return a derived {@link DataValue}.
 */
public static DataValue derivedValue(DataValue from, TimestampsToReturn timestamps) {
    boolean includeSource = timestamps == TimestampsToReturn.Source || timestamps == TimestampsToReturn.Both;
    boolean includeServer = timestamps == TimestampsToReturn.Server || timestamps == TimestampsToReturn.Both;

    return new DataValue(
        from.value,
        from.status,
        includeSource ? from.sourceTime : null,
        includeServer ? from.serverTime : null
    );
}
 
开发者ID:eclipse,项目名称:milo,代码行数:19,代码来源:DataValue.java


示例19: derivedNonValue

import org.eclipse.milo.opcua.stack.core.types.enumerated.TimestampsToReturn; //导入依赖的package包/类
/**
 * Derive a new {@link DataValue} from a given {@link DataValue}.
 * <p>
 * The value is assumed to be for a non-value Node attribute, and therefore the source timestamp is not returned.
 *
 * @param from       the {@link DataValue} to derive from.
 * @param timestamps the timestamps to return in the derived value.
 * @return a derived {@link DataValue}.
 */
public static DataValue derivedNonValue(DataValue from, TimestampsToReturn timestamps) {
    boolean includeServer = timestamps == TimestampsToReturn.Server || timestamps == TimestampsToReturn.Both;

    return new DataValue(
        from.value,
        from.status,
        null,
        includeServer ? from.serverTime : null
    );
}
 
开发者ID:eclipse,项目名称:milo,代码行数:20,代码来源:DataValue.java


示例20: decode

import org.eclipse.milo.opcua.stack.core.types.enumerated.TimestampsToReturn; //导入依赖的package包/类
@Override
public CreateMonitoredItemsRequest decode(UaDecoder decoder) throws UaSerializationException {
    RequestHeader requestHeader = (RequestHeader) decoder.readBuiltinStruct("RequestHeader", RequestHeader.class);
    UInteger subscriptionId = decoder.readUInt32("SubscriptionId");
    TimestampsToReturn timestampsToReturn = TimestampsToReturn.from(decoder.readInt32("TimestampsToReturn"));
    MonitoredItemCreateRequest[] itemsToCreate =
        decoder.readBuiltinStructArray(
            "ItemsToCreate",
            MonitoredItemCreateRequest.class
        );

    return new CreateMonitoredItemsRequest(requestHeader, subscriptionId, timestampsToReturn, itemsToCreate);
}
 
开发者ID:eclipse,项目名称:milo,代码行数:14,代码来源:CreateMonitoredItemsRequest.java



注:本文中的org.eclipse.milo.opcua.stack.core.types.enumerated.TimestampsToReturn类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java TestUtilities类代码示例发布时间:2022-05-23
下一篇:
Java RecipientKeyIdentifier类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap