Exemplo n.º 1
0
        public void Setup()
        {
            //Creating stubs for dependencies
            stubdoor       = Substitute.For <IDoor>();
            stubCharger    = Substitute.For <IChargeControl>();
            stubDisplay    = Substitute.For <IDisplay>();
            stubRFIDReader = Substitute.For <IRFIDReader>();
            stubUsb        = Substitute.For <IUsbCharger>();

            //Initialising classes for tests
            usb            = new UsbChargerSimulator();
            rfidReader     = new RFIDReader();
            display        = new ConcreteDisplay();
            door           = new Door();
            chargeControl  = new ChargeControl(stubUsb);
            stationControl = new StationControl(stubCharger, stubdoor, stubDisplay, stubRFIDReader);

            _rfidEventArgs = null;
            rfidReader.RFIDDetectedEvent += (o, args) => { _rfidEventArgs = args; };

            _doorEventArgs  = null;
            door.DoorEvent += (o, args) => { _doorEventArgs = args; };

            _currentEventArgs      = null;
            usb.CurrentValueEvent += (o, args) => { _currentEventArgs = args; };
        }
Exemplo n.º 2
0
        private void buttonRFIDRead_Click(object sender, EventArgs e)
        {
            buttonRFIDRead.Enabled = false;
            var item = comboBoxRFIDs.SelectedValue as RFIDReader;

            if (item != null)
            {
                var data = item.ReadBytes();
                if (data != null)
                {
                    var str = RFIDReader.BytesToHexString(data);
                    for (int i = 2; i < str.Length; i += 3)
                    {
                        str = str.Insert(i, i == 65 ? "+" : "_");
                    }
                    Data = RFIDData.Deserialize(data);
                    textBoxRFIDData.Text            = str;
                    comboBoxWorkpiece.SelectedValue = Data.Workpiece;
                    comboBoxClean.SelectedValue     = Data.Clean;
                    comboBoxGauge.SelectedValue     = Data.Gauge;
                    comboBoxAssemble.SelectedValue  = Data.Assemble;
                }
            }
            buttonRFIDRead.Enabled = true;
        }
Exemplo n.º 3
0
 public TagEventHandler(RFIDReader API, string ID)
 {
     _ExistingTable = new Hashtable();
     _ReaderAPI = API;
     _DeviceID = ID;
     _Processor = new DefaultTagProcessor();
 }
Exemplo n.º 4
0
        public Impinj(string IPAddress, uint PortNumber = 5084, uint TimeOut = 10000)
        {
            try
            {
                sIPAddress = IPAddress;
                uiPortNo = PortNumber;
                uiCommandTimeOut = TimeOut;

                objMotorolaReader = new RFIDReader(sIPAddress, uiPortNo, uiCommandTimeOut);

                rdrStatus = KTR.IRFID.ReaderStatus.DISCOVERED;
                rdrType = KTR.IRFID.ReaderType.MOTOROLA;

                rdrInfo = new ReaderDetails();
                rdrInfo.IPAddress = sIPAddress;
                rdrInfo.PortNumber = uiPortNo;
                rdrInfo.VersionInformation = objMotorolaReader.VersionInfo.Version;
                rdrInfo.Vendor = rdrType;
                rdrInfo.ModelName = objMotorolaReader.ReaderCapabilities.ModelName;

            }
            catch (Exception ex)
            {
                throw new Exception("Unable to create object. " + ex.Message);
            }
        }
Exemplo n.º 5
0
        public DeviceSettings(RFIDReader rfid)
        {
            _Parser    = new ConfigParser();
            _ReaderAPI = rfid;
            setDefaults();

            //Construct access/post filter with no limit
            _Range        = new RssiRangeFilter();
            _AccessFilter = new AccessFilter();
            _AccessFilter.UseRSSIRangeFilter = true;
            _AccessFilter.RssiRangeFilter    = _Range;
            _PostFilter = new PostFilter();
            _PostFilter.UseRSSIRangeFilter = true;
            _PostFilter.RssiRangeFilter    = _Range;

            //Will trigger inventory with trigger button
            _TriggerInfo = new TriggerInfo();
            _TriggerInfo.StartTrigger.Type = START_TRIGGER_TYPE.START_TRIGGER_TYPE_HANDHELD;
            _TriggerInfo.StartTrigger.Handheld.HandheldEvent = HANDHELD_TRIGGER_EVENT_TYPE.HANDHELD_TRIGGER_PRESSED;
            _TriggerInfo.StopTrigger.Type = STOP_TRIGGER_TYPE.STOP_TRIGGER_TYPE_HANDHELD_WITH_TIMEOUT;
            _TriggerInfo.StopTrigger.Handheld.HandheldEvent = HANDHELD_TRIGGER_EVENT_TYPE.HANDHELD_TRIGGER_RELEASED;

            //Read user membank sequence
            _Op = new TagAccess.Sequence.Operation();
            _Op.AccessOperationCode             = ACCESS_OPERATION_CODE.ACCESS_OPERATION_READ;
            _Op.ReadAccessParams.MemoryBank     = MEMORY_BANK.MEMORY_BANK_USER;
            _Op.ReadAccessParams.ByteCount      = 4;
            _Op.ReadAccessParams.ByteOffset     = 0;
            _Op.ReadAccessParams.AccessPassword = 0;
        }
