static void Main(string[] args) { //declare settings and data structures const Boolean MUX_ENABLE = false; const int iterations = 10000; ArrayList myTags = new ArrayList(); Controller c = new Controller(); Console.Out.WriteLine("Setup"); //create device if (c.CreateUSBDevice()) { Console.Out.WriteLine("\tSkyetek USB Device Created"); } else { c.CreateSerialDevice(); Console.Out.WriteLine("\tSkyetek Serial Device Created"); } //create reader (automatically opens the device too) c.CreateReader(); Console.Out.WriteLine("\tSkyetek Reader Created"); Console.Out.WriteLine(String.Format("\tProduct Code: {0}", c.GetProduct())); Console.Out.WriteLine(String.Format("\tReader Name: {0}", c.GetName())); //set tag type /************************************************************************************ * If no type is specified, tag type defaults to auto detect all types. * It is recommended the type be specified for quickest responses and best performance * ISO-18000-6C (gen2) is a common UHF tag protocol (for M7/M9 modules) * ISO-15693 is a common HF tag protocol (for M2/M4 modules) *************************************************************************************/ if (c.GetProduct() == "0007" || c.GetProduct() == "0009") { c.SetTagType(TagType.ISO_18000_6C_AUTO_DETECT); } else if (c.GetProduct() == "0002" || c.GetProduct() == "0004") { c.SetTagType(TagType.ISO_15693_AUTO_DETECT); } Console.Out.WriteLine("\tTag Type Set To " + c.GetTagType() + "\n"); //perform an inventory select for the set number of iterations //if a mux is connected, then cycle through all available ports if (!MUX_ENABLE) { for (int i = 1; i <= iterations; i++) { myTags = c.GetTags(); Console.Out.WriteLine("Iteration #" + i.ToString()); foreach (string k in myTags) { Console.Out.WriteLine("\tTag Found: " + k.ToString()); } } } else //mux enabled { byte[] muxPorts; if (c.GetMuxPorts() == 4) { muxPorts = new byte[] { 0, 2, 5, 7 }; } else if (c.GetMuxPorts() == 8) { muxPorts = new byte[] { 0, 1, 2, 3, 4, 5, 6, 7 }; } else { Console.Out.WriteLine("ERROR: NO MUX DETECTED"); muxPorts = new byte[] { 0 }; } for (int i = 1; i <= iterations; i++) { Console.Out.WriteLine("Iteration #" + i.ToString()); foreach (byte j in muxPorts) { Console.Out.WriteLine("\tPort=" + j); c.SetMuxPort(j); myTags = c.GetTags(); foreach (string k in myTags) { Console.Out.WriteLine("\t\tTag Found: " + k.ToString()); } } } } //close the device c.Stop(); Console.Out.WriteLine("\nSkyetek Device Closed"); }