Beispiel #1
0
        //----------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. ");
                }
            }
        }
Beispiel #2
0
        public void Start()
        {
            try
            {
                _listAll.Clear();
                //设置事件

                SimpleReadPlan readPlan = new SimpleReadPlan(new int[4] {
                    1, 2, 3, 4
                }, TagProtocol.GEN2);
                _reader.ParamSet("/reader/read/plan", readPlan);
                _reader.ParamSet("/reader/radio/readPower", Convert.ToInt32(100 * 31.5));
                _reader.Connect();
                _reader.StartReading();
            }
            catch (Exception)
            {
                //throw;
            }
        }