HamBook – Blame information for rev 9

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;
9 office 11 using RJCP.IO.Ports;
3 office 12  
13 namespace HamBook.Radios.Yaesu.FT_891.CAT
14 {
15 [Radio("Yaesu FT-891")]
16 public class IF : Generic.CAT.IF
17 {
9 office 18 public override CatLength CatLength => new CatLength { Answer = 28, Read = 3 };
19 public IF(SerialPortStream serialPort) : base(serialPort)
3 office 20 {
21 }
22  
23 public override Information Read()
24 {
25 SerialPort.Write($"{Name}{Generic.Constants.EOT}");
9 office 26 var result = SerialPort.ReadTo($"{Generic.Constants.EOT}");
3 office 27 var match = InformationRegex.Match(result);
28  
29 var information = new Information
30 {
31 RadioBank = int.Parse(match.Result("${radioBank}")),
32 Frequency = int.Parse(match.Result("${frequency}")),
33 ClarifierDirection = char.Parse(match.Result("${clarifierDirection}")),
34 ClarifierOffset = int.Parse(match.Result("${clarifierOffset}")),
35 Clar = int.Parse(match.Result("${clar}")),
36 RadioMode = char.Parse(match.Result("${mode}")),
37 Storage = (RadioStorage)int.Parse(match.Result("${storage}")),
38 CtcssMode = (CtcssMode)int.Parse(match.Result("${ctcssMode}")),
39 Phase = (RadioPhase)int.Parse(match.Result("${phase}"))
40 };
41  
42 return information;
43 }
44 }
45 }