Esempio n. 1
0
        public int Ping()
        {
            var bytes = ByteBuilder.Ping();

            try
            {
                _serialPort.Write(bytes, 0, bytes.Length);
                Thread.Sleep(15);
                string result = _serialPort.ReadExisting();
                return(int.Parse(result));
            }
            catch (Exception)
            {
                return(-1);
            }
        }