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(); } if (info.tag_id == "0x00BFDE232520FF63991F027A" ) { if(info.antenna==1) _Server.Pause(); if (info.antenna == 7) _Server.Resume(); //Task.Run(() => // { // System.Threading.Thread.Sleep(10 * 1000); // _Server.Resume(); // } //); } // throw new NotImplementedException(); }
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(); } if (info.tag_id == "0x00BFDE232520FF63991F027A") { if (info.antenna == 1) { _Server.Pause(); } if (info.antenna == 7) { _Server.Resume(); } //Task.Run(() => // { // System.Threading.Thread.Sleep(10 * 1000); // _Server.Resume(); // } //); } // throw new NotImplementedException(); }
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(); }
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; }