Exemplo n.º 6
0
        private void rfidReader_IdReceived(RFIDReader sender, string e)
        {
            //cameraRetryTimer.Tick += cameraRetryTimer_Tick;
            timeOutTimer.Tick += timeOutTimer_Tick;
            if (authInProgress == false)
            {
                Debug.Print("RFID scanned: " + e);
                scannedRFID = e;
                if (cam.CameraReady)
                {
                    authInProgress = true;
                    cam.TakePicture();
                    timeOutTimer.Start();
                }
                else
                {
                    Debug.Print("Camera not ready");

                    /* cameraRetryTimer.Start();
                     * cameraRetryCount = 0;
                     */
                }
            }
            else
            {
                Debug.Print("Authentication already in progress");
            }

            /*displayTE35.SimpleGraphics.Clear();
             * displayTE35.SimpleGraphics.DisplayText("RFID scanned: " + e, fontNina, GT.Color.White, 10, 10);*/
        }
Exemplo n.º 7
0
 protected override void OnDestroy()
 {
     base.OnDestroy();
     try
     {
         if (Reader != null)
         {
             Reader.Events.RemoveEventsListener(this);
             Reader.Disconnect();
             Reader = null;
         }
         readers.Dispose();
         readers = null;
     }
     catch (InvalidUsageException e)
     {
         e.PrintStackTrace();
     }
     catch (OperationFailureException e)
     {
         e.PrintStackTrace();
     }
     catch (Exception e)
     {
         e.StackTrace.ToString();
     }
 }
Exemplo n.º 8
0
        static void Main(string[] args)
        {
            IDoor         _door          = new Door();
            IRFIDReader   _rfidReader    = new RFIDReader();
            Display       _display       = new Display();
            Logfile       _logfile       = new Logfile();
            IUsbCharger   _usbCharger    = new UsbChargerSimulator();
            ChargeControl _chargeControl = new ChargeControl(_usbCharger, _display);

            StationControl _stationControl = new StationControl(_rfidReader, _door, _display, _logfile, _chargeControl);

            //        _door.OnUserOpensDoor();

            _door.OnUserOpensDoor();
            Thread.Sleep(2000);
            _door.OnUserClosesDoor();
            Thread.Sleep(2000);
            _rfidReader.OnRFIDTagPresented(123);
            Thread.Sleep(1000);
            Console.WriteLine("...");
            Thread.Sleep(1000);
            Console.WriteLine("...");
            Thread.Sleep(1000);
            Console.WriteLine("...");

            Thread.Sleep(2000);
            _rfidReader.OnRFIDTagPresented(123);
            Console.ReadKey();
        }
Exemplo n.º 9
0
 private void GetAvailableReaders()
 {
     readerDevice = null;
     // SDK
     if (readers == null)
     {
         readers = new Readers(this, ENUM_TRANSPORT.ServiceSerial);
     }
     try
     {
         if (readers != null)
         {
             if (readers.AvailableRFIDReaderList != null)
             {
                 availableRFIDReaderList = readers.AvailableRFIDReaderList;
                 if (availableRFIDReaderList.Count != 0)
                 {
                     readerDevice = availableRFIDReaderList[0];
                     Reader       = readerDevice.RFIDReader;
                 }
             }
         }
     }
     catch (InvalidUsageException e)
     {
         e.PrintStackTrace();
     }
     catch (OperationFailureException e)
     {
         e.PrintStackTrace();
         Log.Debug(TAG, "OperationFailureException " + e.VendorMessage);
     }
 }
Exemplo n.º 10
0
 private void frmSGMConfig_Load(object sender, EventArgs e)
 {
     if (SGMConfig.Flag_DisableReader)
     {
         openLoginFrm();
     }
     m_stSettingFile     = Application.StartupPath + m_stSettingFile;
     m_stCurrentPortName = RFIDReader.LoadConfig(m_stSettingFile);
     loadPortsName();
     if (!m_stCurrentPortName.Equals(""))
     {
         for (int i = 0; i < cboPorts.Items.Count; i++)
         {
             if (cboPorts.Items[i].ToString().Equals(m_stCurrentPortName))
             {
                 if (InitComPort())
                 {
                     openLoginFrm();
                 }
                 else
                 {
                     frmMsg.ShowMsg(SGMText.SGM_ERROR, SGMText.FRM_CONFIG_CANT_CONNECT_READER, SGMMessageType.SGM_MESSAGE_TYPE_ERROR);
                 }
             }
         }
     }
     m_stCurrentPortName = cboPorts.Text;
 }
Exemplo n.º 11
0
        protected override void OnDestroy()
        {
            base.OnDestroy();

            if ((listFoxProducts.Count > 0) && (scanType != "VERIFY"))
            {
                SaveItemsScanned("DONOTHING");
            }

            try
            {
                if (Reader != null)
                {
                    Reader.Events.RemoveEventsListener(eventHandler);
                    Reader.Disconnect();
                    Toast.MakeText(ApplicationContext, "Disconnecting reader", ToastLength.Long).Show();
                    Reader = null;
                    readers.Dispose();
                    readers = null;
                }
            }
            catch (InvalidUsageException e)
            {
                e.PrintStackTrace();
            }
            catch (OperationFailureException e)
            {
                e.PrintStackTrace();
            }
            catch (Exception e)
            {
                e.StackTrace.ToString();
            }
        }
Exemplo n.º 12
0
 private void MainFrame_EnabledChanged(object sender, EventArgs e)
 {
     if (!this.Enabled)
     {
         RFIDReader.Disconnect();
     }
 }
