private void btnStart_Click(object sender, EventArgs e) { #region codes ======================================== if (m_bOpen) { if (!m_bStart) { m_bStart = true; ErrorMessage(0, 0, "Inventorying..."); btnStart.Text = "Parar"; lstView.Items.Clear(); RFID_INVENTORY stInventory = new RFID_INVENTORY(); ACCESS_STATUS stAccessStatus = new ACCESS_STATUS(); //operation in Non-blocking mode stInventory.hWnd = this.Handle; //stInventory.lpfnStartProc = new CallbackDelegate(InvStartProc); //stInventory.lpfnStopProc = new CallbackDelegate(InvStopProc); stInventory.lpfnStopProc = m_fnStopProc; R1000Reader.RFIDInventory(stInventory, ref stAccessStatus, false, 0); } else { R1000Reader.RFIDAbortOperation(); //StopInventory(); } }//end if (m_bOpen) #endregion //end codes }
private void EscrituraRFIDStr() { byte[] bWrite = new byte[96 / 8]; txtEPC.Text = txtEPC.Text.ToLower(); if ((txtEPC.Text.Length % 2) != 0) { txtEPC.Text = "0" + txtEPC.Text; } try { for (int i = 0, j = 0; i < txtEPC.Text.Length; i += 2, j++) { bWrite[j] = (byte)(16 * Utils.GetHex(txtEPC.Text[i])); bWrite[j] += (byte)Utils.GetHex(txtEPC.Text[i + 1]); } RFID_WRITE R = new RFID_WRITE( ); ACCESS_STATUS stAccessStatus = new ACCESS_STATUS(); //Int i //i = 10; //R1000Reader.RFIDTagWrite ( R, ref stAccessStatus, true, i); lblStatus.Text = "Write OK"; } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void TriggerProc(object sender, TriggerEventArgs args) { #region codes ======================================== if (m_bOpen && !m_bStart) { m_bStart = true; RFID_INVENTORY stInventory = new RFID_INVENTORY(); ACCESS_STATUS stAccessStatus = new ACCESS_STATUS(); //operation in Non-blocking mode //stInventory.lpfnStartProc = new CallbackDelegate(InvStartProc); //stInventory.lpfnStopProc = new CallbackDelegate(InvStopProc); stInventory.lpfnStopProc = m_fnStopProc; R1000Reader.RFIDInventory(stInventory, ref stAccessStatus, false, 0); } scanTrigger.DoneTrigger(); #endregion //end codes }
private void RetrieveData(ref ACCESS_STATUS lpAccessStatus, InsertItemDelegate insertItem, Boolean bAdd) { #region codes ======================================== if (lpAccessStatus.dwStatus == 0 && lpAccessStatus.dwErrorCode == 0) { for (int i = 0; i < lpAccessStatus.unAntennas; i++) { ANTENNA_STATUS stAntennaStatus = new ANTENNA_STATUS(); R1000Reader.RFIDGetAntennaStatus(i, ref stAntennaStatus); for (int j = 0; j < stAntennaStatus.unCount; j++) { ACCESS_DATA accessData = new ACCESS_DATA(); UInt32 nRet = R1000Reader.RFIDGetAccessData(i, j, ref accessData); if (nRet == 1 && accessData.unEPCLength > 0) { this.Invoke(insertItem, new object[] { accessData, stAntennaStatus.unAntenna, bAdd }); } } } } #endregion //end codes }
public Int32 InvStopProc([In] IntPtr hWnd, [In] UInt32 nMessage, [In, Out] UInt32 wParam, ref ACCESS_STATUS lpAccessStatus) { #region codes ======================================== ErrorMessageDelegate errorMessage = new ErrorMessageDelegate(ErrorMessage); this.Invoke(errorMessage, new Object[] { (Result)lpAccessStatus.dwStatus, (Int32)lpAccessStatus.dwErrorCode, String.Empty }); InsertItemDelegate insertItem = new InsertItemDelegate(InsertItem); RetrieveData(ref lpAccessStatus, insertItem, true); if (m_bContinue) { if ((Result)lpAccessStatus.dwStatus == Result.OPERATION_CANCELLED) { this.Invoke(new StopInvDelegate(StopInventory)); } } else { this.Invoke(new StopInvDelegate(StopInventory)); } return(1); #endregion //end codes }