本文整理汇总了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");
}
}
}
示例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();
}
示例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),
});
}