Exemplo n.º 13
0
 private void CloseRFIDConnection()
 {
     try
     {
         if (Reader != null)
         {
             //Reader.Events.RemoveEventsListener(eventHandler);
             Reader.Disconnect();
             //Toast.MakeText(ApplicationContext, "Disconnecting reader", ToastLength.Long).Show();
             Reader = null;
             readers.Dispose();
             readers = null;
         }
     }
     catch (InvalidUsageException e)
     {
         e.PrintStackTrace();
     }
     catch (OperationFailureException e)
     {
         e.PrintStackTrace();
     }
     catch (Exception e)
     {
         e.StackTrace.ToString();
     }
 }
Exemplo n.º 14
0
        public DeviceSettings(RFIDReader rfid)
        {
            _Parser = new ConfigParser();
            _ReaderAPI = rfid;
            setDefaults();

            //Construct access/post filter with no limit
            _Range = new RssiRangeFilter();
            _AccessFilter = new AccessFilter();
            _AccessFilter.UseRSSIRangeFilter = true;
            _AccessFilter.RssiRangeFilter = _Range;
            _PostFilter = new PostFilter();
            _PostFilter.UseRSSIRangeFilter = true;
            _PostFilter.RssiRangeFilter = _Range;

            //Will trigger inventory with trigger button
            _TriggerInfo = new TriggerInfo();
            _TriggerInfo.StartTrigger.Type = START_TRIGGER_TYPE.START_TRIGGER_TYPE_HANDHELD;
            _TriggerInfo.StartTrigger.Handheld.HandheldEvent = HANDHELD_TRIGGER_EVENT_TYPE.HANDHELD_TRIGGER_PRESSED;
            _TriggerInfo.StopTrigger.Type = STOP_TRIGGER_TYPE.STOP_TRIGGER_TYPE_HANDHELD_WITH_TIMEOUT;
            _TriggerInfo.StopTrigger.Handheld.HandheldEvent = HANDHELD_TRIGGER_EVENT_TYPE.HANDHELD_TRIGGER_RELEASED;

            //Read user membank sequence
            _Op = new TagAccess.Sequence.Operation();
            _Op.AccessOperationCode = ACCESS_OPERATION_CODE.ACCESS_OPERATION_READ;
            _Op.ReadAccessParams.MemoryBank = MEMORY_BANK.MEMORY_BANK_USER;
            _Op.ReadAccessParams.ByteCount = 4;
            _Op.ReadAccessParams.ByteOffset = 0;
            _Op.ReadAccessParams.AccessPassword = 0;
        }
Exemplo n.º 15
0
        private void loadPortsName()
        {
            cboPorts.Items.Clear();
            string[] arrComPortNames = null;
            int      index           = -1;
            string   stComPortName   = null;

            //Com Ports
            arrComPortNames = RFIDReader.GetPortsName();
            if (arrComPortNames.Length > 0)
            {
                do
                {
                    index += 1;
                    cboPorts.Items.Add(arrComPortNames[index]);
                }while (!((arrComPortNames[index] == stComPortName) || (index == arrComPortNames.GetUpperBound(0))));
                Array.Sort(arrComPortNames);

                if (index == arrComPortNames.GetUpperBound(0))
                {
                    stComPortName = arrComPortNames[0];
                }
                //get first item print in text

                cboPorts.Text = arrComPortNames[0];
            }
        }
Exemplo n.º 16
0
        private void rfidReader_IdReceived(RFIDReader sender, string e)
        {
            if (authInProgress == false)
            {
                displayText("RFID scanned: " + e);
                scannedRFID = e;
                if (camera.CameraReady)
                {
                    authInProgress = true;
                    camera.TakePicture();
                    timeOutTimer.Start();
                }
                else
                {
                    displayText("Camera not ready");

                    /* cameraRetryTimer.Start();
                     * cameraRetryCount = 0;
                     */
                }
            }
            else
            {
                displayText("Authentication already in progress");
            }
        }
Exemplo n.º 17
0
 public frmSGMLogin()
 {
     InitializeComponent();
     frmMsg            = new frmSGMMessage();
     serialDatahandler = new SerialDataReceivedEventHandler(CardReaderReceivedHandler);
     RFIDReader.RegistryReaderListener(Program.ReaderPort, serialDatahandler);
 }
Exemplo n.º 18
0
        private void toolStripButton1_Click(object sender, EventArgs e)
        {
            this.m_RFIDReader = new RFIDReader(this.IP, this.Port, 0u);
            try
            {
                this.m_RFIDReader.Connect();
                this.m_RFIDReader.Events.ReadNotify += new Events.ReadNotifyHandler(this.Events_ReadNotify);
                this.m_RFIDReader.Events.AttachTagDataWithReadEvent = false;
                this.m_RFIDReader.Events.StatusNotify                += new Events.StatusNotifyHandler(this.Events_StatusNotify);
                this.m_RFIDReader.Events.NotifyGPIEvent               = true;
                this.m_RFIDReader.Events.NotifyBufferFullEvent        = true;
                this.m_RFIDReader.Events.NotifyBufferFullWarningEvent = true;
                this.m_RFIDReader.Events.NotifyReaderDisconnectEvent  = true;
                this.m_RFIDReader.Events.NotifyReaderExceptionEvent   = true;
                this.m_RFIDReader.Events.NotifyAccessStartEvent       = true;
                this.m_RFIDReader.Events.NotifyAccessStopEvent        = true;
                this.m_RFIDReader.Events.NotifyInventoryStartEvent    = true;
                this.m_RFIDReader.Events.NotifyInventoryStopEvent     = true;
                this.toolStripButton1.Enabled = false;
                this.toolStripButton2.Enabled = true;
                this.toolStripButton3.Enabled = false;
                this.toolStripButton4.Enabled = false;
                this.toolStripButton5.Enabled = false;

                SetAntennas();
            }
            catch (OperationFailureException ex)
            {
                MessageBox.Show(ex.ToString());
            }
            catch (Exception ex2)
            {
                MessageBox.Show(ex2.ToString());
            }
        }
