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 int OpenReader() { txtLog.Text = "...\r\n"; BasicBRIReader.LoggerOptions LogOp = new BasicBRIReader.LoggerOptions(); LogOp.LogFilePath = ".\\IDLClassDebugLog.txt"; //LogOp.LogFilePath="\\Program Files\\IP4IDLAPP\\IDLClassDebugLog.txt"; LogOp.ShowNonPrintableChars = true; int res = 0; try { if (m_Reader != null) { CloseReader(); } if (bEnableLogging) { m_Reader = new BasicBRIReader(this, LogOp); } else { m_Reader = new BasicBRIReader(this); } m_Reader.Open(); AddEventHandlers(); mnuEnableLogging.Enabled = false; mnuConnectReader.Enabled = false; mnuDisconnectReader.Enabled = true; } catch (BasicReaderException brx) { Add2List("OpenReader(): " + brx.Message); res = -1; } catch (SystemException sx) { Add2List("OpenReader(): " + sx.Message); res = -2; } Cursor.Current = Cursors.Default; if (res != 0) { System.Threading.Thread.Sleep(5000); } Application.DoEvents(); return(res); }
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); } } }
private int OpenReader() { logThis("OpenReader..."); BasicBRIReader.LoggerOptions LogOp = new BasicBRIReader.LoggerOptions(); LogOp.LogFilePath = ".\\IDLClassDebugLog.txt"; //LogOp.LogFilePath="\\Program Files\\IP4IDLAPP\\IDLClassDebugLog.txt"; LogOp.ShowNonPrintableChars = true; int res = 0; try { if (m_Reader != null) { CloseReader(); } m_Reader = new BasicBRIReader(this, LogOp); m_Reader.Open(); AddEventHandlers(); } catch (BasicReaderException brx) { logThis("BasicReaderException in OpenReader(): " + brx.Message); res = -1; } catch (SystemException sx) { logThis("SystemException in OpenReader(): " + sx.Message); res = -2; } catch (Exception sx) { logThis("Exception in OpenReader(): " + sx.Message); res = -2; } if (res != 0) { System.Threading.Thread.Sleep(5000); } return(res); }
private void mnuConnectReader_Click(object sender, EventArgs e) { Cursor.Current = Cursors.WaitCursor; if (m_BCreader == null) { OpenBCreader(); } if (OpenReader() == 0) { //try first command int res = SetAttributes(); if (res != 0) { m_Reader.Close(); m_Reader = null; } } if (m_Reader != null) { if (m_Reader.IsConnected) { ChangeStatus(eStatus.ReadBarcode);// ReadTag); } else { ChangeStatus(eStatus.Offline); } } else { ChangeStatus(eStatus.Offline); } Cursor.Current = Cursors.Default; }