Exemplo n.º 1
0
        public void TestCardReader()
        {
            var reader = new CardReader();

            reader.OpenDevice();
            var count     = 10;
            var sleepTime = 1000;

            while (count > 0)
            {
                var uid = reader.ReadUid();
                if (uid != "")
                {
                    Console.WriteLine(uid);
                    reader.Beep(100);
                    count--;
                    sleepTime = 3000;
                }
                else
                {
                    sleepTime = 1000;
                }
                Thread.Sleep(sleepTime);
            }
            reader.CloseDevice();
        }
Exemplo n.º 2
0
        public bool Stop()
        {
            _reader.StopReadForever();
            _reader.CloseDevice();
            _pubsock.Close();
            _socketServer.Stop();

            _log.Info("CardReaderService Stopped");

            return(true);
        }
Exemplo n.º 3
0
        public void TestReadForever()
        {
            var reader = new CardReader();

            reader.OnReadCardUid += new CardReader.ReadCardUidHandler((sender, e) =>
            {
                Console.WriteLine("Card ID: " + e.Uid);
            });

            reader.OpenDevice();
            reader.ReadForever();
            Thread.Sleep(10000);
            reader.StopReadForever();
            reader.CloseDevice();
        }
Exemplo n.º 4
0
        static void Main(string[] args)
        {
            var reader = new CardReader();

            reader.HoldTime     = 2000;
            reader.ReadInterval = 1000;

            reader.OnReadCardUid += (sender, e) =>
            {
                Console.WriteLine("Card UID: " + e.Uid);
            };

            Console.WriteLine("Press ENTER to stop ...");

            reader.OpenDevice();
            reader.ReadForever();

            Console.Read();

            reader.StopReadForever();
            reader.CloseDevice();
        }