Exemplo n.º 1
0
            public static void Overload1()
            {
                // Instantiate the client object
                var easyUAClient = new EasyUAClient();

                // Obtain value of a node
                object value = easyUAClient.ReadValue(
                    "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");

                // Display results
                Console.WriteLine("value: {0}", value);
            }
            public static void ReadValue()
            {
                // Instantiate the client object
                var easyUAClient = new EasyUAClient();

                // Obtain the value, indicating that just the elements 2 to 4 should be returned
                object value = easyUAClient.ReadValue(
                    new UAReadArguments(
                        "http://opcua.demo-this.com:51211/UA/SampleServer",   // or "opc.tcp://opcua.demo-this.com:51210/UA/SampleServer"
                        "nsu=http://test.org/UA/Data/;ns=2;i=10305",
                        UAIndexRangeList.OneDimension(2, 4)));

                // Cast to typed array
                var arrayValue = (Int32[])value;

                // Display results
                for (int i = 0; i < 3; i++)
                {
                    Console.WriteLine("arrayValue[{0}]: {1}", i, arrayValue[i]);
                }
            }