private void ConnectReader() { Cursor.Current = Cursors.WaitCursor; System.Diagnostics.Debug.WriteLine("Opening Reader..."); if (OpenReader() == 0) { System.Diagnostics.Debug.WriteLine("... Reader opened. Trying to set Attributes ..."); //try first command int res = SetAttributes(); if (res != 0) { System.Diagnostics.Debug.WriteLine("... SetAttributes failed! Closing Reader"); m_Reader.Close(); m_Reader = null; } } if (m_Reader != null) { if (m_Reader.IsConnected) { System.Diagnostics.Debug.WriteLine("Reader connected. ChangeStatus(ReadBarcode)"); } else { System.Diagnostics.Debug.WriteLine("Reader connected. ChangeStatus(ReadBarcode)"); } } Cursor.Current = Cursors.Default; }
private void mnuExit_Click(object sender, EventArgs e) { try { m_Symbologies.EnableAll(); m_BCreader.ScannerEnable = true; m_BCreader.Dispose(); m_Reader.Close(); HighBeep.Dispose(); LowBeep.Dispose(); this.Dispose(); } catch { } Application.Exit(); }
private int SetAttributes() { bool bStatus = false; if (m_Reader.IsConnected == false) { return(-1); } sCurrentCMD = "ATTRIB TAGTYPE=EPCC1G2"; // comboBox1.Text; bStatus = ExecuteCMD(sCurrentCMD); if (bStatus == false) { logThis("SetAttrib failed, reader connected?"); return(-1); } else { logThis("RFID Connected"); //This will set the Option IntermecSettings-RFID-Reader 1-Enable Reader //Configuring the DCE Transport Programmatically Using BRI Intermec.DataCollection.RFID.BasicBRIReader DCEConfig = new BasicBRIReader(null); try { DCEConfig.Open("TCP://127.0.0.1:2189"); // BRI ‘device’ command. DCEConfig.Execute("device 1 attrib adminstatus=on"); DCEConfig.Close(); return(0); } catch (BasicReaderException bex) { logThis("SetAttrib() DCEConfig could not connect to DCE: " + bex.Message); return(-2); } catch (Exception ex) { logThis("SetAttrib() DCEConfig exception " + ex.Message); return(-3); } } }