//----------RFID Module Functions Section----------// /// <summary> /// Establishes a proper connection with the system and M6e Module. /// Config module settings such as [antenna port, region,tag reading/writing protocol] /// Creates a "Reader" object from the Mecury API /// </summary> public void ConnectRFID() { { try { //Check reading power settings string uri = "eapi:///com" + COM_Port; //Configurations of COMs "USB Port" reader = ThingMagic.Reader.Create(uri); //Create Reader object reader.Connect(); reader.ParamSet("/reader/region/id", ThingMagic.Reader.Region.NA); int readPowerMax = (int)reader.ParamGet("/reader/radio/powerMax"); int readPowerMin = (int)reader.ParamGet("/reader/radio/powerMin"); Console.WriteLine("Max= " + readPowerMax); Console.WriteLine("Min= " + readPowerMin); reader.ParamSet("/reader/radio/readPower", 2000); int[] antennaList = null; string str = "1,1"; antennaList = Array.ConvertAll(str.Split(','), int.Parse); //Select antenna 1 SimpleReadPlan plan = new SimpleReadPlan(antennaList, TagProtocol.GEN2, null, null, 1000); //Create "Plan" for module configuration reader.ParamSet("/reader/read/plan", plan); connectiveStatus = true; updateConnectiveStatus(); //Update UI } catch (System.IO.IOException e) { Console.WriteLine(e.Message); MessageBox.Show("COM " + COM_Port + " is not valid. "); } } }
public IList <int> GetSelectedAntennaList() { bool _enableCheck = true; ((SerialReader)_reader).CmdSetReaderConfiguration(ThingMagic.SerialReader.Configuration.SAFETY_ANTENNA_CHECK, _enableCheck); IList <int> detectedAntennas = (IList <int>)_reader.ParamGet("/reader/antenna/portList"); detectedAntennas = (IList <int>)_reader.ParamGet("/reader/antenna/connectedPortList"); return(detectedAntennas); }