public override bool InventoryTags(Tag tag, bool loop, InventoryTagDelegate itd, object context) { STPv3Response response; STPv3Request request = new STPv3Request(); request.Tag = tag; //request.RID = reader.ReaderID; request.Command = STPv3Commands.SELECT_TAG; request.Inventory = true; request.Loop = loop; issue: request.Issue(this.m_device); response = request.GetResponse(); if (response == null) { return(false); } if (response.ResponseCode == STPv3ResponseCode.SELECT_TAG_LOOP_OFF) { goto issue; } while (true) { response = request.GetResponse(); if (response == null) { continue; } if (!response.Success) { return(false); } if (response.ResponseCode == STPv3ResponseCode.SELECT_TAG_PASS) { Tag iTag = new Tag(); iTag.TID = response.TID; iTag.Type = response.TagType; //BTM - If we are simply performing an inventory then we let it run to //completion to prevent later synchronization issues if (itd(iTag, context) && loop) { return(true); } } } }
/** * Meathod to check if there is a tag * * @param usbdevice - the device that needs to be checked * */ private void getTag(USBDevice usbdevice, int currPort) { //Console.Out.WriteLine("Checking for tags"); STPv3Response localResponse; try { //issue the request //if there is a responce and it is a success print out a line that has the following format // <Tag_ID>.<port> TagRequest.Issue(usbdevice); //Console.Out.WriteLine("Request issued"); localResponse = TagRequest.GetResponse(); while (localResponse != null && localResponse.Success) { if (localResponse.ResponseCode == STPv3ResponseCode.SELECT_TAG_PASS) { String localCard; // ID antenna if (currPort == 812) { localCard = formatCard(localResponse, "8C"); } // Hand antenna else { localCard = formatCard(localResponse, Convert.ToString(currPort)); } //Console.Out.WriteLine("Sending : " + localCard); sendCard(localCard); return; } Thread.Sleep(50); localResponse = TagRequest.GetResponse(); } //Console.Out.WriteLine("No card"); sendCard("NOCARD"); } catch (Exception ex) { Console.Out.WriteLine(ex.StackTrace); } }
/// <summary> /// Uploads new firmware to a reader. Takes a string containing the path to the .shf file /// </summary> /// <param name="file">Path to .shf file. String.</param> /// <returns></returns> public bool UploadFirmware(string file) { STPv3Request request = new STPv3Request(); request.RID = this.m_RID; request.Command = STPv3Commands.ENTER_BOOTLOAD; issue: request.Issue(this.m_device); STPv3Response response = request.GetResponse(); if (response == null) { return(false); } if (response.ResponseCode == STPv3ResponseCode.SELECT_TAG_LOOP_OFF) { goto issue; } if (!response.Success) { return(false); } STPv3Request.UploadFirmware(this.m_device, file); return(true); }
public override bool SelectTag(ref Tag tag) { STPv3Request request = new STPv3Request(); request.Tag = tag; request.RID = this.m_RID; request.Command = STPv3Commands.SELECT_TAG; issue: request.Issue(this.m_device); STPv3Response response = request.GetResponse(); if (response == null) { return(false); } if (response.ResponseCode == STPv3ResponseCode.SELECT_TAG_LOOP_OFF) { goto issue; } if (!response.Success) { return(false); } tag.TID = response.TID; if (tag.Type == 0x0000) { tag.Type = response.TagType; } return(true); }
/// <summary> /// Writes a new default system parameter. Address denotes parameter /// </summary> /// <param name="data">Data to write</param> /// <param name="address">Address to write to</param> /// <param name="blocks">Number of blocks to write</param> public bool StoreDefaultParameter(byte[] data, ushort address, ushort blocks) { STPv3Request request = new STPv3Request(); request.Command = STPv3Commands.STORE_DEFAULT_SYSTEM_PARAMETER; request.Address = address; request.Blocks = blocks; request.Data = data; request.RID = this.m_RID; issue: request.Issue(this.m_device); STPv3Response response = request.GetResponse(); if (response == null) { return(false); } if (response.ResponseCode == STPv3ResponseCode.SELECT_TAG_LOOP_OFF) { goto issue; } if (!response.Success) { return(false); } return(true); }
/// <summary> /// Reads a stored default parameter from the reader. Address denotes parameter /// </summary> /// <param name="address">Address to read from</param> /// <param name="blocks">Number of blocks to write</param> /// <returns>Return null if read failed, data otherwise</returns> public byte[] RetrieveDefaultParameter(ushort address, ushort blocks) { STPv3Request request = new STPv3Request(); request.Command = STPv3Commands.RETRIEVE_DEFAULT_SYSTEM_PARAMETER; request.Address = address; request.Blocks = blocks; request.RID = this.m_RID; issue: request.Issue(this.m_device); STPv3Response response = request.GetResponse(); if (response == null) { return(null); } if (response.ResponseCode == STPv3ResponseCode.SELECT_TAG_LOOP_OFF) { goto issue; } if (!response.Success) { return(null); } return(response.Data); }
public Boolean SetMux(byte port) { byte[] p = new byte[1]; p[0] = port; STPv3Response response; STPv3Request requestMux = new STPv3Request(); requestMux.Command = STPv3Commands.WRITE_SYSTEM_PARAMETER; requestMux.Address = 0x000A; requestMux.Blocks = 0x01; requestMux.Data = p; try { requestMux.Issue(device); response = requestMux.GetResponse(); if (response != null && response.ResponseCode == STPv3ResponseCode.WRITE_SYSTEM_PARAMETER_PASS) { return(true); } } catch (Exception ex) { Console.Out.WriteLine("EXCEPTION:" + ex.ToString()); throw; } Console.Out.WriteLine("********** SetMux FAILED ***********"); errors++; return(false); }
public override bool WriteTagData(Tag tag, byte[] data, ushort address, ushort blocks) { STPv3Request request = new STPv3Request(); request.Tag = tag; request.Command = STPv3Commands.WRITE_TAG; request.Data = data; request.Address = address; request.Blocks = blocks; request.RID = this.m_RID; issue: request.Issue(this.m_device); STPv3Response response = request.GetResponse(); if (response == null) { return(false); } if (response.ResponseCode == STPv3ResponseCode.SELECT_TAG_LOOP_OFF) { goto issue; } if (!response.Success) { return(false); } return(true); }
public override byte[] ReadTagData(Tag tag, ushort address, ushort blocks) { STPv3Request request = new STPv3Request(); request.Tag = tag; request.Command = STPv3Commands.READ_TAG; request.Address = address; request.Blocks = blocks; request.RID = this.m_RID; issue: request.Issue(this.m_device); STPv3Response response = request.GetResponse(); if (response == null) { return(null); } if (response.ResponseCode == STPv3ResponseCode.SELECT_TAG_LOOP_OFF) { goto issue; } if (!response.Success) { return(null); } return(response.Data); }
static void Main(string[] args) { SerialDevice sd; STPv3Reader reader; STPv3Request request; STPv3Response response; Tag tag = new Tag(); tag.Type = TagType.AUTO_DETECT; string port; byte[] resp; float temp; if (args.Length < 1) port = "COM1"; else port = args[0]; sd = new SerialDevice(); reader = new STPv3Reader(sd); try { sd.Address = port; sd.BaudRate = 38400; sd.Open(); // read product code, reader name, hw version, fw version, and reader ID Console.Out.WriteLine(String.Format("Product Code: {0}", reader.ProductCode)); Console.Out.WriteLine(String.Format("Reader Name: {0}", reader.ReaderName)); Console.Out.WriteLine(String.Format("Hardware Version: {0}", reader.HardwareVersion)); Console.Out.WriteLine(String.Format("Firmware Version: {0}", reader.FirmwareVersion)); Console.Out.WriteLine(String.Format("Reader ID: {0}", String.Join("", Array.ConvertAll<byte, string>(reader.ReaderID, delegate(byte value){ return String.Format("{0:X2}", value); })))); //scan for tags request = new STPv3Request(); request.Tag = tag; request.Command = STPv3Commands.SELECT_TAG; request.Inventory = true; request.Issue(sd); while (((response = request.GetResponse()) != null) && (response.Success)) { if (response.ResponseCode == STPv3ResponseCode.SELECT_TAG_PASS) { Console.Out.WriteLine(String.Format("Tag found: {0} -> {1}", Enum.GetName(typeof(SkyeTek.Tags.TagType), response.TagType), String.Join("", Array.ConvertAll<byte, string>(response.TID, delegate(byte value) { return String.Format("{0:X2}", value); })))); } } } catch (Exception ex) { Console.Out.WriteLine(ex.ToString()); } Console.In.ReadLine(); }
//Opens a specific mux port public Boolean SetMuxPort(byte port) { //used for WRITE_SYSTEM_PARAMETER which expects an array of bytes //the data field for the mux system parameter is 1 byte in length byte[] p = new byte[1]; p[0] = port; //Build switch mux request. STPv3Response response; STPv3Request requestMux = new STPv3Request(); requestMux.Command = STPv3Commands.WRITE_SYSTEM_PARAMETER; requestMux.Address = 0x000A; requestMux.Blocks = 0x01; requestMux.Data = p; //send request try { requestMux.Issue(device); response = requestMux.GetResponse(); if (response != null && response.ResponseCode == STPv3ResponseCode.WRITE_SYSTEM_PARAMETER_PASS) { return(true); } } catch (Exception ex) { Console.Out.WriteLine("EXCEPTION:" + ex.ToString()); } return(false); }
public List <byte[]> GetTagsByteArray() { byteArrayTagList.Clear(); STPv3Response response; STPv3Request requestTag = new STPv3Request(); requestTag.Tag = tag; requestTag.Command = STPv3Commands.SELECT_TAG; requestTag.Inventory = true; try { requestTag.Issue(device); response = requestTag.GetResponse(); if (response == null) { Console.Out.WriteLine("********** GetTags NULL RESPONSE ***********"); errors++; return(byteArrayTagList); } while (response.ResponseCode != STPv3ResponseCode.SELECT_TAG_INVENTORY_DONE) { if (response.ResponseCode == STPv3ResponseCode.SELECT_TAG_PASS) { byteArrayTagList.Add(response.TID); } response = requestTag.GetResponse(); if (response == null) { Console.Out.WriteLine("********** GetTags NULL RESPONSE ***********"); errors++; return(byteArrayTagList); } } } catch (Exception ex) { Console.Out.WriteLine("EXCEPTION:" + ex.ToString()); throw; } return(byteArrayTagList); }
public List<byte[]> GetTagsByteArray() { byteArrayTagList.Clear(); STPv3Response response; STPv3Request requestTag = new STPv3Request(); requestTag.Tag = tag; requestTag.Command = STPv3Commands.SELECT_TAG; requestTag.Inventory = true; try { requestTag.Issue(device); response = requestTag.GetResponse(); if (response == null) { Console.Out.WriteLine("********** GetTags NULL RESPONSE ***********"); errors++; return byteArrayTagList; } while (response.ResponseCode != STPv3ResponseCode.SELECT_TAG_INVENTORY_DONE) { if (response.ResponseCode == STPv3ResponseCode.SELECT_TAG_PASS) { byteArrayTagList.Add(response.TID); } response = requestTag.GetResponse(); if (response == null) { Console.Out.WriteLine("********** GetTags NULL RESPONSE ***********"); errors++; return byteArrayTagList; } } } catch (Exception ex) { Console.Out.WriteLine("EXCEPTION:" + ex.ToString()); throw; } return byteArrayTagList; }
public bool SendTagPassword(byte[] password) { STPv3Request request = new STPv3Request(); STPv3Response response; request.Tag = tag; request.Command = STPv3Commands.SEND_TAG_PASSWORD; request.Data = password; request.Issue(device); response = request.GetResponse(); if ((response != null) && (response.Success)) { return(true); } return(false); }
//Perform an Inventory Select to get a list of all tags in the field public ArrayList GetTags() { //start each time with empty list tagList.Clear(); //Build select tag request. STPv3Response response; STPv3Request requestTag = new STPv3Request(); requestTag.Tag = tag; requestTag.Command = STPv3Commands.SELECT_TAG; requestTag.Inventory = true; try { requestTag.Issue(device); while (true) { response = requestTag.GetResponse(); if (response.ResponseCode == STPv3ResponseCode.SELECT_TAG_PASS) { // Add tag to list string tid = String.Join("", Array.ConvertAll <byte, string>(response.TID, delegate(byte value) { return(String.Format("{0:X2}", value)); })); tagList.Add(response.TagType + "-" + tid); } if (response.ResponseCode == STPv3ResponseCode.SELECT_TAG_INVENTORY_DONE) { Debug.Print("INVENTORY DONE"); break; } //If no tags in the field, Reader returns selectTag Fail if (response.ResponseCode == STPv3ResponseCode.SELECT_TAG_FAIL) { Debug.Print("LOOP TAG OFF"); break; } } } catch (Exception ex) { Console.Out.WriteLine("EXCEPTION:" + ex.ToString()); } return(tagList); }
public bool Select() { STPv3Request request = new STPv3Request(); STPv3Response response; request.Tag = tag; request.Command = STPv3Commands.SELECT_TAG; request.Issue(device); response = request.GetResponse(); if (response != null && response.ResponseCode == STPv3ResponseCode.SELECT_TAG_PASS) { return true; } else { return false; } }
public bool WritePassword(byte[] password) { STPv3Request request = new STPv3Request(); STPv3Response response; request.Tag = tag; request.Command = STPv3Commands.WRITE_TAG; request.Data = password; request.Address = 0x0002; request.Blocks = 2; request.Issue(device); response = request.GetResponse(); if ((response != null) && (response.Success)) { return(true); } return(false); }
public bool Select() { STPv3Request request = new STPv3Request(); STPv3Response response; request.Tag = tag; request.Command = STPv3Commands.SELECT_TAG; request.Issue(device); response = request.GetResponse(); if (response != null && response.ResponseCode == STPv3ResponseCode.SELECT_TAG_PASS) { return(true); } else { return(false); } }
public bool WriteLock(byte[] lock_data) { STPv3Request request = new STPv3Request(); STPv3Response response; request.Tag = tag; request.Command = STPv3Commands.WRITE_TAG; request.Data = lock_data; request.Address = 0x0000; request.Blocks = 0; request.Lock = true; request.Issue(device); response = request.GetResponse(); if ((response != null) && (response.Success)) { return(true); } return(false); }
public byte[] ReadEPC() { STPv3Request request = new STPv3Request(); STPv3Response response; request.Tag = tag; request.Command = STPv3Commands.READ_TAG; request.Address = 0x1002; request.Blocks = 6; request.Issue(device); response = request.GetResponse(); if ((response != null) && (response.Success)) { return response.Data; } else { return new byte[] { }; } }
public byte[] ReadEPC() { STPv3Request request = new STPv3Request(); STPv3Response response; request.Tag = tag; request.Command = STPv3Commands.READ_TAG; request.Address = 0x1002; request.Blocks = 6; request.Issue(device); response = request.GetResponse(); if ((response != null) && (response.Success)) { return(response.Data); } else { return(new byte[] { }); } }
public static void sendDataRequest(STPv3Command cmmd, ushort adress, ushort block, USBDevice device, byte[] data) { STPv3Response responce; STPv3Request request; try { request = new STPv3Request(); //Read serial number from reader request.Command = cmmd; request.Address = adress; request.Blocks = block; request.Data = data; request.Issue(device); responce = request.GetResponse(); //if ((responce == null) || (!responce.Success)) //{ // Console.Out.WriteLine("No Reponce"); // Console.In.Read(); // return; //} //Console.Out.WriteLine(String.Format("Serial Number:{0}", // String.Join("", Array.ConvertAll<byte, string> // (responce.Data, delegate(byte value) // { // return String.Format("{0:X2}", value); // })))); } catch (Exception ex) { Console.Out.WriteLine(ex.ToString()); } }
/// <summary> /// Writes a system parameter to the reader. Address denotes parameter /// </summary> /// <param name="data">Data to be written</param> /// <param name="address">Address to write to</param> /// <param name="blocks">Number of blocks to write</param> public bool WriteSystemParameter(byte[] data, ushort address, ushort blocks) { STPv3Request request = new STPv3Request(); request.Command = STPv3Commands.WRITE_SYSTEM_PARAMETER; request.Address = address; request.Blocks = blocks; request.Data = data; request.RID = this.m_RID; issue: request.Issue(this.m_device); STPv3Response response = request.GetResponse(); if (response == null) { return(false); } if (response.ResponseCode == STPv3ResponseCode.SELECT_TAG_LOOP_OFF) { goto issue; } if (!response.Success) { return(false); } if (address == 4) // Reader ID is being set { request.Data.CopyTo(this.m_RID, 0); } return(true); }
/** * Sends a request with data attached to it * * @param cmmd - command to be used * @param adress - the adress of the memory * @param block - the blocks of memory * @param device - the device * @param data - the data to be sent * */ private void sendDataRequest(STPv3Command cmmd, ushort adress, ushort block, USBDevice device, byte[] data) { //Console.Out.WriteLine("sendDataRequest called"); try { //set parameters STPv3Request SystemRequest = new STPv3Request(); SystemRequest.Command = cmmd; SystemRequest.Address = adress; SystemRequest.Blocks = block; SystemRequest.Data = data; //issue the command STPv3Response response; SystemRequest.Issue(device); //Console.Out.WriteLine("Command sent"); while (true) { response = SystemRequest.GetResponse(); //Console.Out.WriteLine("Got response " + response); if (response != null && response.ResponseCode == STPv3ResponseCode.WRITE_SYSTEM_PARAMETER_PASS) { break; } Thread.Sleep(50); } } catch (Exception ex) { Console.Out.WriteLine(ex.StackTrace); } //Console.Out.WriteLine("sendDataRequest returning"); }
/** * Asks for data * * NOTE : currently all this meathod is used for is finding the serial number * @param cmmd - the command to be issues * @param adress - the address of the memory * @param block - the blocks of the memory * @param device - the device to be read * */ private void sendReadRequest(STPv3Command cmmd, ushort adress, ushort block, USBDevice device) { //new request STPv3Request request = new STPv3Request(); try { //set param of the request request.Command = cmmd; request.Address = adress; request.Blocks = block; //issue request request.Issue(device); //get response STPv3Response response = request.GetResponse(); //if it fails report and exit if ((response == null) || (!response.Success)) { Console.Out.WriteLine("Unable to read serial number from reader"); Console.In.Read(); return; } //else print out the data Console.Out.WriteLine(String.Format("Serial Number:{0}", String.Join("", Array.ConvertAll <byte, string> (response.Data, delegate(byte value) { return(String.Format("{0:X2}", value)); })))); } catch (Exception ex) { Console.Out.WriteLine(ex.StackTrace); } }
public override bool InventoryTags(Tag tag, bool loop, InventoryTagDelegate itd, object context) { STPv3Response response; STPv3Request request = new STPv3Request(); request.Tag = tag; //request.RID = reader.ReaderID; request.Command = STPv3Commands.SELECT_TAG; request.Inventory = true; request.Loop = loop; if(m_device.Type==DeviceType.SERIAL) { issue: request.Issue(this.m_device); response = request.GetResponse(); if (response == null) return false; if (response.ResponseCode == STPv3ResponseCode.SELECT_TAG_LOOP_OFF) goto issue; while (true) { response = request.GetResponse(); if (response == null) continue; if (!response.Success) return false; if (response.ResponseCode == STPv3ResponseCode.SELECT_TAG_PASS) { Tag iTag = new Tag(); iTag.TID = response.TID; iTag.Type = response.TagType; //BTM - If we are simply performing an inventory then we let it run to //completion to prevent later synchronization issues if (itd(iTag, context) && loop) { return true; } } } } //Not Tested!!! Lachezar Temelkov 02/19/2010 //When the user return false in the delegate, the routine/reader goes out of loop //when user return rue it is keep on going //the delegate is called every xx amount of miliseconds, regardless if there is tag found or not //the time out is specified m_devise.setreadertimeout! use 20ms for instance else if ((m_device.Type == DeviceType.TCP)||(m_device.Type==DeviceType.USB)) { //TCP code bool stoploop = false; try { issue: request.Issue(this.m_device); while (true) { //response return with a time out,regardles if Tag is Found or Not response = request.GetResponse(); if ((response.ResponseCode == STPv3ResponseCode.SELECT_TAG_LOOP_OFF) && (stoploop==false)) goto issue; switch (response.ResponseCode) { case STPv3ResponseCode.SELECT_FILE_PASS: { Tag iTag = new Tag(); iTag.Type = response.TagType; iTag.TID = response.TID; stoploop=itd(iTag, context); if ((stoploop==true)&& loop) { request.Issue(this.m_device); } break; } case STPv3ResponseCode.SELECT_TAG_FAIL: { Debug.Print("Selecet Tag fail--Inventory Done"); return true; } case STPv3ResponseCode.SELECT_TAG_LOOP_OFF: { Debug.Print("Selecet Tag fail--Inventory Done"); return true; } case STPv3ResponseCode.READER_TIME_OUT: { Tag iTag = null; stoploop = itd(iTag, context); if ((stoploop == true)&& loop) { request.Issue(this.m_device); } break; } } } } catch (NullReferenceException ex) //response is null exception { //if response is null throw new Exception("Null Device Reference in TCP object"); } catch (Exception e) //general exception just in case { throw new Exception("Error Inventory mode"); } }//end tcp else { throw new Exception("Unknown Interface Type in Inventory Mode"); } }
public override bool SelectTag(ref Tag tag) { STPv3Request request = new STPv3Request(); request.Tag = tag; request.RID = this.m_RID; request.Command = STPv3Commands.SELECT_TAG; issue: request.Issue(this.m_device); STPv3Response response = request.GetResponse(); if (response == null) return false; if (response.ResponseCode == STPv3ResponseCode.SELECT_TAG_LOOP_OFF) goto issue; if (!response.Success) return false; tag.TID = response.TID; if (((int)tag.Type & 0x000F) == 0x0000) tag.Type = response.TagType; return true; }
/// <summary> /// Scan EAS /// </summary> /// <param name="tag"></param> /// <returns></returns> public bool scanEAS(Tag tag) { STPv3Request request = new STPv3Request(); request.Tag = tag; request.Command = STPv3Commands.SCAN_EAS; request.RID = this.m_RID; issue: request.Issue(this.m_device); STPv3Response response = request.GetResponse(); if (response == null) return false; if (response.ResponseCode == STPv3ResponseCode.SELECT_TAG_LOOP_OFF) goto issue; if (!response.Success) return false; return true; }
/// <summary> /// Write Tag Configuration /// </summary> /// <param name="tag"></param> /// <param name="address"></param> /// <param name="blocks"></param> /// <param name="data"></param> /// <returns></returns> public bool WriteTagConfig(Tag tag, ushort address, ushort blocks, byte[] data) { STPv3Request request = new STPv3Request(); request.Tag = tag; request.Command = STPv3Commands.WRITE_TAG_CONFIG; request.Data = data; request.Address = address; request.Blocks = blocks; request.RID = this.m_RID; issue: request.Issue(this.m_device); STPv3Response response = request.GetResponse(); if (response == null) return false; if (response.ResponseCode == STPv3ResponseCode.SELECT_TAG_LOOP_OFF) goto issue; if (!response.Success) return false; return true; }
public bool WriteLock(byte[] lock_data) { STPv3Request request = new STPv3Request(); STPv3Response response; request.Tag = tag; request.Command = STPv3Commands.WRITE_TAG; request.Data = lock_data; request.Address = 0x0000; request.Blocks = 0; request.Lock = true; request.Issue(device); response = request.GetResponse(); if ((response != null) && (response.Success)) { return true; } return false; }
public Boolean SetMux(byte port) { byte[] p = new byte[1]; p[0] = port; STPv3Response response; STPv3Request requestMux = new STPv3Request(); requestMux.Command = STPv3Commands.WRITE_SYSTEM_PARAMETER; requestMux.Address = 0x000A; requestMux.Blocks = 0x01; requestMux.Data = p; try { requestMux.Issue(device); response = requestMux.GetResponse(); if (response != null && response.ResponseCode == STPv3ResponseCode.WRITE_SYSTEM_PARAMETER_PASS) { return true; } } catch (Exception ex) { Console.Out.WriteLine("EXCEPTION:" + ex.ToString()); throw; } Console.Out.WriteLine("********** SetMux FAILED ***********"); errors++; return false; }
//Returns the number of ports public int GetMuxPorts() { //used for READ_SYSTEM_PARAMETER which returns an array of bytes //the data field for the mux system parameter is 1 byte in length byte[] m = new byte[1]; m[0] = 0; int ports = 0; //Build switch mux request. STPv3Response response; STPv3Request requestMux = new STPv3Request(); requestMux.Command = STPv3Commands.READ_SYSTEM_PARAMETER; requestMux.Address = 0x000A; requestMux.Blocks = 0x01; //send request and parse response try { requestMux.Issue(device); response = requestMux.GetResponse(); if (response != null && response.ResponseCode == STPv3ResponseCode.READ_SYSTEM_PARAMETER_PASS) { if (reader.ProductCode == "0002") { //check for 4 port HF mux m[0] = 1; if (response.Data[0] == m[0]) { ports = 4; } //check for 8 port HF mux m[0] = 2; if (response.Data[0] == m[0]) { ports = 8; } } if (reader.ProductCode == "0007" || reader.ProductCode == "0009") { //check for 4 port UHF mux m[0] = 5; if (response.Data[0] == m[0]) { ports = 4; } //check for 8 port UHF mux m[0] = 6; if (response.Data[0] == m[0]) { ports = 8; } } } } catch (Exception ex) { Console.Out.WriteLine("EXCEPTION:" + ex.ToString()); } return(ports); }
public override byte[] ReadTagData(Tag tag, ushort address, ushort blocks) { STPv3Request request = new STPv3Request(); request.Tag = tag; request.Command = STPv3Commands.READ_TAG; request.Address = address; request.Blocks = blocks; request.RID = this.m_RID; issue: request.Issue(this.m_device); STPv3Response response = request.GetResponse(); if (response == null) return null; if (response.ResponseCode == STPv3ResponseCode.SELECT_TAG_LOOP_OFF) goto issue; if (!response.Success) return null; return response.Data; }
static void Main(string[] args) { STPv3Reader reader = null; string s; MFDevice myDevice = null; MFDevice[] ar = MFDeviceFactory.Enumerate(); if (ar.Length != 0) { foreach (MFDevice mfd in ar) { s = ""; Debug.Print(""); Debug.Print("Begin Report"); Debug.Print("************************"); Debug.Print("IP Address:" + mfd.MFIPEndPoint); s=BitConverter.ToString(mfd.MacAddr).Replace("-", ""); Debug.Print("MAC ADDRESS:" + s); Debug.Print("ADDRESS FAMILY:" + mfd.AddrFamily); Debug.Print("REMOTE SOCKET PORT:" + mfd.RemotePort.ToString()); if (s == "00409D3D4897") //<--your Device Mac Address here { myDevice = mfd; break; } } try { //System parameter reads if (myDevice == null) { //My Device is not on the Network Debug.Print("NULL OBJECT ERROR"); return; } myDevice.SetReadTimeOut = 500; reader = new STPv3Reader(myDevice); reader.Open(); Debug.Print("Hardware Version:" + reader.HardwareVersion); Debug.Print("Product Code:" + reader.ProductCode); Debug.Print("Reader Firmware:" + reader.FirmwareVersion); Debug.Print(String.Format("Reader ID: {0}", String.Join("", Array.ConvertAll<byte, string>(reader.ReaderID, delegate(byte value) { return String.Format("{0:X2}", value); })))); Debug.Print("Reader Start Frequency:" + reader.StartFrequency); Debug.Print("Reader Stop Frequency: " + reader.StopFrequency); Debug.Print("Reader Power Level:" + reader.PowerLevel); Debug.Print("INVENTORY EXAMPLE"); byte[] r = new byte[1]; r[0] = 20; //20 retries, anticipate 10 tags in the field STPv3Response response = null; STPv3Request requestTag = new STPv3Request(); requestTag.Command = STPv3Commands.WRITE_SYSTEM_PARAMETER; // set reader retries, usually the number of retries should be twice as much as //the anticipated tags in the field! requestTag.Address = 0x0011; requestTag.Blocks = 0x01; requestTag.Data = r; requestTag.Issue(myDevice); response = requestTag.GetResponse(); if(!response.Success) Debug.Print("Cannot set retries"); STPv3Response stpresponse = null; STPv3Request request = new STPv3Request(); request.Command = STPv3Commands.SELECT_TAG; request.Inventory = true; Tag tag = new Tag(); tag.Type = TagType.AUTO_DETECT; request.Tag = tag; //change the time out for Inventory and Loop modes myDevice.SetReadTimeOut = 20; try { request.Issue(myDevice); while (true) { stpresponse = request.GetResponse(); if (stpresponse == null) Debug.Print("NULL RESPONSE"); if (stpresponse.ResponseCode == STPv3ResponseCode.SELECT_TAG_PASS) { Debug.Print(String.Format("Tag found: {0} -> {1}", Enum.GetName(typeof(SkyeTek.Tags.TagType), stpresponse.TagType), String.Join("", Array.ConvertAll<byte, string>(stpresponse.TID, delegate(byte value) { return String.Format("{0:X2}", value); })))); } if (stpresponse.ResponseCode == STPv3ResponseCode.SELECT_TAG_INVENTORY_DONE) { Debug.Print("RECEIVED SELECT_TAG_INVENTORY_DONE"); break; } //Readers return select tag fail as inventory end, if no tags in field if (stpresponse.ResponseCode == STPv3ResponseCode.SELECT_TAG_FAIL) { Debug.Print("RECEIVED SELECT_TAG_FAIL"); break; } } } catch (Exception ee) { Debug.Print("Exception " + ee.Message); } Debug.Print(""); Debug.Print("*************** End Report ************************"); reader.Close(); } catch (SocketException ex) { Debug.Print(ex.ToString()); } catch (Exception e) { Debug.Print("Exception " + e.ToString()); reader.Close(); } } }
//Opens a specific mux port public Boolean SetMuxPort(byte port) { //used for WRITE_SYSTEM_PARAMETER which expects an array of bytes //the data field for the mux system parameter is 1 byte in length byte[] p = new byte[1]; p[0] = port; //Build switch mux request. STPv3Response response; STPv3Request requestMux = new STPv3Request(); requestMux.Command = STPv3Commands.WRITE_SYSTEM_PARAMETER; requestMux.Address = 0x000A; requestMux.Blocks = 0x01; requestMux.Data = p; //send request try { requestMux.Issue(device); response = requestMux.GetResponse(); if (response != null && response.ResponseCode == STPv3ResponseCode.WRITE_SYSTEM_PARAMETER_PASS) { return true; } } catch (Exception ex) { Console.Out.WriteLine("EXCEPTION:" + ex.ToString()); } return false; }
//Perform an Inventory Select to get a list of all tags in the field public ArrayList GetTags() { //start each time with empty list tagList.Clear(); //Build select tag request. STPv3Response response; STPv3Request requestTag = new STPv3Request(); requestTag.Tag = tag; requestTag.Command = STPv3Commands.SELECT_TAG; requestTag.Inventory = true; try { requestTag.Issue(device); while(true) { response = requestTag.GetResponse(); if (response.ResponseCode == STPv3ResponseCode.SELECT_TAG_PASS) { // Add tag to list string tid = String.Join("", Array.ConvertAll<byte, string>(response.TID, delegate(byte value) { return String.Format("{0:X2}", value); })); tagList.Add(response.TagType + "-" + tid); } if (response.ResponseCode == STPv3ResponseCode.SELECT_TAG_INVENTORY_DONE) { Debug.Print("INVENTORY DONE"); break; } //If no tags in the field, Reader returns selectTag Fail if (response.ResponseCode == STPv3ResponseCode.SELECT_TAG_FAIL) { Debug.Print("LOOP TAG OFF"); break; } } } catch (Exception ex) { Console.Out.WriteLine("EXCEPTION:" + ex.ToString()); } return tagList; }
//Returns the number of ports public int GetMuxPorts() { //used for READ_SYSTEM_PARAMETER which returns an array of bytes //the data field for the mux system parameter is 1 byte in length byte[] m = new byte[1]; m[0] = 0; int ports = 0; //Build switch mux request. STPv3Response response; STPv3Request requestMux = new STPv3Request(); requestMux.Command = STPv3Commands.READ_SYSTEM_PARAMETER; requestMux.Address = 0x000A; requestMux.Blocks = 0x01; //send request and parse response try { requestMux.Issue(device); response = requestMux.GetResponse(); if (response != null && response.ResponseCode == STPv3ResponseCode.READ_SYSTEM_PARAMETER_PASS) { if (reader.ProductCode == "0002") { //check for 4 port HF mux m[0] = 1; if (response.Data[0] == m[0]) { ports = 4; } //check for 8 port HF mux m[0] = 2; if (response.Data[0] == m[0]) { ports = 8; } } if (reader.ProductCode == "0007" || reader.ProductCode == "0009") { //check for 4 port UHF mux m[0] = 5; if (response.Data[0] == m[0]) { ports = 4; } //check for 8 port UHF mux m[0] = 6; if (response.Data[0] == m[0]) { ports = 8; } } } } catch (Exception ex) { Console.Out.WriteLine("EXCEPTION:" + ex.ToString()); } return ports; }
public ArrayList InventoryTags(Tag tag) { ArrayList tagArray = new ArrayList(); //Build select tag request. STPv3Response response; STPv3Request requestTag = new STPv3Request(); requestTag.Tag = tag; requestTag.Command = STPv3Commands.SELECT_TAG; requestTag.Inventory = true; //Legacy Serial/USB code if (m_device.Type == DeviceType.USB) { try { issue: requestTag.Issue(this.m_device); while (true) { response = requestTag.GetResponse(); if (response.ResponseCode == STPv3ResponseCode.SELECT_TAG_LOOP_OFF) goto issue; if (response == null) return tagArray; if (!response.Success) return tagArray; if (response.ResponseCode == STPv3ResponseCode.SELECT_TAG_PASS) { Tag iTag = new Tag(); iTag.Type = response.TagType; iTag.TID = response.TID; tagArray.Add(iTag); } } } catch (Exception e) { Debug.Print("Inventory exception" + e.Message); return tagArray; } } else if ((m_device.Type == DeviceType.TCP)||(m_device.Type==DeviceType.SERIAL)) { //TCP code try { issue: requestTag.Issue(this.m_device); while (true) { response = requestTag.GetResponse(); if (response.ResponseCode == STPv3ResponseCode.SELECT_TAG_LOOP_OFF) goto issue; if (response.ResponseCode == STPv3ResponseCode.SELECT_TAG_PASS) { Tag iTag = new Tag(); iTag.Type = response.TagType; iTag.TID = response.TID; tagArray.Add(iTag); } if (response.ResponseCode == STPv3ResponseCode.SELECT_TAG_INVENTORY_DONE) { Debug.Print("RECEIVED SELECT_TAG_INVENTORY_DONE"); break; } if (response.ResponseCode == STPv3ResponseCode.SELECT_TAG_FAIL) { Debug.Print("RECEIVED SELECT_TAG_FAIL"); break; } } return tagArray; } catch (NullReferenceException ex) //response is null exception { //if response is null return tagArray; } catch (Exception e) //general exception just in case { return tagArray; } }//end tcp else { //return null; throw new Exception("Unknown Interface type in Inventory mode"); } }
//Perform an Inventory Select to get a list of all tags in the field public ArrayList GetTags() { //start each time with empty list tagList.Clear(); //Build select tag request. STPv3Response response; STPv3Request requestTag = new STPv3Request(); requestTag.Tag = tag; requestTag.Command = STPv3Commands.SELECT_TAG; requestTag.Inventory = true; try { //Send select tag request and get first response. requestTag.Issue(device); response = requestTag.GetResponse(); //while (response == null) //{ //retry // Thread.Sleep(delay); // response = requestTag.GetResponse(); // Console.Out.WriteLine("null resp"); //} if (response == null) { Console.Out.WriteLine("null resp"); tagList.Clear(); return(tagList); } //Continue getting responses and terminate parsing tag ID's upon finding SELECT_TAG_INVENTORY_DONE. while (response.ResponseCode != STPv3ResponseCode.SELECT_TAG_INVENTORY_DONE) { if (response.ResponseCode == STPv3ResponseCode.SELECT_TAG_PASS) { // Add tag to list string tid = String.Join("", Array.ConvertAll <byte, string>(response.TID, delegate(byte value) { return(String.Format("{0:X2}", value)); })); tagList.Add(response.TagType + "-" + tid); } response = requestTag.GetResponse(); if (response == null) { Console.Out.WriteLine("null resp"); tagList.Clear(); return(tagList); } /* * int counter = 0; * while (response == null) * { * //retry * Thread.Sleep(delay); * response = requestTag.GetResponse(); * Console.Out.WriteLine("null resp"); * //counter++; * //if (counter > 3) * //{ * // break; * //} * } */ } } catch (Exception ex) { Console.Out.WriteLine("EXCEPTION:" + ex.ToString()); } return(tagList); }
/// <summary> /// Uploads new firmware to a reader. Takes a string containing the path to the .shf file /// </summary> /// <param name="file">Path to .shf file. String.</param> /// <returns></returns> public bool UploadFirmware(string file) { STPv3Request request = new STPv3Request(); request.RID = this.m_RID; request.Command = STPv3Commands.ENTER_BOOTLOAD; issue: request.Issue(this.m_device); STPv3Response response = request.GetResponse(); if (response == null) return false; if (response.ResponseCode == STPv3ResponseCode.SELECT_TAG_LOOP_OFF) goto issue; if (!response.Success) return false; STPv3Request.UploadFirmware(this.m_device, file); return true; }
//Perform an Inventory Select to get a list of all tags in the field public ArrayList GetTags() { //start each time with empty list tagList.Clear(); //Build select tag request. STPv3Response response; STPv3Request requestTag = new STPv3Request(); requestTag.Tag = tag; requestTag.Command = STPv3Commands.SELECT_TAG; requestTag.Inventory = true; try { //Send select tag request and get first response. requestTag.Issue(device); response = requestTag.GetResponse(); //while (response == null) //{ //retry // Thread.Sleep(delay); // response = requestTag.GetResponse(); // Console.Out.WriteLine("null resp"); //} if (response == null) { Console.Out.WriteLine("null resp"); tagList.Clear(); return tagList; } //Continue getting responses and terminate parsing tag ID's upon finding SELECT_TAG_INVENTORY_DONE. while (response.ResponseCode != STPv3ResponseCode.SELECT_TAG_INVENTORY_DONE) { if (response.ResponseCode == STPv3ResponseCode.SELECT_TAG_PASS) { // Add tag to list string tid = String.Join("", Array.ConvertAll<byte, string>(response.TID, delegate(byte value) { return String.Format("{0:X2}", value); })); tagList.Add(response.TagType + "-" + tid); } response = requestTag.GetResponse(); if (response == null) { Console.Out.WriteLine("null resp"); tagList.Clear(); return tagList; } /* int counter = 0; while (response == null) { //retry Thread.Sleep(delay); response = requestTag.GetResponse(); Console.Out.WriteLine("null resp"); //counter++; //if (counter > 3) //{ // break; //} } */ } } catch (Exception ex) { Console.Out.WriteLine("EXCEPTION:" + ex.ToString()); } return tagList; }
/// <summary> /// Writes a new default system parameter. Address denotes parameter /// </summary> /// <param name="data">Data to write</param> /// <param name="address">Address to write to</param> /// <param name="blocks">Number of blocks to write</param> public bool StoreDefaultParameter(byte[] data, ushort address, ushort blocks) { STPv3Request request = new STPv3Request(); request.Command = STPv3Commands.STORE_DEFAULT_SYSTEM_PARAMETER; request.Address = address; request.Blocks = blocks; request.Data = data; request.RID = this.m_RID; issue: request.Issue(this.m_device); STPv3Response response = request.GetResponse(); if (response == null) return false; if (response.ResponseCode == STPv3ResponseCode.SELECT_TAG_LOOP_OFF) goto issue; if (!response.Success) return false; return true; }
/// <summary> /// Send Tag Password - Sends the Tag Password to the Tag /// </summary> /// <param name="tag"></param> /// <param name="data"></param> /// <returns></returns> public bool SendTagPassword(Tag tag, byte[] data) { STPv3Request request = new STPv3Request(); request.Tag = tag; request.Command = STPv3Commands.SEND_TAG_PASSWORD; request.Data = data; request.Address = 0; request.Blocks = 0; request.RID = this.m_RID; issue: request.Issue(this.m_device); STPv3Response response = request.GetResponse(); if (response == null) return false; if (response.ResponseCode == STPv3ResponseCode.SELECT_TAG_LOOP_OFF) goto issue; if (!response.Success) return false; return true; }
static void Main(string[] args) { STPv3Reader reader = null; string s; MFDevice myDevice = null; MFDevice[] ar = MFDeviceFactory.Enumerate(); if (ar.Length != 0) { foreach (MFDevice mfd in ar) { s = ""; Debug.Print(""); Debug.Print("Begin Report"); Debug.Print("************************"); Debug.Print("IP Address:" + mfd.MFIPEndPoint); s = BitConverter.ToString(mfd.MacAddr).Replace("-", ""); Debug.Print("MAC ADDRESS:" + s); Debug.Print("ADDRESS FAMILY:" + mfd.AddrFamily); Debug.Print("REMOTE SOCKET PORT:" + mfd.RemotePort.ToString()); if (s == "00409D3D4897") //<--your Device Mac Address here { myDevice = mfd; break; } } try { //System parameter reads if (myDevice == null) { //My Device is not on the Network Debug.Print("NULL OBJECT ERROR"); return; } myDevice.SetReadTimeOut = 500; reader = new STPv3Reader(myDevice); reader.Open(); Debug.Print("Hardware Version:" + reader.HardwareVersion); Debug.Print("Product Code:" + reader.ProductCode); Debug.Print("Reader Firmware:" + reader.FirmwareVersion); Debug.Print(String.Format("Reader ID: {0}", String.Join("", Array.ConvertAll <byte, string>(reader.ReaderID, delegate(byte value) { return(String.Format("{0:X2}", value)); })))); Debug.Print("Reader Start Frequency:" + reader.StartFrequency); Debug.Print("Reader Stop Frequency: " + reader.StopFrequency); Debug.Print("Reader Power Level:" + reader.PowerLevel); Debug.Print("INVENTORY EXAMPLE"); byte[] r = new byte[1]; r[0] = 20; //20 retries, anticipate 10 tags in the field STPv3Response response = null; STPv3Request requestTag = new STPv3Request(); requestTag.Command = STPv3Commands.WRITE_SYSTEM_PARAMETER; // set reader retries, usually the number of retries should be twice as much as //the anticipated tags in the field! requestTag.Address = 0x0011; requestTag.Blocks = 0x01; requestTag.Data = r; requestTag.Issue(myDevice); response = requestTag.GetResponse(); if (!response.Success) { Debug.Print("Cannot set retries"); } STPv3Response stpresponse = null; STPv3Request request = new STPv3Request(); request.Command = STPv3Commands.SELECT_TAG; request.Inventory = true; Tag tag = new Tag(); tag.Type = TagType.AUTO_DETECT; request.Tag = tag; //change the time out for Inventory and Loop modes myDevice.SetReadTimeOut = 20; try { request.Issue(myDevice); while (true) { stpresponse = request.GetResponse(); if (stpresponse == null) { Debug.Print("NULL RESPONSE"); } if (stpresponse.ResponseCode == STPv3ResponseCode.SELECT_TAG_PASS) { Debug.Print(String.Format("Tag found: {0} -> {1}", Enum.GetName(typeof(SkyeTek.Tags.TagType), stpresponse.TagType), String.Join("", Array.ConvertAll <byte, string>(stpresponse.TID, delegate(byte value) { return(String.Format("{0:X2}", value)); })))); } if (stpresponse.ResponseCode == STPv3ResponseCode.SELECT_TAG_INVENTORY_DONE) { Debug.Print("RECEIVED SELECT_TAG_INVENTORY_DONE"); break; } //Readers return select tag fail as inventory end, if no tags in field if (stpresponse.ResponseCode == STPv3ResponseCode.SELECT_TAG_FAIL) { Debug.Print("RECEIVED SELECT_TAG_FAIL"); break; } } } catch (Exception ee) { Debug.Print("Exception " + ee.Message); } Debug.Print(""); Debug.Print("*************** End Report ************************"); reader.Close(); } catch (SocketException ex) { Debug.Print(ex.ToString()); } catch (Exception e) { Debug.Print("Exception " + e.ToString()); reader.Close(); } } }
/// <summary> /// Read Tag Configuration /// </summary> /// <param name="tag"></param> /// <param name="address"></param> /// <param name="blocks"></param> /// <param name="data"></param> /// <returns></returns> public byte[] ReadTagConfig(Tag tag, ushort address, ushort blocks, byte[] data) { byte[] tagConfig = new byte[1024]; STPv3Request request = new STPv3Request(); request.Tag = tag; request.Command = STPv3Commands.READ_TAG_CONFIG; request.Address = address; request.Blocks = blocks; request.Data = data; request.RID = this.m_RID; issue: request.Issue(this.m_device); STPv3Response response = request.GetResponse(); if (response == null) return null; if (response.ResponseCode == STPv3ResponseCode.SELECT_TAG_LOOP_OFF) goto issue; if (!response.Success) return null; return response.Data; }
/// <summary> /// Writes a system parameter to the reader. Address denotes parameter /// </summary> /// <param name="data">Data to be written</param> /// <param name="address">Address to write to</param> /// <param name="blocks">Number of blocks to write</param> public bool WriteSystemParameter(byte[] data, ushort address, ushort blocks) { STPv3Request request = new STPv3Request(); request.Command = STPv3Commands.WRITE_SYSTEM_PARAMETER; request.Address = address; request.Blocks = blocks; request.Data = data; request.RID = this.m_RID; issue: request.Issue(this.m_device); STPv3Response response = request.GetResponse(); if (response == null) return false; if (response.ResponseCode == STPv3ResponseCode.SELECT_TAG_LOOP_OFF) goto issue; if (!response.Success) return false; if (address == 4) // Reader ID is being set request.Data.CopyTo(this.m_RID, 0); return true; }
public bool WritePassword(byte[] password) { STPv3Request request = new STPv3Request(); STPv3Response response; request.Tag = tag; request.Command = STPv3Commands.WRITE_TAG; request.Data = password; request.Address = 0x0002; request.Blocks = 2; request.Issue(device); response = request.GetResponse(); if ((response != null) && (response.Success)) { return true; } return false; }
public bool SendTagPassword(byte[] password) { STPv3Request request = new STPv3Request(); STPv3Response response; request.Tag = tag; request.Command = STPv3Commands.SEND_TAG_PASSWORD; request.Data = password; request.Issue(device); response = request.GetResponse(); if ((response != null) && (response.Success)) { return true; } return false; }
/// <summary> /// Reads a stored default parameter from the reader. Address denotes parameter /// </summary> /// <param name="address">Address to read from</param> /// <param name="blocks">Number of blocks to write</param> /// <returns>Return null if read failed, data otherwise</returns> public byte[] RetrieveDefaultParameter(ushort address, ushort blocks) { STPv3Request request = new STPv3Request(); request.Command = STPv3Commands.RETRIEVE_DEFAULT_SYSTEM_PARAMETER; request.Address = address; request.Blocks = blocks; request.RID = this.m_RID; issue: request.Issue(this.m_device); STPv3Response response = request.GetResponse(); if (response == null) return null; if (response.ResponseCode == STPv3ResponseCode.SELECT_TAG_LOOP_OFF) goto issue; if (!response.Success) return null; return response.Data; }
static void Main(string[] args) { SerialDevice sd; STPv3Reader reader; STPv3Request request; STPv3Response response; Tag tag = new Tag(); tag.Type = TagType.AUTO_DETECT; string port; byte[] resp; float temp; if (args.Length < 1) { port = "COM1"; } else { port = args[0]; } sd = new SerialDevice(); reader = new STPv3Reader(sd); try { sd.Address = port; sd.BaudRate = 38400; sd.Open(); // read product code, reader name, hw version, fw version, and reader ID Console.Out.WriteLine(String.Format("Product Code: {0}", reader.ProductCode)); Console.Out.WriteLine(String.Format("Reader Name: {0}", reader.ReaderName)); Console.Out.WriteLine(String.Format("Hardware Version: {0}", reader.HardwareVersion)); Console.Out.WriteLine(String.Format("Firmware Version: {0}", reader.FirmwareVersion)); Console.Out.WriteLine(String.Format("Reader ID: {0}", String.Join("", Array.ConvertAll <byte, string>(reader.ReaderID, delegate(byte value){ return(String.Format("{0:X2}", value)); })))); //scan for tags request = new STPv3Request(); request.Tag = tag; request.Command = STPv3Commands.SELECT_TAG; request.Inventory = true; request.Issue(sd); while (((response = request.GetResponse()) != null) && (response.Success)) { if (response.ResponseCode == STPv3ResponseCode.SELECT_TAG_PASS) { Console.Out.WriteLine(String.Format("Tag found: {0} -> {1}", Enum.GetName(typeof(SkyeTek.Tags.TagType), response.TagType), String.Join("", Array.ConvertAll <byte, string>(response.TID, delegate(byte value) { return(String.Format("{0:X2}", value)); })))); } } } catch (Exception ex) { Console.Out.WriteLine(ex.ToString()); } Console.In.ReadLine(); }
public override bool InventoryTags(Tag tag, bool loop, InventoryTagDelegate itd, object context) { STPv3Response response; STPv3Request request = new STPv3Request(); request.Tag = tag; //request.RID = reader.ReaderID; request.Command = STPv3Commands.SELECT_TAG; request.Inventory = true; request.Loop = loop; issue: request.Issue(this.m_device); response = request.GetResponse(); if (response == null) return false; if (response.ResponseCode == STPv3ResponseCode.SELECT_TAG_LOOP_OFF) goto issue; while (true) { response = request.GetResponse(); if (response == null) continue; if (!response.Success) return false; if (response.ResponseCode == STPv3ResponseCode.SELECT_TAG_PASS) { Tag iTag = new Tag(); iTag.TID = response.TID; iTag.Type = response.TagType; //BTM - If we are simply performing an inventory then we let it run to //completion to prevent later synchronization issues if (itd(iTag, context) && loop) { return true; } } } }