Exemplo n.º 19
0
 public TagEventHandler(RFIDReader API, string ID)
 {
     _ExistingTable = new Hashtable();
     _ReaderAPI     = API;
     _DeviceID      = ID;
     _Processor     = new DefaultTagProcessor();
 }
Exemplo n.º 20
0
        public ScanInventory_Form(StartAudit_Form appForm)
        {
            InitializeComponent();
            this.m_appForm = appForm;
            status = "Connect";
            this.m_UpdateReadHandler = new UpdateRead(myUpdateRead);
            this.m_UpdateStatusHandler = new UpdateStatus(myUpdateStatus);
            this.m_ReadTag = new Symbol.RFID3.TagData();

            m_ReaderAPI = m_appForm.m_ReaderAPI;
            m_ReaderAPI = new RFIDReader("127.0.0.1", 5084, 0);

            this.m_AntennaInfoForm = m_appForm.m_AntennaInfoForm;
            this.m_AntennaConfigForm = m_appForm.m_AntennaConfigForm;
            this.m_PostFilterForm = m_appForm.m_PostFilterForm;
            this.m_AccessFilterForm = m_appForm.m_AccessFilterForm;
            this.m_TriggerForm = m_appForm.m_TriggerForm;

            this.m_ReaderMgmt = new ReaderManagement();
            this.m_TagTable = new Hashtable(1023);
            this.m_AccessOpResult = new AccessOperationResult();
            this.m_IsConnected = false;
            this.m_TagTotalCount = 0;
            this.m_ReaderInitiatedDisconnectionReceived = false;
            this.m_isBeepingEnabled = true;
        }
Exemplo n.º 21
0
 private void rfidReader_IdReceived(RFIDReader sender, string e)
 {
     if (waitingForRfid)     //check whether user has initiated RFID readig process (pressed ENTER or EXIT button)
     {
         cancelWaitingRfid();
         if (authInProgress == false)        //check whether another authentication process is already in progress
         {
             //Debug.Print("RFID scanned: " + e);
             scannedRFID = e;
             if (camera.CameraReady)
             {
                 displayMessage("RFID scanned, capturing photo..", false);       //display message to user without OK button
                 authInProgress = true;
                 camera.TakePicture();
             }
             else
             {
                 //Debug.Print("RFID received but camera not ready");
             }
         }
         else
         {
             //Debug.Print("RFID received but authentication already in progress");
         }
     }
     else
     {
         //Debug.Print("RFID received but no action selected");
     }
 }
Exemplo n.º 22
0
 public MainPage()
 {
     this.InitializeComponent();
     this._rfidReader            = new RFIDReader();
     this._rfidReader.OnDataTag += new RFIDDataHandler(this.GetTagData);
     this._rfidReader.Start();
 }
Exemplo n.º 23
0
        //get the connection details
        public bool FunctionRFIDConnection_Parking()
        {
            try
            {
                Parking_readerAPI = new RFIDReader(strParkingIPaddress, Convert.ToUInt32(strParkingPort), 0);
                Parking_readerAPI.Connect();
            }
            catch (Exception ex)
            {
                //MessageBox.Show("Exception : Network Problem or Connection Already Exists...");
                lblErrorMessage.Text = "Exception : Network Problem or Connection Already Exists...";
                //if (ex.Message == "Connect")
                //{
                //    lblErrorMessage.Text = "Exception : Connection Already Exists...";
                //    tnrNetworkConnection.Enabled = false;
                //}
                //else
                //{
                //    lblErrorMessage.Text = "Exception : Network Problem...";
                //}
                btnParkingAreaReaderDisconnect.Enabled = false;
                btnParkingAreaReaderConnect.Enabled    = true;

                return(false);
            }
            try
            {
                if (Parking_readerAPI.IsConnected)
                {
                    Parking_readerAPI.Actions.TagAccess.OperationSequence.DeleteAll();

                    TagAccess.Sequence.Operation op = new TagAccess.Sequence.Operation();
                    op.AccessOperationCode = ACCESS_OPERATION_CODE.ACCESS_OPERATION_READ;

                    op.ReadAccessParams.ByteCount = 0;

                    Parking_readerAPI.Actions.TagAccess.OperationSequence.Add(op);
                    Parking_readerAPI.Actions.TagAccess.OperationSequence.PerformSequence();
                }

                //Parking_readerAPI.Config.GPO[1].PortState = GPOs.GPO_PORT_STATE.TRUE;
                //Parking_readerAPI.Config.GPO[2].PortState = GPOs.GPO_PORT_STATE.TRUE;
                //Parking_readerAPI.Config.GPO[3].PortState = GPOs.GPO_PORT_STATE.TRUE;

                //Thread.Sleep(500);

                //Parking_readerAPI.Config.GPO[1].PortState = GPOs.GPO_PORT_STATE.FALSE;
                //Parking_readerAPI.Config.GPO[2].PortState = GPOs.GPO_PORT_STATE.FALSE;
                //Parking_readerAPI.Config.GPO[3].PortState = GPOs.GPO_PORT_STATE.FALSE;

                tmrParkingArea.Enabled = true;
                nwflag = 0;
                return(true);
            }
            catch (Exception ex)
            {
                MessageBox.Show("Exception : " + ex.Message.ToString());
                return(false);
            }
        }
