示例#1
0
        public void Init()
        {
            if (_Devices != null && _Devices.Count > 0)
            {
                foreach (var device in _Devices)
                {
                    device.Dispose();
                }
            }
            _Devices = new List <ETCDevice>();
            var items = ETCDevice.GetAllDevices(); //初始化的时候一定要调用这一个函数

            if (items != null && items.Length > 0)
            {
                foreach (var item in items)
                {
                    ETCDeviceInfo dinfo = null;
                    if (Setting.Devices != null)
                    {
                        dinfo = Setting.Devices.SingleOrDefault(it => it.LaneNo == item.LaneNo);
                    }
                    if (dinfo != null)
                    {
                        item.EntranceID    = dinfo.EntranceID;
                        item.DisableReader = dinfo.DisableReader;
                        item.DisableRSU    = dinfo.DisableRSU;
                        var device = new ETCDevice(item);
                        device.OnReadCardInfo += device_OnReadCardInfo;
                        device.OnReadOBUInfo  += device_OnReadOBUInfo;
                        device.OnError        += device_OnError;
                        device.Init();
                        _Devices.Add(device);
                    }
                }
            }
            if (_UploadList == null)
            {
                _UploadList = new Thread(new ThreadStart(UploadListThread));
                _UploadList.IsBackground = true;
                _UploadList.Start();
            }
        }
示例#2
0
 public ETCDevice(ETCDeviceInfo info)
 {
     _DeviceInfo = info;
 }