HamBook – Blame information for rev 3
?pathlinks?
Rev | Author | Line No. | Line |
---|---|---|---|
3 | office | 1 | using HamBook.Radios.Generic; |
2 | using HamBook.Radios.Generic.CAT; |
||
3 | using System; |
||
4 | using System.Collections.Generic; |
||
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 |
||
13 | { |
||
14 | [Radio("Yaesu FT-891")] |
||
15 | public class SQ : HamBook.Radios.Generic.CAT.SQ |
||
16 | { |
||
17 | private static readonly Regex readRegex = new Regex(@"^SQ0(?<squelch>[0-9]{3})$", RegexOptions.Compiled); |
||
18 | |||
19 | public SQ(SerialPort serialPort) : base(serialPort) |
||
20 | { |
||
21 | } |
||
22 | |||
23 | public override int GetDefault() |
||
24 | { |
||
25 | return SQUELCH_MIN_STEP; |
||
26 | } |
||
27 | |||
28 | public override int Read() |
||
29 | { |
||
30 | SerialPort.Write($"{Name}0{Generic.Constants.EOT}"); |
||
31 | var result = SerialPort.ReadTo(Generic.Constants.EOT); |
||
32 | var match = readRegex.Match(result); |
||
33 | var level = int.Parse(match.Result("${squelch}")); |
||
34 | return level; |
||
35 | } |
||
36 | |||
37 | public override void Set(int level) |
||
38 | { |
||
39 | SerialPort.Write($"{Name}0{level.ToString("000")}{Generic.Constants.EOT}"); |
||
40 | } |
||
41 | |||
42 | |||
43 | } |
||
44 | } |