Exemplo n.º 24
0
 protected override void OnDestroy()
 {
     base.OnDestroy();
     try
     {
         if (Reader != null)
         {
             Reader.Events.RemoveEventsListener(eventHandler);
             Reader.Disconnect();
             Toast.MakeText(ApplicationContext, "Disconnecting reader", ToastLength.Long).Show();
             Reader = null;
             readers.Dispose();
             readers = null;
         }
     }
     catch (InvalidUsageException e)
     {
         e.PrintStackTrace();
     }
     catch (OperationFailureException e)
     {
         e.PrintStackTrace();
     }
     catch (Exception e)
     {
         e.StackTrace.ToString();
     }
 } // OnDestroy()
Exemplo n.º 25
0
 //Used for service methods. Do not alter method signature
 public bool Start()
 {
     //log.InfoFormat("start");
     server     = new Server();
     rfidReader = new RFIDReader();
     log.InfoFormat("Service has started");
     server.Listen(IPADDRESS, PORT);
     server.AcceptTcpClientAsync();
     log.InfoFormat("client accepted");
     while (!rfidReader.impinjReader.IsConnected)
     {
         try
         {
             rfidReader.Start();
             rfidReader.impinjReader.TagsReported   += OnTagsReported;
             rfidReader.impinjReader.ConnectionLost += OnConnectionLost;
             log.InfoFormat("Reader started");
         } catch (OctaneSdkException ose)
         {
             log.Info(ose.Message);
         }
         Thread.Sleep(3000);
     }
     return(true);
 }
Exemplo n.º 26
0
        public SimpleRFID()
        {
            try {
                m_ReaderAPI = new RFIDReader("localhost", 5084, 0);
                m_ReaderAPI.Connect();

                m_TagTable = new Hashtable(1023);

                m_ReaderAPI.Events.NotifyInventoryStartEvent    = true;
                m_ReaderAPI.Events.NotifyInventoryStopEvent     = true;
                m_ReaderAPI.Events.NotifyAccessStartEvent       = true;
                m_ReaderAPI.Events.NotifyAccessStopEvent        = true;
                m_ReaderAPI.Events.NotifyAntennaEvent           = true;
                m_ReaderAPI.Events.NotifyBufferFullEvent        = true;
                m_ReaderAPI.Events.NotifyBufferFullWarningEvent = true;
                m_ReaderAPI.Events.NotifyReaderExceptionEvent   = true;
                m_ReaderAPI.Events.NotifyReaderDisconnectEvent  = true;
                m_ReaderAPI.Events.NotifyHandheldTriggerEvent   = true;
                m_ReaderAPI.Events.StatusNotify += new Events.StatusNotifyHandler(Events_StatusNotify);
                m_ReaderAPI.Events.ReadNotify   += new Events.ReadNotifyHandler(Events_ReadNotify);
            }
            catch (Exception exc) {
                MessageBox.Show("Error conexión localhost", "Error",
                                MessageBoxButtons.OK, MessageBoxIcon.Hand, MessageBoxDefaultButton.Button1);
                Application.Exit();
            }
        }
Exemplo n.º 27
0
        public void Setup()
        {
            _revievedEventArgs = null;
            _uut = new RFIDReader();
            _uut.OnRfidRead(10);

            _uut.RFIDReaderEvent += (o, args) => { _revievedEventArgs = args; };
        }
Exemplo n.º 28
0
 public frmSGMStore()
 {
     InitializeComponent();
     m_service         = new SGM_Service.ServiceSoapClient();
     frmMsg            = new frmSGMMessage();
     serialDatahandler = new SerialDataReceivedEventHandler(CardReaderReceivedHandler);
     RFIDReader.RegistryReaderListener(Program.ReaderPort, serialDatahandler);
 }
Exemplo n.º 29
0
 public FormSet(RFIDReader mRFIDReader)
 {
     InitializeComponent();
     txtServiceAddress.Text = Service.Url;
     txtRFID_IP.Text        = XmlTool.Read("Root/IP");
     txtRFID_Port.Text      = XmlTool.Read("Root/Port");
     this.mRFIDReader       = mRFIDReader;
 }
