Beispiel #1
0
        /// <summary>
        /// 返回激活设备的tag
        /// </summary>
        /// <returns></returns>
        public string CheckDeviceTag()//检查设备
        {
            var driver = DriverS.getActive();

            if (driver == null)
            {
                return("");
            }
            return(driver.Tag());
        }
Beispiel #2
0
        /// <summary>
        /// 返回激活的设备的总数
        /// </summary>
        /// <returns></returns>
        public string CheckDevice()//检查设备
        {
            var driver = DriverS.getActive();

            if (driver == null)
            {
                return(string.Empty);
            }
            int    count     = driver.GetCount();
            string driverTag = count > 0 ? driver.Tag() : string.Empty;

            return(driverTag);
        }
Beispiel #3
0
        //消息发送线程
        void StartSendQueue()
        {
            var data = new byte[64];

            while (bExit == false)
            {
                if (DriverS.getActive() != null)
                {
                    if (msgForSend.Count > 0)
                    {
                        Message msg = null;
                        if (msgForSend.TryDequeue(out msg))
                        {
                            //Console.WriteLine("123"+msg);
                            msg.ToData(data);
                            DriverS.Send(data);
                        }
                    }
                }
                System.Threading.Thread.Sleep(5);
            }
        }