Esempio n. 1
0
        protected void MTRFIDEnable()
        {
            if (this.InvokeRequired)
            {
                this.Invoke(new voidinvoker(MTRFIDEnable));
            }
            else
            {
                try
                {
#if DEBUG
                    //rfidscanner = new FakeRFIDScanner(this);
                    rfidscanner = new RFIDScanner(this);
#else
                    rfidscanner = new RFIDScanner(this);
#endif

                    rfidscanner.TagInputBox         = tb_eTagEPC;
                    rfidscanner.OnAfterTagRead     += new EventHandler <ThingMagic.TagReadDataEventArgs>(rfidscanner_OnAfterTagRead);
                    rfidscanner.OnTagReadException += new EventHandler <ThingMagic.ReaderExceptionEventArgs>(rfidscanner_OnTagReadException);

                    rfidscanner.EnableReader();
                }
                catch (Exception ex)
                {
                    logger.Error(ex.Message, ex);
                    Utility.ShowErrMsg(ex.Message);
                    this.Close();
                }
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Check status of connection and restore, if down
        /// </summary>
        public static void CheckConnection()
        {
            if (!subscriptionsDone)
            {
                Utility.PowerManager.PowerNotify += new PowerManager.PowerEventHandler(PowerManager_PowerNotify);
                DebugLog.Log     += new LogProvider.LogHandler(DebugLog_Log_ToDisk);
                subscriptionsDone = true;
            }
            lock (readerLock)
            {
                try
                {
                    if (null == _rdr)
                    {
                        //Modify for could not turn on issue
                        CoreDLL.PowerPolicyNotify(PPNMessage.PPN_UNATTENDEDMODE, 1);
                        DebugLog_Log_ToDisk("Set PPN_UNATTENDEDMODE to 1");

                        _rdr = RFIDScanner.ConnectReader();
                        EnableUnattendedReaderMode(Utility.ReaderPortName);

                        //_rdr.ParamSet("/reader/powerMode", Reader.PowerMode.MEDSAVE);
                        _rdr.ParamSet("/reader/powerMode", Reader.PowerMode.FULL);
                    }
                }
                catch (Exception)
                {
                    throw;
                }
            }
        }
Esempio n. 3
0
 private void MTRFIDDisable()
 {
     if (this.InvokeRequired)
     {
         this.Invoke(new voidinvoker(MTRFIDDisable));
     }
     else
     {
         try
         {
             rfidscanner.OnAfterTagRead -= rfidscanner_OnAfterTagRead;
             rfidscanner.DisableReader();
             rfidscanner = null;
         }
         catch (Exception ex)
         {
             logger.Error(ex.Message, ex);
             Utility.ShowErrMsg(ex.Message);
             throw ex;
         }
     }
 }