Exemplo n.º 30
0
        // ********************************************************************
        // RFID Connection Methods
        // ********************************************************************

        private void OpenRFIDConnection()
        {
            // Do this in MainActivity to test connection so we can notify user if they need to wake slep up

            if (readers == null)
            {
                readers = new Readers(this, ENUM_TRANSPORT.ServiceSerial);
            }
            ThreadPool.QueueUserWorkItem(o =>
            {
                try
                {
                    if (readers != null && readers.AvailableRFIDReaderList != null)
                    {
                        availableRFIDReaderList = readers.AvailableRFIDReaderList;
                        if (availableRFIDReaderList.Count > 0)
                        {
                            if (Reader == null)
                            {
                                // get first reader from list
                                readerDevice = availableRFIDReaderList[0];
                                Reader       = readerDevice.RFIDReader;
                                // Establish connection to the RFID Reader
                                Reader.Connect();
                                if (Reader.IsConnected)
                                {
                                    //Console.Out.WriteLine("Readers connected");
                                    serialRFD2000        = Reader.ReaderCapabilities.SerialNumber;
                                    rfidScannerConnected = true;
                                }
                            }
                            else
                            {
                                rfidScannerConnected = true;
                            }
                        }
                        else
                        {
                            rfidScannerConnected = false;
                        }
                    }
                    else
                    {
                        rfidScannerConnected = false;
                    }
                }
                catch (InvalidUsageException e)
                {
                    e.PrintStackTrace();
                }
                catch
                (OperationFailureException e)
                {
                    e.PrintStackTrace();
                    //Log.Debug(TAG, "OperationFailureException " + e.VendorMessage);
                }
            });
        }
Exemplo n.º 31
0
        public void Setup()
        {
            _receivedScanEventArgs = null;

            _uut = new RFIDReader();

            //Event listener:
            _uut.ScanEvent += (o, args) => { _receivedScanEventArgs = args; };
        }
Exemplo n.º 32
0
        void rfidReader_IdReceived(RFIDReader sender, string e)
        {
            Debug.Print("Rfid Event!");
            statusLED.BlinkOnce(Gadgeteer.Color.White);

            Thread t = new Thread(() => SendRfidEvent());

            t.Start();
        }
Exemplo n.º 33
0
        private static void TestRfid()
        {
            RFIDReader rfid = new RFIDReader(FEZRaptor.Socket11.SerialPortName);

            rfid.IdReceived += (RFIDReader sender, string e) =>
            {
                Debug.WriteLine(e);
            };
            Thread.Sleep(Timeout.Infinite);
        }
Exemplo n.º 34
0
 private void MainFrame_Deactivate(object sender, EventArgs e)
 {
     try
     {
         RFIDReader.Disconnect();
     }
     catch
     {
     }
 }
Exemplo n.º 35
0
        public Impinj(ReaderDetails readerInfo)
        {
            try
            {
                rdrInfo = readerInfo;
                objMotorolaReader = new RFIDReader(rdrInfo.IPAddress, rdrInfo.PortNumber, 10000);

            }
            catch (Exception ex)
            {
                throw new Exception("Unable to create object. " + ex.Message);
            }
        }
Exemplo n.º 36
0
        public Manager()
        {
            InitializeComponent();

            uint port = 5084;
            _ReaderAPI = new RFIDReader("127.0.0.1", port, 0);

            _Device = new DeviceSettings(_ReaderAPI);
            _TagEventHandler = new TagEventHandler(_ReaderAPI, _Device.DeviceID);
            _TagEvent = new TagEventDelegate(_TagEventHandler.newTagEvent);

            Connect();
        }
        public FrmBarcodeScanSearch(StartAudit_Form appForm)
        {
            InitializeComponent();
            this.m_appForm = appForm;
            status = "Connect";
            this.m_UpdateReadHandler = new UpdateRead(myUpdateRead);
            this.m_UpdateStatusHandler = new UpdateStatus(myUpdateStatus);
            this.m_ReadTag = new Symbol.RFID3.TagData();

            m_ReaderAPI = m_appForm.m_ReaderAPI;
            m_ReaderAPI = new RFIDReader("127.0.0.1", 5084, 0);

            this.m_AntennaInfoForm = m_appForm.m_AntennaInfoForm;
            this.m_AntennaConfigForm = m_appForm.m_AntennaConfigForm;
            this.m_PostFilterForm = m_appForm.m_PostFilterForm;
            this.m_AccessFilterForm = m_appForm.m_AccessFilterForm;
            this.m_TriggerForm = m_appForm.m_TriggerForm;

            this.m_ReaderMgmt = new ReaderManagement();
            this.m_TagTable = new Hashtable(1023);
            this.m_AccessOpResult = new AccessOperationResult();
            this.m_IsConnected = false;
            this.m_TagTotalCount = 0;
            this.m_ReaderInitiatedDisconnectionReceived = false;
            this.m_isBeepingEnabled = true;

            //Barcode scan start
            try
            {
                // Let's use the first available scanner.
                scanner = new Barcode2();
            }
            catch (Exception ex)
            {
                MessageBox.Show("Barcode2 instantiation failed with " + ex.Message);
                this.Close();
                return;
            }

            // Let's use triggers to fire up the scanner.
            scanner.Config.TriggerMode = TRIGGERMODES.HARD;

            // Register a scan event handler
            //scanner.OnScan += new Barcode2.OnScanHandler(barcode21_OnScan);
            scanner.OnScan += new Barcode2.OnScanHandler(barcode21_OnScan);
               // scanner.OnStatus += new Barcode2.OnStatusHandler(barcode21_OnStatus);

            //Barcode scan end
        }
Exemplo n.º 38
0
        public MotorolaFX(ReaderDetails readerInfo)
        {
            try
            {
                rdrInfo = readerInfo;
                objMotorolaReader = new RFIDReader();
                objMotorolaReader.HostName =rdrInfo.IPAddress;
                objMotorolaReader.Port = rdrInfo.PortNumber;
                objMotorolaReader.TimeoutMilliseconds = 0;

            }
            catch (Exception ex)
            {
                throw new Exception("Unable to create object. " + ex.Message);
            }
        }
