示例#1
0
        public static bool IsTheDevice(string port)
        {
            SerialPortTran spt;

            try
            {
                SerialPortFixer.Execute(port);
                spt = new SerialPortTran(port, false);
                spt.SPWrite(Utils.HexToByte("681600000A"));
                string result = "";
                Thread.Sleep(100);
                result = spt.spReadOnce();
                spt.sp.Close();

                if (result.StartsWith("6817"))
                {
                    return(true);
                }
            }
            catch
            {
                return(false);
            }
            finally
            {
            }

            return(false);
        }