当前位置: 首页>>代码示例>>C#>>正文


C# Session.HistoryRead方法代码示例

本文整理汇总了C#中Opc.Ua.Client.Session.HistoryRead方法的典型用法代码示例。如果您正苦于以下问题:C# Session.HistoryRead方法的具体用法?C# Session.HistoryRead怎么用?C# Session.HistoryRead使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Opc.Ua.Client.Session的用法示例。


在下文中一共展示了Session.HistoryRead方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ReadNext

        /// <summary>
        /// Reads the next batch of values from the server.
        /// </summary>
        private bool ReadNext(
            Session session,
            ExtensionObject details,
            List<HdaReadRequest> requests,
            bool releaseContinuationPoints)
        {
            // get the value.
            HistoryReadValueIdCollection nodesToRead = new HistoryReadValueIdCollection();

            for (int ii = 0; ii < requests.Count; ii++)
            {
                HdaReadRequest request = requests[ii];

                if (request.IsComplete || request.Error < 0)
                {
                    continue;
                }

                if (NodeId.IsNull(request.NodeId))
                {
                    request.Error = ResultIds.S_NODATA;
                    continue;
                }

                HistoryReadValueId nodeToRead = new HistoryReadValueId();
                nodeToRead.NodeId = request.NodeId;
                nodeToRead.ContinuationPoint = request.ContinuationPoint;
                nodeToRead.Handle = request;
                nodesToRead.Add(nodeToRead);
            }

            // check if something to do.
            if (nodesToRead.Count == 0)
            {
                return false;
            }

            HistoryReadResultCollection results = null;
            DiagnosticInfoCollection diagnosticInfos = null;

            session.HistoryRead(
                null,
                details,
                TimestampsToReturn.Source,
                releaseContinuationPoints,
                nodesToRead,
                out results,
                out diagnosticInfos);

            Session.ValidateResponse(results, nodesToRead);
            Session.ValidateDiagnosticInfos(diagnosticInfos, nodesToRead);

            // check if nothing more to do.
            if (releaseContinuationPoints)
            {
                return false;
            }

            // process results.
            bool continuationPoints = false;

            for (int ii = 0; ii < nodesToRead.Count; ii++)
            {
                HdaReadRequest request = (HdaReadRequest)nodesToRead[ii].Handle;

                if (request.Values == null)
                {
                    request.Values = new List<DaValue>();
                }

                request.Error = ProcessReadResults(
                    session, 
                    results[ii], 
                    request.AttributeId, 
                    request.Values, 
                    request.ModificationInfos);
                
                request.ContinuationPoint = results[ii].ContinuationPoint;

                // check if continuation point provided.
                if (request.ContinuationPoint != null && request.ContinuationPoint.Length > 0)
                {
                    request.Error = ResultIds.S_MOREDATA;
                    continuationPoints = true;
                }
                else
                {
                    request.IsComplete = true;
                }
            }

            return continuationPoints;
        }
开发者ID:OPCFoundation,项目名称:UA-.NET,代码行数:96,代码来源:ComHdaProxy.cs


注:本文中的Opc.Ua.Client.Session.HistoryRead方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。