Exemplo n.º 39
0
 //private TagEventHandler _Handler;
 public TagListView(TagEventHandler handler, string header, List<string> items)
 {
     InitializeComponent();
     _ReaderAPI = handler.ReaderAPI;
     handler.Processor = new TagListViewProcessor(item_LV);
     item_LV.Columns[0].Text = header;
     item_LV.BeginUpdate();
     ListViewItem lvItem;
     foreach (string item in items)
     {
         lvItem = new ListViewItem(item);
         lvItem.Checked = true;
         item_LV.Items.Add(lvItem);
     }
     item_LV.EndUpdate();
 }
        private void Initialize()
        {
            try
            {
                if (_reader != null)
                {
                    _reader.Events.ReadNotify -= new Events.ReadNotifyHandler(Events_ReadNotify);
                }

                //create RFIDReader using the default values and connect
                _reader = new RFIDReader(hostname, port, timeoutMs);
                _reader.Connect();

                //We are going to read just individual tags, attach tag data with read event
                _reader.Events.AttachTagDataWithReadEvent = true;

                //register read tag event notification
                _reader.Events.ReadNotify += new Events.ReadNotifyHandler(Events_ReadNotify);

                //Set up start and stop triggers to be handheld trigger
                _triggerInfo = new TriggerInfo();

                _triggerInfo.StartTrigger.Type = START_TRIGGER_TYPE.START_TRIGGER_TYPE_HANDHELD;
                _triggerInfo.StartTrigger.Handheld.HandheldEvent = HANDHELD_TRIGGER_EVENT_TYPE.HANDHELD_TRIGGER_PRESSED;

                _triggerInfo.StopTrigger.Type = STOP_TRIGGER_TYPE.STOP_TRIGGER_TYPE_HANDHELD_WITH_TIMEOUT;
                _triggerInfo.StopTrigger.Handheld.HandheldEvent = HANDHELD_TRIGGER_EVENT_TYPE.HANDHELD_TRIGGER_RELEASED;
                _triggerInfo.StopTrigger.Handheld.Timeout = 0; // 0 = no timeout setting

                /* Setup inventory operation on the reader on the connected antenna, using the handheld trigger.
                 * Inventory starts when the handheld trigger is pressed and stops when released */
                _reader.Actions.Inventory.Perform(null, _triggerInfo, null);

            }
            catch (OperationFailureException ex)
            {
                throw new ApplicationException(String.Format("RFIDReader Initialization Error:{0}", ex.StatusDescription));
            }
        }
Exemplo n.º 41
0
        internal void Connect(string status)
        {
            Cursor.Show();
            Cursor.Current = Cursors.WaitCursor;
            if (status == "Connect")
            {
                m_ReaderAPI = new RFIDReader("127.0.0.1", 5084, 0);

                try
                {
                    m_ReaderAPI.Connect();

                    /*
                     * Label setup
                     */
                    status = "Disconnect";
                    btnstarttstop.Text = "Start";
                    m_isReading = false;

                    try
                    {
                        // DiscardTagsOnInventoryStop enables faster processing of the stop operation
                        // by avoiding processing of tags that are still being received from the reader.
                        TagStorageSettings tagStorageSettings = m_ReaderAPI.Config.GetTagStorageSettings();
                        tagStorageSettings.DiscardTagsOnInventoryStop = true;
                        m_ReaderAPI.Config.SetTagStorageSettings(tagStorageSettings);
                        /*
                         *  Events Registration
                         */
                        this.m_ReaderAPI.Events.AttachTagDataWithReadEvent = false;
                        this.m_ReaderAPI.Events.ReadNotify += new Events.ReadNotifyHandler(Events_ReadNotify);
                        this.m_ReaderAPI.Events.StatusNotify += new Events.StatusNotifyHandler(Events_StatusNotify);
                        this.m_ReaderAPI.Events.NotifyBufferFullWarningEvent = true;
                        this.m_ReaderAPI.Events.NotifyBufferFullEvent = true;
                        this.m_ReaderAPI.Events.NotifyReaderDisconnectEvent = true;
                        this.m_ReaderAPI.Events.NotifyAccessStartEvent = true;
                        this.m_ReaderAPI.Events.NotifyAccessStopEvent = true;
                        this.m_ReaderAPI.Events.NotifyInventoryStartEvent = true;
                        this.m_ReaderAPI.Events.NotifyInventoryStopEvent = true;
                        this.m_ReaderAPI.Events.NotifyReaderExceptionEvent = true;
                        this.m_ReaderAPI.Events.NotifyHandheldTriggerEvent = true;

                    }
                    catch (OperationFailureException ofe)
                    {
                        notifyUser(ofe.VendorMessage, "Connect Configuration");
                    }
                }
                catch (OperationFailureException ofe)
                {
                    notifyUser(ofe.StatusDescription, "Connect");
                }
            }
            else if (status == "Disconnect")
            {
                if (!m_ReaderInitiatedDisconnectionReceived)
                {
                    try
                    {
                        m_ReaderAPI.Events.ReadNotify -= Events_ReadNotify;
                        m_ReaderAPI.Events.StatusNotify -= Events_StatusNotify;
                        StopReading();
                        m_ReaderAPI.Disconnect();
                    }
                    catch (OperationFailureException ofe)
                    {
                        notifyUser(ofe.VendorMessage, "Connect");
                    }
                }

                status = "Connect";
                this.btnstarttstop.Enabled = false;
            }
            m_IsConnected = m_ReaderAPI.IsConnected;
            Cursor.Current = Cursors.Default;
        }
