HamBook – Diff between revs 39 and 45
?pathlinks?
Rev 39 | Rev 45 | |||
---|---|---|---|---|
Line 8... | Line 8... | |||
8 | using Serilog; |
8 | using Serilog; |
|
9 | using HamBook.Properties; |
9 | using HamBook.Properties; |
|
10 | using System.Media; |
10 | using System.Media; |
|
11 | using System.Reflection; |
11 | using System.Reflection; |
|
12 | using RJCP.IO.Ports; |
12 | using RJCP.IO.Ports; |
|
- | 13 | using HamBook.Radios.Yaesu.FT_891; |
||
Line 13... | Line 14... | |||
13 | |
14 | |
|
14 | namespace HamBook |
15 | namespace HamBook |
|
15 | { |
16 | { |
|
16 | public class MemoryTune |
17 | public class MemoryTune |
|
Line 19... | Line 20... | |||
19 | private CancellationToken _scanningCancellationToken; |
20 | private CancellationToken _scanningCancellationToken; |
|
20 | private Thread _scanThread; |
21 | private Thread _scanThread; |
|
21 | private CatAssemblies _catAssemblies; |
22 | private CatAssemblies _catAssemblies; |
|
22 | private SerialPortStream _serialPort; |
23 | private SerialPortStream _serialPort; |
|
23 | private Configuration.Configuration _configuration; |
24 | private Configuration.Configuration _configuration; |
|
- | 25 | private Radios.Generic.MemoryBanks _memoryBanks; |
||
Line 24... | Line 26... | |||
24 | |
26 | |
|
25 | private MemoryTune() |
27 | private MemoryTune() |
|
26 | { |
28 | { |
|
Line 30... | Line 32... | |||
30 | { |
32 | { |
|
31 | _catAssemblies = catAssemblies; |
33 | _catAssemblies = catAssemblies; |
|
32 | _serialPort = serialPort; |
34 | _serialPort = serialPort; |
|
33 | _configuration = configuration; |
35 | _configuration = configuration; |
|
Line -... | Line 36... | |||
- | 36 | |
||
34 | |
37 | _memoryBanks = Radios.Generic.MemoryBanks.Create(_configuration.Radio); |
|
Line 35... | Line 38... | |||
35 | } |
38 | } |
|
36 | |
39 | |
|
37 | public void Start() |
40 | public void Start() |
|
Line 50... | Line 53... | |||
50 | _scanningCancellationTokenSource = new CancellationTokenSource(); |
53 | _scanningCancellationTokenSource = new CancellationTokenSource(); |
|
51 | _scanningCancellationToken = _scanningCancellationTokenSource.Token; |
54 | _scanningCancellationToken = _scanningCancellationTokenSource.Token; |
|
Line 52... | Line 55... | |||
52 | |
55 | |
|
Line 53... | Line 56... | |||
53 | _scanThread = new Thread(new ParameterizedThreadStart(Tune)); |
56 | _scanThread = new Thread(new ParameterizedThreadStart(Tune)); |
|
54 | |
57 | |
|
55 | var memoryBankQueue = new Queue<int>(); |
58 | var memoryBankQueue = new Queue<string>(); |
|
56 | foreach (var bank in Enumerable.Range(1, 99)) |
59 | foreach (var bank in _memoryBanks.GetMemoryBanks()) |
|
57 | { |
60 | { |
|
Line 58... | Line 61... | |||
58 | memoryBankQueue.Enqueue(bank); |
61 | memoryBankQueue.Enqueue(bank); |
|
Line 75... | Line 78... | |||
75 | } |
78 | } |
|
76 | } |
79 | } |
|
Line 77... | Line 80... | |||
77 | |
80 | |
|
78 | private async void Tune(object obj) |
81 | private async void Tune(object obj) |
|
79 | { |
82 | { |
|
Line 80... | Line 83... | |||
80 | var memoryBankQueue = (Queue<int>)obj; |
83 | var memoryBankQueue = (Queue<string>)obj; |
|
81 | |
84 | |
|
82 | do |
85 | do |
|
83 | { |
86 | { |