當前位置: 首頁>>代碼示例>>C#>>正文


C# NodeId.ToString方法代碼示例

本文整理匯總了C#中Opc.Ua.NodeId.ToString方法的典型用法代碼示例。如果您正苦於以下問題:C# NodeId.ToString方法的具體用法?C# NodeId.ToString怎麽用?C# NodeId.ToString使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Opc.Ua.NodeId的用法示例。


在下文中一共展示了NodeId.ToString方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: WriteNodeId

        /// <summary>
        /// Writes an NodeId to the stream.
        /// </summary>
        public void WriteNodeId(string fieldName, NodeId value)
        {
            if (NodeId.IsNull(value))
            {
                WriteSimpleField(fieldName, null, false);
                return;
            }

            PushStructure(fieldName);

            if (UseReversibleEncoding)
            {
                WriteSimpleField("Id", value.ToString(), true);
            }
            else
            {
                WriteSimpleField("Id", new NodeId(value.Identifier, 0).ToString(), true);
                WriteNamespaceIndex(value.NamespaceIndex);
            }

            PopStructure();
        }
開發者ID:OPCFoundation,項目名稱:UA-.NET,代碼行數:25,代碼來源:JsonEncoder.cs

示例2: ReadHistory

        private void ReadHistory(DateTime StartTime, DateTime EndTime, NodeId node, uint HCount, String DriverName)
        {
            ReadRawModifiedDetails details = new ReadRawModifiedDetails();
            details.StartTime = DateTime.MinValue;
            details.EndTime = DateTime.MinValue;
            details.IsReadModified = false;
            details.NumValuesPerNode = HCount;
            details.ReturnBounds = true;
            details.StartTime = StartTime.ToUniversalTime();
            details.EndTime = EndTime.ToUniversalTime();

            HistoryReadValueId nodeToRead = new HistoryReadValueId();
            nodeToRead.NodeId = node;

            HistoryReadValueIdCollection nodesToRead = new HistoryReadValueIdCollection();
            nodesToRead.Add(nodeToRead);

            HistoryReadResultCollection results = null;
            DiagnosticInfoCollection diagnosticInfos = null;

            m_session.HistoryRead(
                null,
                new ExtensionObject(details),
                TimestampsToReturn.Source,
                false,
                nodesToRead,
                out results,
                out diagnosticInfos);

            for (int i = 0; i < results.Count; i++)
            {

                HistoryData hd_results = ExtensionObject.ToEncodeable(results[i].HistoryData) as HistoryData;

                if (hd_results != null)
                {

                    for (int ii = 0; ii < hd_results.DataValues.Count; ii++)
                    {
                        StatusCode status = hd_results.DataValues[ii].StatusCode;


                        string timestamp = hd_results.DataValues[ii].SourceTimestamp.ToLocalTime().ToString("yyyy-MM-dd HH:mm:ss");
                        string value = Utils.Format("{0}", hd_results.DataValues[ii].WrappedValue);
                        string quality = Utils.Format("{0}", (StatusCode)status.CodeBits);
                        string historyInfo = Utils.Format("{0:X2}", (int)status.AggregateBits);
                        Log("UID:" + S80(node.ToString()) + " \tTime: " + timestamp + "\tValue: " + value); // + ", Q:" + quality + ", histInfo:" + historyInfo);
                        dr = dt.NewRow();
                        dr["UID"] = node.ToString();
                        dr["SourceTime"] = timestamp;
                        dr["Value"] = value;
                        dr["Name"] = DriverName;
                        dt.Rows.Add(dr);
                    }
                }



            }

        }
開發者ID:baminmru,項目名稱:vodopad-ip-server,代碼行數:61,代碼來源:OPCRead.cs


注:本文中的Opc.Ua.NodeId.ToString方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。