HamBook – Blame information for rev 7
?pathlinks?
Rev | Author | Line No. | Line |
---|---|---|---|
1 | office | 1 | using System; |
2 | using System.Collections.Generic; |
||
3 | using System.Drawing; |
||
4 | using System.IO.Ports; |
||
5 | using System.Linq; |
||
6 | using System.Text; |
||
7 | using System.Text.RegularExpressions; |
||
8 | using System.Threading.Tasks; |
||
9 | using static HamBook.Radios.Yaesu.FT_891.Constants; |
||
10 | |||
11 | namespace HamBook.Radios.Yaesu.FT_891 |
||
12 | { |
||
13 | [Radio("Yaesu FT-891")] |
||
14 | public class FB : Generic.CAT.FB |
||
15 | { |
||
16 | private static readonly Regex readRegex = new Regex(@"^FB(?<frequency>[0-9]{9})$", RegexOptions.Compiled); |
||
17 | |||
18 | public FB(SerialPort serialPort) : base(serialPort) |
||
19 | { |
||
20 | } |
||
21 | |||
7 | office | 22 | public override bool Set(int frequency) |
1 | office | 23 | { |
3 | office | 24 | var fb = frequency.ToString("000000000"); |
1 | office | 25 | |
3 | office | 26 | SerialPort.Write($"{Name}{fb}{Generic.Constants.EOT}"); |
7 | office | 27 | return Read() == frequency; |
1 | office | 28 | } |
29 | |||
30 | public override int Read() |
||
31 | { |
||
3 | office | 32 | SerialPort.Write($"{Name}{Generic.Constants.EOT}"); |
33 | var result = SerialPort.ReadTo(Generic.Constants.EOT); |
||
1 | office | 34 | var match = readRegex.Match(result); |
35 | return int.Parse(match.Result("${frequency}")); |
||
36 | } |
||
37 | } |
||
38 | } |