//----------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 void Stop() { try { _reader.StopReading(); } catch (Exception) { _reader = ThingMagic.Reader.Create(string.Concat("tcp://", readerUri)); Connect(); } }
public M6eReader(string ip) { _ip = ip; //TagsReportedEvent = e; try { _reader.Destroy(); } catch (Exception) { } ThingMagic.Reader.SetSerialTransport("tcp", SerialTransportTCP.CreateSerialReader); readerUri = ip + ":8086"; //Creates a Reader Object for operations on the Reader. _reader = ThingMagic.Reader.Create(string.Concat("tcp://", readerUri)); _listAll = new List <string>(); }