/// <summary> /// /// </summary> /// <param name="tagDriverService"></param> public void Init(IRealTagDriver tagDriverService) { mTagDriverService = tagDriverService; string cfgpath = System.IO.Path.Combine(System.IO.Path.GetDirectoryName(this.GetType().Assembly.Location), "Config", "Driver.cfg"); if (System.IO.File.Exists(cfgpath)) { XElement xx = XElement.Load(cfgpath); foreach (var vv in xx.Elements()) { try { string dll = System.IO.Path.Combine(System.IO.Path.GetDirectoryName(this.GetType().Assembly.Location), vv.Attribute("File").Value); string main = vv.Attribute("MainClass").Value; if (System.IO.File.Exists(dll)) { var driver = Assembly.LoadFrom(dll).CreateInstance(main) as ITagDriver; if (!mDrivers.ContainsKey(driver.Name)) { mDrivers.Add(driver.Name, driver); } } else { LoggerService.Service.Warn("DriverManager", dll + " is not exist."); } } catch (Exception ex) { LoggerService.Service.Erro("DriverManager", ex.StackTrace); } } } }
/// <summary> /// /// </summary> /// <param name="tagQuery"></param> private void InitTagCach(IRealTagDriver tagQuery) { mTagIdCach = tagQuery.GetTagsByLinkAddress(new List <string>() { "Sim:cos", "Sim:sin", "Sim:step" }); }
/// <summary> /// /// </summary> /// <param name="tagQuery"></param> /// <returns></returns> public bool Start(IRealTagDriver tagQuery) { mTagService = tagQuery; InitTagCach(tagQuery); mScanTimer = new System.Timers.Timer(100); mScanTimer.Elapsed += MScanTimer_Elapsed; mScanTimer.Start(); return(true); }