private void OpenReader() { PrintLn("Opening reader..."); rdr = (SerialReader)Utilities.ConnectReader(); //rdr = (SerialReader)Reader.Create("eapi:///" + serialPortName); rdr.ParamSet("/reader/baudRate", 9600); //rdr.Log += new SerialReader.LogHandler(rdr_Log); rdr.Connect(); PrintLn("Opened reader on port " + Utilities.ReaderPortName); }
/// <summary> /// Full access contructor /// </summary> /// <param name="ComPortName"></param> /// <param name="ComBaudrate">Should be 115200. Other rates supported and listed in Mercury Docs</param> /// <param name="ReadOnTime">How long in milliseconds the reader is on before being turned off for ReadOffTime</param> /// <param name="ReadOffTime">How long in milliseconds the reader is off before being turned back on for ReadOnTime</param> /// <param name="ReadPower">Power in centi-dBm sent to the antennae. The max value is 3000 and should probably always be set to max</param> /// <param name="ReadTime">Total time the reader reads for when ReadTags() is called in milliseconds. If this value is more than /// 60000 you begin to risk throttling due to overheating</param> public M6eMicroRFID(string ComPortName, int ComBaudrate, int ReadOnTime, int ReadOffTime, int ReadPower, int ReadTime) { SerialPort = new SerialPort(ComPortName, ComBaudrate); BaseReader = Reader.Create("eapi:///" + SerialPort.PortName); RFIDReader = (SerialReader)BaseReader; IsReading = false; BaseReader.Connect(); READER_ASYNC_ON_TIME = ReadOnTime; READER_ASYNC_OFF_TIME = ReadOffTime; READER_READ_POWER = ReadPower; READER_READ_TIME = ReadTime; RFIDReader.ParamSet("/reader/region/id", Reader.Region.OPEN); //Open Region RFIDReader.ParamSet("/reader/gen2/q", new Gen2.DynamicQ()); //This determines how many internal tag "slots" the reader is looking to fill RFIDReader.ParamSet("/reader/gen2/BLF", Gen2.LinkFrequency.LINK250KHZ); //Rate at which the tags signal back to the reader RFIDReader.ParamSet("/reader/gen2/tari", Gen2.Tari.TARI_6_25US); //Controls how long it takes a tag to reader to send a communication RFIDReader.ParamSet("/reader/gen2/session", Gen2.Session.S1); //Controls how often tags respond to inventory rounds RFIDReader.ParamSet("/reader/gen2/tagEncoding", Gen2.TagEncoding.M8); //Controls how many times a signal is repeated so that far away tags still get the message. RFIDReader.ParamSet("/reader/gen2/target", Gen2.Target.A); //This controls what order tags are read in. State A are tags which have not been read. State B are tags which have been read. RFIDReader.ParamSet("/reader/radio/readPower", READER_READ_POWER); RFIDReader.ParamSet("/reader/read/asyncOnTime", READER_ASYNC_ON_TIME); RFIDReader.ParamSet("/reader/read/asyncOffTime", READER_ASYNC_OFF_TIME); RFIDReader.ParamSet("/reader/read/plan", new SimpleReadPlan(new int[] { 1, 2, 3, 4 }, TagProtocol.GEN2)); }