Пример #1
0
            public static void Main1()
            {
                // Instantiate the client object
                // In order to use event pull, you must set a non-zero queue capacity upfront.
                var easyUAClient = new EasyUAClient {
                    PullDataChangeNotificationQueueCapacity = 1000
                };

                Console.WriteLine("Subscribing...");
                easyUAClient.SubscribeDataChange(
                    "http://opcua.demo-this.com:51211/UA/SampleServer",   // or "opc.tcp://opcua.demo-this.com:51210/UA/SampleServer"
                    "nsu=http://test.org/UA/Data/;i=10853",
                    1000);

                Console.WriteLine("Processing data change events for 1 minute...");
                int endTick = Environment.TickCount + 60 * 1000;

                do
                {
                    EasyUADataChangeNotificationEventArgs eventArgs = easyUAClient.PullDataChangeNotification(2 * 1000);
                    if (eventArgs != null)
                    {
                        // Handle the notification event
                        Console.WriteLine(eventArgs);
                    }
                } while (Environment.TickCount < endTick);
            }
Пример #2
0
 static void easyUAClient_DataChangeNotification(object sender, EasyUADataChangeNotificationEventArgs e)
 {
     // Your code would do the processing here
 }
 static void easyUAClient_DataChangeNotification(object sender, EasyUADataChangeNotificationEventArgs e)
 {
     // Display value
     // Remark: Production code would check e.Exception before accessing e.AttributeData.
     Console.WriteLine("{0}: {1}", e.Arguments.NodeDescriptor, e.AttributeData.Value);
 }
 static void easyUAClient_DataChangeNotification(object sender, EasyUADataChangeNotificationEventArgs e)
 {
     // Remark: Production code would check e.Exception before accessing e.AttributeData.
     Console.WriteLine(e.AttributeData.Value);
 }