// This example shows how to enumerate all properties of an OPC XML-DA item. For each property, it displays its Id and description. // // Find all latest examples here: https://opclabs.doc-that.com/files/onlinedocs/OPCLabs-OpcStudio/Latest/examples.html . using System; using OpcLabs.EasyOpc.DataAccess; using OpcLabs.EasyOpc.DataAccess.AddressSpace; using OpcLabs.EasyOpc.OperationModel; namespace DocExamples.DataAccess.Xml { class BrowseProperties { public static void Main1Xml() { // Instantiate the client object. var client = new EasyDAClient(); DAPropertyElementCollection propertyElements; try { propertyElements = client.BrowseProperties("http://opcxml.demo-this.com/XmlDaSampleServer/Service.asmx", "Dynamic/Analog Types/Int"); } catch (OpcException opcException) { Console.WriteLine("*** Failure: {0}", opcException.GetBaseException().Message); return; } foreach (DAPropertyElement propertyElement in propertyElements) Console.WriteLine($"PropertyElements(\"{propertyElement.PropertyId.NumericalValue}\").Description: {propertyElement.Description}"); } // Example output: // //PropertyElements("1").Description: Item Canonical DataType //PropertyElements("2").Description: Item Value //PropertyElements("3").Description: Item Quality //PropertyElements("4").Description: Item Timestamp //PropertyElements("5").Description: Item Access Rights //PropertyElements("6").Description: Server Scan Rate //PropertyElements("7").Description: Item EU Type //PropertyElements("8").Description: Item EU Info //PropertyElements("102").Description: High EU //PropertyElements("103").Description: Low EU } }
# This example shows how to enumerate all properties of an OPC XML-DA item. For each property, it displays its Id and description. # # Find all latest examples here: https://opclabs.doc-that.com/files/onlinedocs/OPCLabs-OpcStudio/Latest/examples.html . # OPC client and subscriber examples in Python on GitHub: https://github.com/OPCLabs/Examples-QuickOPC-Python . # The QuickOPC package is needed. Install it using "pip install opclabs_quickopc". import opclabs_quickopc # Import .NET namespaces. from OpcLabs.EasyOpc import * from OpcLabs.EasyOpc.DataAccess import * # Instantiate the client object. client = EasyDAClient() try: propertyElements = client.BrowseProperties(ServerDescriptor('http://opcxml.demo-this.com/XmlDaSampleServer/Service.asmx'), DANodeDescriptor('Dynamic/Analog Types/Int')) except OpcException as opcException: print('*** Failure: ' + opcException.GetBaseException().Message, sep='') exit() for propertyElement in propertyElements: print('PropertyElements("', propertyElement.PropertyId.NumericalValue, '").Description: ', propertyElement.Description, sep='') # Example output: # #PropertyElements("1").Description: Item Canonical DataType #PropertyElements("2").Description: Item Value #PropertyElements("3").Description: Item Quality #PropertyElements("4").Description: Item Timestamp #PropertyElements("5").Description: Item Access Rights #PropertyElements("6").Description: Server Scan Rate #PropertyElements("7").Description: Item EU Type #PropertyElements("8").Description: Item EU Info #PropertyElements("102").Description: High EU #PropertyElements("103").Description: Low EU
' This example shows how to enumerate all properties of an OPC XML-DA item. For each property, it displays its Id and description. ' ' Find all latest examples here: https://opclabs.doc-that.com/files/onlinedocs/OPCLabs-OpcStudio/Latest/examples.html . Imports OpcLabs.EasyOpc.DataAccess Imports OpcLabs.EasyOpc.DataAccess.AddressSpace Imports OpcLabs.EasyOpc.OperationModel Namespace DataAccess.Xml Partial Friend Class BrowseProperties Shared Sub Main1Xml() Dim client = New EasyDAClient() Dim propertyElements As DAPropertyElementCollection Try propertyElements = client.BrowseProperties("http://opcxml.demo-this.com/XmlDaSampleServer/Service.asmx", "Dynamic/Analog Types/Int") Catch opcException As OpcException Console.WriteLine("*** Failure: {0}", opcException.GetBaseException().Message) Exit Sub End Try For Each propertyElement In propertyElements Console.WriteLine($"PropertyElements(""{propertyElement.PropertyId.NumericalValue}"").Description: {propertyElement.Description}") Next propertyElement End Sub ' Example output ' 'PropertyElements("1").Description: Item Canonical DataType 'PropertyElements("2").Description: Item Value 'PropertyElements("3").Description: Item Quality 'PropertyElements("4").Description: Item Timestamp 'PropertyElements("5").Description: Item Access Rights 'PropertyElements("6").Description: Server Scan Rate 'PropertyElements("7").Description: Item EU Type 'PropertyElements("8").Description: Item EU Info 'PropertyElements("102").Description: High EU 'PropertyElements("103").Description: Low EU End Class End Namespace
Copyright © 2004-2024 CODE Consulting and Development, s.r.o., Plzen. All rights reserved.
Send Documentation Feedback. Technical Support