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; |
||
7 | office | 8 | using System.Threading; |
1 | office | 9 | using System.Threading.Tasks; |
10 | using static HamBook.Radios.Yaesu.FT_891.Constants; |
||
11 | |||
12 | namespace HamBook.Radios.Yaesu.FT_891 |
||
13 | { |
||
14 | [Radio("Yaesu FT-891")] |
||
15 | public class FA : Generic.CAT.FA |
||
16 | { |
||
17 | private static readonly Regex readRegex = new Regex(@"^FA(?<frequency>[0-9]{9})$", RegexOptions.Compiled); |
||
18 | |||
19 | public FA(SerialPort serialPort) : base(serialPort) |
||
20 | { |
||
21 | } |
||
22 | |||
7 | office | 23 | public override bool Set(int frequency) |
1 | office | 24 | { |
3 | office | 25 | var fa = frequency.ToString("000000000"); |
1 | office | 26 | |
3 | office | 27 | SerialPort.Write($"{Name}{fa}{Generic.Constants.EOT}"); |
7 | office | 28 | return Read() == frequency; |
1 | office | 29 | } |
30 | |||
31 | public override int Read() |
||
32 | { |
||
3 | office | 33 | SerialPort.Write($"{Name}{Generic.Constants.EOT}"); |
34 | var result = SerialPort.ReadTo(Generic.Constants.EOT); |
||
1 | office | 35 | var match = readRegex.Match(result); |
36 | return int.Parse(match.Result("${frequency}")); |
||
37 | } |
||
38 | } |
||
39 | } |