// This example shows how to wait on an item until a value with "good" quality becomes available.
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.
# 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='')