HamBook – Diff between revs 9 and 11
?pathlinks?
Rev 9 | Rev 11 | |||
---|---|---|---|---|
Line 38... | Line 38... | |||
38 | { |
38 | { |
|
39 | SerialPort.Write($"{Name}{Generic.Constants.EOT}"); |
39 | SerialPort.Write($"{Name}{Generic.Constants.EOT}"); |
|
40 | var buffer = new byte[CatLength.Answer]; |
40 | var buffer = new byte[CatLength.Answer]; |
|
41 | if(SerialPort.Read(buffer, 0, CatLength.Answer) != CatLength.Answer) |
41 | if(SerialPort.Read(buffer, 0, CatLength.Answer) != CatLength.Answer) |
|
42 | { |
42 | { |
|
43 | throw new ArgumentException(); |
43 | throw new UnexpectedRadioResponseException(Name, buffer); |
|
44 | } |
44 | } |
|
Line 45... | Line 45... | |||
45 | |
45 | |
|
46 | var answer = Encoding.ASCII.GetString(buffer); |
46 | var answer = Constants.Encoding.GetString(buffer); |
|
47 | var match = readRegex.Match(answer); |
47 | var match = readRegex.Match(answer); |
|
48 | if (!match.Success) |
48 | if (!match.Success) |
|
49 | { |
49 | { |
|
50 | throw new ArgumentException(); |
50 | throw new UnmatchedRadioResponseException(Name, answer); |
|
Line 51... | Line 51... | |||
51 | } |
51 | } |
|
52 | |
52 | |
|
53 | return (BusyState)int.Parse(match.Result("${state}")); |
53 | return (BusyState)int.Parse(match.Result("${state}")); |