Exemple #1
0
        EtagInfo ToEtagInfo(string str)
        {
            string[] pairs = str.Split(new char[] { ' ' });    //[1].Trim().Split(new char[]{',',' '});
            EtagInfo info  = new EtagInfo();

            foreach (string s in pairs)
            {
                string value, key;
                if (!s.Contains('='))
                {
                    continue;
                }
                string   temp = s.Trim().TrimEnd(new char[] { ',' });
                string[] res  = temp.Split(new char[] { '=' });
                key   = res[0];
                value = res[1];
                if (key == "tag_id")
                {
                    info.tag_id = value;
                }
                else if (key == "rssi")
                {
                    info.rssi = System.Convert.ToInt32(value);
                }
                else if (key == "antenna")
                {
                    info.antenna = System.Convert.ToInt32(value);
                }
            }
            return(info);
        }
Exemple #2
0
        void reader_OnEtagArriveEvent(EtagInfo info)
        {
            //using (System.IO.StreamWriter wr = System.IO.File.AppendText(AppDomain.CurrentDomain.BaseDirectory + "ETAG.log"))
            //{
            //    wr.WriteLine(info.antenna + "," + info.tag_id);
            //    wr.Close();
            //}

            Console.WriteLine(info.antenna + "," + info.tag_id);
            //   if (info.tag_id == "0x00BFDE232520FF63991F027A" )

            if (ExecuteMode == ConstExecuteMode.Stop)
            {
                Resume();
                return;
            }



            if (dictWhiteListLookUp.ContainsKey(info.tag_id.ToUpper()))
            {
                if (info.antenna == EnterChno)
                {
                    Pause();
                }
                if (info.antenna == LeaveChno)
                {
                    Resume();
                }

                //Task.Run(() =>
                //    {
                //        System.Threading.Thread.Sleep(10 * 1000);
                //        _Server.Resume();
                //    }
                //);
            }



            //  throw new NotImplementedException();
        }