当前位置: 首页>>代码示例>>C#>>正文


C# Reader.StartReading方法代码示例

本文整理汇总了C#中Reader.StartReading方法的典型用法代码示例。如果您正苦于以下问题:C# Reader.StartReading方法的具体用法?C# Reader.StartReading怎么用?C# Reader.StartReading使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Reader的用法示例。


在下文中一共展示了Reader.StartReading方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: DemoReadFunc

        private static void DemoReadFunc(Reader rdr, ArgParser pargs)
        {
            while (true)
            {
                //Console.WriteLine("Press Enter to start reading...");
                //Console.In.Read();

                while (true)
                {
                    int millis = 5000;
                    Console.WriteLine("Reading for " + millis + " milliseconds");
                    TagReadData[] reads = rdr.Read(millis);
                    Console.WriteLine("Read " + reads.Length + " tags");
                    PrintTagReads(reads);

                    Console.WriteLine("----");

                    Console.WriteLine("\r\nReading until Enter pressed...");
                    rdr.TagRead += PrintTagReadHandler;
                    // (Optional) Subscribe to reader exception notifications
                    rdr.ReadException += ReadExceptionHandler;
                    Console.WriteLine("Starting...");
                    rdr.StartReading();
                    Console.WriteLine("Started");

                    DateTime start = DateTime.Now;
                    DateTime lastUpdate = DateTime.MinValue;
                    //Console.In.Read();
                    Console.WriteLine("Stopping...");
                    rdr.StopReading();
                    rdr.TagRead -= PrintTagReadHandler;
                    rdr.ReadException -= ReadExceptionHandler;
                    Console.WriteLine("Stopped");
                }
            }
        }
开发者ID:colombmo,项目名称:itsi-gamification,代码行数:36,代码来源:Program.cs

示例2: ReadAsyncFunc

 private static void ReadAsyncFunc(Reader rdr, ArgParser pargs)
 {
     string[] args = pargs.commandArgs;
     int timeout = 3000;
     if (0 < args.Length)
     {
         timeout = Int32.Parse(args[0], System.Globalization.NumberStyles.Any);
     }
     rdr.TagRead += PrintTagReadHandler;
     rdr.ReadException += delegate(Object sender, ReaderExceptionEventArgs e)
     {
         Console.WriteLine("Asynchronous Read Exception:");
         Console.WriteLine(e.ReaderException.ToString());
     };
     rdr.ParamSet("/reader/read/plan", MakeMultiReadPlan());
     rdr.StartReading();
     Thread.Sleep(timeout);
     rdr.StopReading();
 }
开发者ID:colombmo,项目名称:itsi-gamification,代码行数:19,代码来源:Program.cs

示例3: TestSyncFunc

        private static void TestSyncFunc(Reader rdr, ArgParser pargs)
        {
            // USB Reader, M5e Dev Kit: LED on = GPO false
            bool on = false;
            bool off = !on;

            rdr.TagRead += delegate(Object sender, TagReadDataEventArgs e)
            {
                PrintTagRead(e.TagReadData);
                rdr.GpoSet(new GpioPin[] { 
                    new GpioPin(2, on), 
                });
                Console.WriteLine("Wasting time:");
                for (int i = 3; 0 < i; i--)
                {
                    Console.Write(" {0:D}", i);
                    Thread.Sleep(300);
                }
                Console.WriteLine();
            };
            rdr.ReadException += delegate(Object sender, ReaderExceptionEventArgs e)
            {
                Console.WriteLine("Asynchronous Read Exception:");
                Console.WriteLine(e.ReaderException.ToString());
            };

            rdr.GpoSet(new GpioPin[] { 
                    new GpioPin(1, off), 
                    new GpioPin(2, off),
                });
            rdr.StartReading();
            DateTime startTime = DateTime.Now;
            DateTime stopTime = startTime + new TimeSpan(0, 0, 5);
            while (DateTime.Now < stopTime)
            {
                rdr.GpoSet(new GpioPin[] { 
                    new GpioPin(1, off), 
                    new GpioPin(2, off),
                });
                Thread.Sleep(10);
            }
            rdr.StopReading();
            rdr.GpoSet(new GpioPin[] { 
                    new GpioPin(1, on), 
                    new GpioPin(2, on),
                });
        }
开发者ID:colombmo,项目名称:itsi-gamification,代码行数:47,代码来源:Program.cs


注:本文中的Reader.StartReading方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。