- public byte ConnectCMD()
- {
- byte[] array = new byte[]
- {
- 24
- };
- int num = 8;
- do
- {
- this.SerialOutBytes(array, 0, array.Length);
- this.SerialInBytes(1, 1000u);
- bool flag = this.ReceiveData[0] == 17;
- if (flag)
- {
- break;
- }
- num--;
- }
- while (num > 0);
- bool flag2 = this.ReceiveData[0] != 17;
- byte result;
- if (flag2)
- {
- this.LogInfo("连接不成功!");
- this.RunErrorDisplay();
- result = 1;
- }
- else
- {
- this.LogInfo("连接成功!");
- result = 0;
- }
- return result;
- }
|