コード例 #1
0
        public static void Main(string[] args)
        {
            IedConnection con = new IedConnection();

            string hostname;

            if (args.Length > 0)
            {
                hostname = args [0];
            }
            else
            {
                hostname = "localhost";
            }

            Console.WriteLine("Connect to " + hostname);

            try {
                con.Connect(hostname, 102);

                string rcbReference = "simpleIOGenericIO/LLN0.RP.EventsRCB";

                ReportControlBlock rcb = con.getReportControlBlock(rcbReference);

                rcb.GetRCBValues();

                rcb.InstallReportHandler(reportHandler, null);

                if (rcb.IsBuffered())
                {
                    Console.WriteLine("RCB: " + rcbReference + " is buffered");
                }

                Console.WriteLine(rcb.GetDataSetReference());

                rcb.SetTrgOps(TriggerOptions.DATA_CHANGED | TriggerOptions.INTEGRITY);
                rcb.SetIntgPd(5000);
                rcb.SetRptEna(true);

                rcb.SetRCBValues();

                /* run until Ctrl-C is pressed */
                Console.CancelKeyPress += delegate(object sender, ConsoleCancelEventArgs e) {
                    e.Cancel = true;
                    ReportingExample.running = false;
                };

                while (running)
                {
                    Thread.Sleep(10);
                }

                con.Abort();
            } catch (IedConnectionException e) {
                Console.WriteLine(e.Message);
            }
        }