HamBook – Blame information for rev 3

Subversion Repositories:
Rev:
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 FA : Generic.CAT.FA
15 {
16 private static readonly Regex readRegex = new Regex(@"^FA(?<frequency>[0-9]{9})$", RegexOptions.Compiled);
17  
18 public FA(SerialPort serialPort) : base(serialPort)
19 {
20 }
21  
3 office 22 public override void Set(int frequency)
1 office 23 {
3 office 24 var fa = frequency.ToString("000000000");
1 office 25  
3 office 26 SerialPort.Write($"{Name}{fa}{Generic.Constants.EOT}");
1 office 27 }
28  
29 public override int Read()
30 {
3 office 31 SerialPort.Write($"{Name}{Generic.Constants.EOT}");
32 var result = SerialPort.ReadTo(Generic.Constants.EOT);
1 office 33 var match = readRegex.Match(result);
34 return int.Parse(match.Result("${frequency}"));
35 }
36 }
37 }