HamBook – Blame information for rev 3

Subversion Repositories:
Rev:
Rev Author Line No. Line
3 office 1 using HamBook.Radios.Generic;
2 using System;
3 using System.Collections.Generic;
4 using System.Drawing;
5 using System.IO.Ports;
6 using System.Linq;
7 using System.Text;
8 using System.Text.RegularExpressions;
9 using System.Threading.Tasks;
10 using static HamBook.Radios.Yaesu.FT_891.Constants;
11  
12 namespace HamBook.Radios.Yaesu.FT_891.CAT
13 {
14 [Radio("Yaesu FT-891")]
15 public class IF : Generic.CAT.IF
16 {
17 public IF(SerialPort serialPort) : base(serialPort)
18 {
19 }
20  
21 public override Information Read()
22 {
23 SerialPort.Write($"{Name}{Generic.Constants.EOT}");
24 var result = SerialPort.ReadTo(Generic.Constants.EOT);
25 var match = InformationRegex.Match(result);
26  
27 var information = new Information
28 {
29 RadioBank = int.Parse(match.Result("${radioBank}")),
30 Frequency = int.Parse(match.Result("${frequency}")),
31 ClarifierDirection = char.Parse(match.Result("${clarifierDirection}")),
32 ClarifierOffset = int.Parse(match.Result("${clarifierOffset}")),
33 Clar = int.Parse(match.Result("${clar}")),
34 RadioMode = char.Parse(match.Result("${mode}")),
35 Storage = (RadioStorage)int.Parse(match.Result("${storage}")),
36 CtcssMode = (CtcssMode)int.Parse(match.Result("${ctcssMode}")),
37 Phase = (RadioPhase)int.Parse(match.Result("${phase}"))
38 };
39  
40 return information;
41 }
42 }
43 }