Beispiel #1
0
        public void OPCConnectAndReadTest()
        {
            // connect to local kepware server (UA)
            OPC.Client client = new UAClient("127.0.0.1", 49320);
            Assert.IsTrue(client.Connect());

            // demand read a value
            OpcValue value = client.Read("Simulation Examples.Functions.Ramp2", 2);

            Assert.IsTrue(value.Status.IsGood);


            // subscribe to a value
            client.DataChange += Client_DataChange;
            client.Subscribe("Simulation Examples.Functions.Ramp2", 2);  // this format is outdated

            // wait up to 2 seconds for a DataChanged event
            Thread.Sleep(2000);

            // and clean up
            client.DataChange -= Client_DataChange;
            client.Dispose();



            // now do it again, using OPC DA
            client = new DAClient("127.0.0.1", "Kepware.KEPServerEX.V6", "{7BC0CC8E-482C-47CA-ABDC-0FE7F9C6E729}"); Assert.IsTrue(client.Connect());

            // demand read a value
            value = client.Read("Simulation Examples.Functions.Ramp2", 2);
            Assert.IsTrue(value.Status.IsGood);


            // subscribe to a value
            client.DataChange += Client_DataChange;
            //client.Subscribe("Simulation Examples.Functions.Ramp2", 2);   this format is outdated

            // wait up to 2 seconds for a DataChanged event
            Thread.Sleep(2000);

            // and clean up
            client.DataChange -= Client_DataChange;
            client.Dispose();
        }
Beispiel #2
0
 public Query(UAClient uAClient)
 {
     _uaClient = uAClient;
 }
 public GQLSubscription(UAClient uAClient)
 {
     _uaClient = uAClient;
 }