Ejemplo n.º 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();
        }
Ejemplo n.º 2
0
        private List <OxigenIIAdvertising.AppData.Channel> GetDirtyChannelData()
        {
            List <OxigenIIAdvertising.AppData.Channel> channels = null;
            DAClient client = null;

            // get "dirty channels"
            try
            {
                client = new DAClient();

                channels = client.GetChannelsDirty();
            }
            finally
            {
                client.Dispose();
            }

            return(channels);
        }
Ejemplo n.º 3
0
        private List <SimpleFileInfo> GetDirtyAssetFilenames()
        {
            List <SimpleFileInfo> assets = null;
            DAClient client = null;

            // get new assets
            try
            {
                client = new DAClient();

                assets = client.GetAssetsDirty();
            }
            finally
            {
                client.Dispose();
            }

            return(assets);
        }
Ejemplo n.º 4
0
        private void MakeChannelsClean(HashSet <int> channelIDs)
        {
            DAClient client = null;

            try
            {
                client = new DAClient();

                client.EditChannelsMakeClean(channelIDs);
            }
            catch (Exception ex)
            {
                LogException(_eventLog, ex.ToString());
            }
            finally
            {
                if (client != null)
                {
                    client.Dispose();
                }
            }
        }
Ejemplo n.º 5
0
        private void MakeAssetsClean(HashSet <int> assetIDs)
        {
            DAClient client = null;

            try
            {
                client = new DAClient();

                client.EditSlidesMakeClean(assetIDs);
            }
            catch (Exception ex)
            {
                LogException(_eventLog, ex.ToString());
            }
            finally
            {
                if (client != null)
                {
                    client.Dispose();
                }
            }
        }
Ejemplo n.º 6
0
        private void btnClick_Click(object sender, EventArgs e)
        {
            //UserDataMarshallerClient client = new UserDataMarshallerClient();
            //client.Endpoint.Address = new EndpointAddress(@"http://relay-logs-a-1.obs-group.co.uk:81/Userdatamarshaller.svc");

            //DateTimeErrorWrapper dt = client.GetCurrentServerTime("password");

            //client.Dispose();

            try
            {
                DAClient client = new DAClient();

                DemographicData dg = client.GetUserDemographicData("31350825-4D31-48E3-8AFE-0F32C1D53096_A");

                client.Dispose();

                MessageBox.Show(dg.SocioEconomicgroup[0]);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }