Exemplo n.º 1
0
        public static bool Connect()
        {
            var result = SerialPortWrapper.Connect();

            if (result)
            {
                Task.Factory.StartNew(async() =>
                {
                    while (true)
                    {
                        while (!_queues.IsEmpty)
                        {
                            string data;
                            if (_queues.TryDequeue(out data))
                            {
                                SerialPortWrapper.Send(data.HexStrToBytes(" "));
                                await Task.Delay(50);
                            }
                        }
                        await Task.Delay(30);
                    }
                });
            }
            return(result);
        }