示例#1
0
        protected override void myDevice_NotifyEvent(object sender, rfidReaderArgs args)
        {
            switch (args.RN_Value)
            {
            case rfidReaderArgs.ReaderNotify.RN_ScanStarted:
                //_listTagWithChannel = new Hashtable();
                _channelInScan = 1;
                Clock.Stop();
                break;

            case rfidReaderArgs.ReaderNotify.RN_ReaderFailToStartScan:
            case rfidReaderArgs.ReaderNotify.RN_ReaderScanTimeout:
                break;

            case rfidReaderArgs.ReaderNotify.RN_ScanCompleted:
            case rfidReaderArgs.ReaderNotify.RN_ErrorDuringScan:
                Thread.Sleep(2000);
                Clock.Start();
                break;

            case rfidReaderArgs.ReaderNotify.RN_Door_Closed:
                if (DoorEventNormal != null)
                {
                    DoorEventNormal.Set();
                }
                break;

            case rfidReaderArgs.ReaderNotify.RN_Door_Opened:
                Thread.Sleep(500);
                CloseDoor();
                break;

            case rfidReaderArgs.ReaderNotify.RN_ActiveChannnelChange:
                byte.TryParse(args.Message, out _channelInScan);
                break;

            case rfidReaderArgs.ReaderNotify.RN_TagAdded:
                //if (!_listTagWithChannel.ContainsKey(args.Message))
                //   _listTagWithChannel.Add(args.Message, _channelInScan);
                break;
            }
        }
        protected override void myDevice_NotifyEvent(object sender, rfidReaderArgs args)
        {
            switch (args.RN_Value)
            {
            case rfidReaderArgs.ReaderNotify.RN_ScanStarted:
                bDoorJustClosed = false;
                _channelInScan  = 1;
                // _listTagWithChannel = new Hashtable();
                // Clock.Stop();
                WriteLCDLine(1, " - IDENTIFICATION - ");
                WriteLCDLine(2, " ");
                break;

            case rfidReaderArgs.ReaderNotify.RN_ReaderFailToStartScan:
            case rfidReaderArgs.ReaderNotify.RN_ReaderScanTimeout:
                WriteLCDLine(1, " - IDENTIFICATION - ");
                WriteLCDLine(2, " ID failure ");
                break;

            case rfidReaderArgs.ReaderNotify.RN_ScanCompleted:
            case rfidReaderArgs.ReaderNotify.RN_ErrorDuringScan:
                string tmp = string.Format(" {0:D3} TAG(S) SCANNED", CurrenRfidReader.ReaderData.nbTagScan);
                WriteLCDLine(1, " - IDENTIFICATION - ");
                WriteLCDLine(2, tmp);

                Thread.Sleep(2000);
                Clock.Start();
                ClearLCD();
                break;

            case rfidReaderArgs.ReaderNotify.RN_Door_Closed:
                LogToFile.LogMessageToFile("door Close Medical cabinet");
                if (DoorEventNormal != null)
                {
                    DoorEventNormal.Set();
                }
                break;

            case rfidReaderArgs.ReaderNotify.RN_Door_Opened:

                LogToFile.LogMessageToFile("door Open Medical cabinet");
                if (LedThread != null)
                {
                    LogToFile.LogMessageToFile("Thred led - stop it in medical");
                    LedThread.Abort();
                    LedThread.Join(1000);
                    LedThread = null;
                }
                Thread.Sleep(3000);
                //if ((CurrenRfidReader != null) && (CurrenRfidReader.IsConnected)) CurrenRfidReader.SetLightPower(300);
                LogToFile.LogMessageToFile("Close door in medical");
                CloseDoor();
                WriteLCDLine(1, "  - INFORMATION - ");
                WriteLCDLine(2, " WAIT DOOR CLOSING");
                bDoorJustClosed = true;
                break;

            case rfidReaderArgs.ReaderNotify.RN_ActiveChannnelChange:
                byte.TryParse(args.Message, out _channelInScan);
                break;

            case rfidReaderArgs.ReaderNotify.RN_TagAdded:
                // if (!_listTagWithChannel.ContainsKey(args.Message))
                //    _listTagWithChannel.Add(args.Message, _channelInScan);
                break;
            }
        }