// This example shows how to wait on an item until a value with "good" quality becomes available. // // 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.Extensions; using OpcLabs.EasyOpc.OperationModel; namespace DocExamples.DataAccess._EasyDAClientExtension { class WaitForItemValue { public static void Main1() { // Instantiate the client object. var client = new EasyDAClient(); Console.WriteLine("Waiting until an item value with \"good\" quality becomes available..."); object value; try { value = client.WaitForItemValue("", "OPCLabs.KitServer.2", "Demo.Unreliable", groupParameters: 100, // this is the requested update rate millisecondsTimeout: 60*1000); } catch (OpcException opcException) { Console.WriteLine("*** Failure: {0}", opcException.GetBaseException().Message); return; } // Display the obtained item value. Console.WriteLine($"value: {value}"); } } }
# This example shows how to wait on an item until a value with "good" quality becomes available. # # 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.DataAccess import * from OpcLabs.EasyOpc.DataAccess.Extensions import * from OpcLabs.EasyOpc.OperationModel import * # Instantiate the client object client = EasyDAClient() print('Waiting until an item value with "good" quality becomes available...') try: value = IEasyDAClientExtension2.WaitForItemValue(client, '', 'OPCLabs.KitServer.2', DAItemDescriptor('Demo.Unreliable'), DAGroupParameters(100), # this is the requested update rate 60*1000) # timeout in milliseconds except OpcException as opcException: print('*** Failure: ' + opcException.GetBaseException().Message) exit() # Display the obtained item value. print('value: ', value, sep='')
' This example shows how to wait on an item until a value with "good" quality becomes available. ' ' 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.Extensions Imports OpcLabs.EasyOpc.OperationModel Namespace DataAccess._EasyDAClientExtension Friend Class WaitForItemValue Public Shared Sub Main1() ' Instantiate the client object. Dim client = New EasyDAClient() Console.WriteLine("Waiting until an item value with ""good"" quality becomes available...") Dim value As Object Try value = client.WaitForItemValue("", "OPCLabs.KitServer.2", "Demo.Unreliable", groupParameters:=100, ' this Is the requested update rate millisecondsTimeout:=60 * 1000) Catch opcException As OpcException Console.WriteLine("*** Failure: {0}", opcException.GetBaseException().Message) Exit Sub End Try ' Display the obtained item value. Console.WriteLine($"value: {value}") End Sub End Class End Namespace
Copyright © 2004-2024 CODE Consulting and Development, s.r.o., Plzen. All rights reserved. Web page: www.opclabs.com
Send Documentation Feedback. Resources: Knowledge Base, Product Downloads. Technical support: Online Forums, FAQ.Missing some example? Ask us for it on our Online Forums! You do not have to own a commercial license in order to use Online Forums, and we reply to every post.