Exemplo n.º 42
0
        private void Connect()
        {
            uint port = 5084;
            _ReaderAPI = new RFIDReader("127.0.0.1", port, 0);

            try
            {
                _ReaderAPI.Connect();
                _Device.configureAntenna();
                /*
                 * Setup Events
                 */
                _ReaderAPI.Events.AttachTagDataWithReadEvent = false;
                _ReaderAPI.Events.ReadNotify += new Events.ReadNotifyHandler(Events_ReadNotify);
                _ReaderAPI.Events.StatusNotify += new Events.StatusNotifyHandler(Events_StatusNotify);
                _ReaderAPI.Events.NotifyBufferFullWarningEvent = true;
                _ReaderAPI.Events.NotifyReaderDisconnectEvent = true;

                _IsConnected = _ReaderAPI.IsConnected;

            }
            catch (OperationFailureException ofe)
            {
                userNotification.Text = ofe.Result.ToString();
                userNotification.Visible = true;
            }
        }
Exemplo n.º 43
0
 void rfidReader_IdReceived(RFIDReader sender, string e)
 {
     if (controller != null) controller.Login(e);
 }
        private void convertWriterXML()
        {
            try
            {
                XmlNode reader = _xmldocument.SelectSingleNode("/root/writer");
                if (reader == null)
                {
                    return;
                }
                if (reader.HasChildNodes == true)
                {
                    XmlNodeList readerlist = reader.ChildNodes;
                    foreach (XmlNode node in readerlist)
                    {

                        if (node.Name.Equals("node"))
                        {
                            string ip = node.Attributes["ip"].Value.ToString();
                            string type = node.Attributes["type"].Value.ToString();
                            string position = node.Attributes["position"].Value.ToString();
                            RFIDReader rfid = new RFIDReader();
                            rfid.RFidreaderID = int.Parse(node.Attributes["id"].Value.ToString());
                            rfid.RFidreaderIP = ip;
                            rfid.RFidreaderPosition = position;
                            rfid.RFidreaderType = type;
                            _readerlist.Add(rfid);
                        }
                    }
                }
            }
            catch (Exception e)
            {
                log.Error("读取写读写器信息时出现异常,异常信息为:" + e.Message);
            }
        }
Exemplo n.º 45
0
        internal void Connect(string status)
        {
            if (status == "Connect")
            {
                m_ReaderAPI = new RFIDReader("127.0.0.1", 5084, 0);

                try
                {
                    m_ReaderAPI.Connect();

                    /*
                     * Label setup
                     */
                    //this.Text = m_ConnectionForm.IpText;
                    status = "Disconnect";

                    try
                    {
                        // DiscardTagsOnInventoryStop enables faster processing of the stop operation
                        // by avoiding processing of tags that are still being received from the reader.
                        TagStorageSettings tagStorageSettings = m_ReaderAPI.Config.GetTagStorageSettings();
                        tagStorageSettings.DiscardTagsOnInventoryStop = true;
                        m_ReaderAPI.Config.SetTagStorageSettings(tagStorageSettings);
                        /*
                         *  Events Registration
                         */
                        m_ReaderAPI.Events.AttachTagDataWithReadEvent = false;
                        m_ReaderAPI.Events.NotifyBufferFullWarningEvent = true;
                        m_ReaderAPI.Events.NotifyBufferFullEvent = true;
                        m_ReaderAPI.Events.NotifyReaderDisconnectEvent = true;
                        m_ReaderAPI.Events.NotifyAccessStartEvent = true;
                        m_ReaderAPI.Events.NotifyAccessStopEvent = true;
                        m_ReaderAPI.Events.NotifyInventoryStartEvent = true;
                        m_ReaderAPI.Events.NotifyInventoryStopEvent = true;
                        m_ReaderAPI.Events.NotifyReaderExceptionEvent = true;
                        m_ReaderAPI.Events.NotifyHandheldTriggerEvent = true;
                    }
                    catch (Symbol.RFID3.OperationFailureException ofe)
                    {
                        notifyUser(ofe.VendorMessage, "Connect Configuration");
                    }
                }
                catch (Symbol.RFID3.OperationFailureException ofe)
                {
                    notifyUser(ofe.StatusDescription, "Connect");
                }
            }
            else if (status == "Disconnect")
            {
                if (!m_ReaderInitiatedDisconnectionReceived)
                {
                    try
                    {
                        m_ReaderAPI.Disconnect();
                    }
                    catch (Symbol.RFID3.OperationFailureException ofe)
                    {
                        notifyUser(ofe.VendorMessage, "Connect");
                    }
                }

                this.Text = "NeoPhotonics";
                this.status = "Connect";
            }

            m_IsConnected = m_ReaderAPI.IsConnected;
        }
Exemplo n.º 46
0
 private void RfidReadCallback(RFIDReader sender, string e)
 {
     Debug.Print("Event: Read RFID " + e);
     train.UpdateStation(e);
 }
Exemplo n.º 47
0
 private void MalformedRfidReadCallback(RFIDReader sender, EventArgs e)
 {
     Debug.Print("Event: read malformed RFID, stopping the train");
     train.Stop();
 }