HamBook – Blame information for rev 56
?pathlinks?
Rev | Author | Line No. | Line |
---|---|---|---|
56 | office | 1 | using HamBook.Utilities; |
2 | using System; |
||
3 | using System.Collections.Generic; |
||
4 | using System.Linq; |
||
5 | using System.Text; |
||
6 | using System.Threading.Tasks; |
||
7 | using System.Xml.Serialization; |
||
8 | |||
9 | namespace HamBook.Radios.Yaesu.FT_891 |
||
10 | { |
||
11 | [Radio("Yaesu FT-891")] |
||
12 | [XmlRoot(Namespace = "Yaesu FT-891")] |
||
13 | public class RadioMenu : Generic.RadioMenu |
||
14 | { |
||
15 | public override int[] Indices => |
||
16 | new[] |
||
17 | { |
||
18 | 101, 102, 03, 201, 202, 203, 204, 205, 206, |
||
19 | 207, 301, 302, 401, 402, 403, 404, 405, 406, |
||
20 | 407, 408, 409, 410, 411, 501, 502, 503, 505, |
||
21 | 506, 507, 508, 509, 510, 511, 512, 513, 514, |
||
22 | 515, 516, 517, 518, 519, 520, 601, 602, 603, |
||
23 | 604, 605, 606, 607, 701, 702, 703, 704, 705, |
||
24 | 706, 707, 708, 709, 710, 711, 712, 713, 801, |
||
25 | 802, 803, 804, 805, 806, 807, 808, 809, 810, |
||
26 | 811, 812, 901, 902, 903, 904, 905, 906, 1001, |
||
27 | 1002, 1003, 1004, 1005, 1006, 1007, 1008, 1009, |
||
28 | 1010, 1011, 1101, 1102, 1103, 1104, 1105, 1106, |
||
29 | 1107, 1108, 1109, 1201, 1202, 1203, 1204, 1301, |
||
30 | 1302, 1401, 1402, 1403, 1404, 1405, 1406, 1407, |
||
31 | 1501, 1502, 1503, 1504, 1505, 1506, 1507, 1508, |
||
32 | 1509, 1010, 1511, 1512, 1513, 1514, 1515, 1516, |
||
33 | 1517, 1518, 1601, 1602, 1603, 1604, 1605, 1606, |
||
34 | 1607, 1608, 1609, 1610, 1611, 1612, 1613, 1614, |
||
35 | 1615, 1616, 1617, 1618, 1619, 1620, 1621, 1622, |
||
36 | 1623 //, 1701, 1801, 1802, 1803 |
||
37 | }; |
||
38 | |||
39 | public override int MenuToCAT(int menu, string value) |
||
40 | { |
||
41 | switch (menu) |
||
42 | { |
||
43 | case 205: |
||
44 | return Array.IndexOf(new[] { "OFF", "0.5", "1.0", "2.0" }, value); |
||
45 | |||
46 | case 508: |
||
47 | case 509: |
||
48 | case 510: |
||
49 | case 511: |
||
50 | case 512: |
||
51 | case 515: |
||
52 | case 1623: |
||
53 | case 206: |
||
54 | return Array.IndexOf(new[] { "DISABLE", "ENABLE" }, value); |
||
55 | |||
56 | case 207: |
||
57 | return Array.IndexOf(new[] { "UPPER", "LOWER" }, value); |
||
58 | |||
59 | case 401: |
||
60 | return Array.IndexOf(new[] { "OFF", "BUG", "ELEKEY-A", "ELEKEY-B", "ELEKEY-Y", "ACS" }, |
||
61 | value); |
||
62 | |||
63 | case 1006: |
||
64 | case 1007: |
||
65 | case 402: |
||
66 | return Array.IndexOf(new[] { "NOR", "REV" }, value); |
||
67 | |||
68 | case 403: |
||
69 | var list = new List<string>(); |
||
70 | for (var j = 2.0; j <= 4.5; j += 0.1) |
||
71 | { |
||
72 | var v = $"{(decimal)j:f1}"; |
||
73 | list.Add(v); |
||
74 | } |
||
75 | |||
76 | return list.IndexOf(value); |
||
77 | |||
78 | case 404: |
||
79 | return Array.IndexOf( |
||
80 | new[] { "OFF" }.Concat(Mathematics.GenerateRange(1, 690).Select(o => o.ToString())) |
||
81 | .ToArray(), value); |
||
82 | |||
83 | case 405: |
||
84 | return Array.IndexOf(new[] { "1290", "AUNO", "AUNT", "A2NO", "A2NT", "12NO", "12NT" }, |
||
85 | value); |
||
86 | |||
87 | case 407: |
||
88 | case 408: |
||
89 | case 409: |
||
90 | case 410: |
||
91 | case 411: |
||
92 | return Array.IndexOf(new[] { "TEXT", "MESSAGE" }, value); |
||
93 | |||
94 | case 501: |
||
95 | return Array.IndexOf(new[] { 1, 3, 10 }, value); |
||
96 | |||
97 | case 502: |
||
98 | return Array.IndexOf(new[] { 10, 30, 50 }, value); |
||
99 | |||
100 | case 505: |
||
101 | return Array.IndexOf(new[] { "RF", "SQL" }, value); |
||
102 | |||
103 | case 506: |
||
104 | return Array.IndexOf(new[] { 4800, 9600, 19200, 38400 }, value); |
||
105 | |||
106 | case 507: |
||
107 | return Array.IndexOf(new[] { 10, 100, 1000, 3000 }, value); |
||
108 | |||
109 | case 513: |
||
110 | return Array.IndexOf(Mathematics.GenerateRange(-20, 20).ToArray(), value); |
||
111 | |||
112 | case 514: |
||
113 | return Array.IndexOf( |
||
114 | new[] { "OFF" }.Concat(Mathematics.GenerateRange(1, 30).Select(o => o.ToString())) |
||
115 | .ToArray(), |
||
116 | value); |
||
117 | |||
118 | case 516: |
||
119 | return Array.IndexOf(new[] { "PAUSE", "TIME" }, value); |
||
120 | |||
121 | case 517: |
||
122 | return Array.IndexOf(Mathematics.GenerateRange(-25, 25).ToArray(), value); |
||
123 | |||
124 | case 518: |
||
125 | return Array.IndexOf(new[] { "RX", "TX", "TRX" }, value); |
||
126 | |||
127 | case 519: |
||
128 | return Array.IndexOf(new[] { "OFF", "1", "2", "4", "6", "8", "10", "12" }, value); |
||
129 | |||
130 | case 520: |
||
131 | return Array.IndexOf(new[] { "NORMAL", "CONTEST" }, value); |
||
132 | |||
133 | case 601: |
||
134 | return Array.IndexOf(new[] { "OFF" }.Concat(Mathematics.GenerateRange(100, 1000, 50) |
||
135 | .Select(o => o.ToString())).ToArray(), value); |
||
136 | |||
137 | case 1102: |
||
138 | case 1104: |
||
139 | case 1002: |
||
140 | case 1004: |
||
141 | case 806: |
||
142 | case 808: |
||
143 | case 704: |
||
144 | case 702: |
||
145 | case 604: |
||
146 | case 602: |
||
147 | return Array.IndexOf(new[] { 6, 18 }, value); |
||
148 | |||
149 | case 603: |
||
150 | return Array.IndexOf(new[] { "OFF" }.Concat(Mathematics.GenerateRange(700, 4000, 50) |
||
151 | .Select(o => o.ToString())).ToArray(), value); |
||
152 | |||
153 | case 1105: |
||
154 | case 901: |
||
155 | case 809: |
||
156 | case 605: |
||
157 | return Array.IndexOf(new[] { "MIC", "REAR" }, value); |
||
158 | |||
159 | case 1108: |
||
160 | case 903: |
||
161 | case 810: |
||
162 | case 607: |
||
163 | return Array.IndexOf(new[] { "DAKY", "RTS", "DTR" }, value); |
||
164 | |||
165 | case 701: |
||
166 | return Array.IndexOf(new[] { "OFF" }.Concat(Mathematics.GenerateRange(100, 1000, 50) |
||
167 | .Select(o => o.ToString())).ToArray(), value); |
||
168 | |||
169 | case 703: |
||
170 | return Array.IndexOf(new[] { "OFF" }.Concat(Mathematics.GenerateRange(700, 4000, 50) |
||
171 | .Select(o => o.ToString())).ToArray(), value); |
||
172 | |||
173 | case 706: |
||
174 | return Array.IndexOf(new[] { "OFF", "50M", "ON" }, value); |
||
175 | |||
176 | case 1107: |
||
177 | case 707: |
||
178 | return Array.IndexOf(new[] { "USB", "LSB", "AUTO" }, value); |
||
179 | |||
180 | case 708: |
||
181 | return Array.IndexOf(new[] { "SEMI", "FULL" }, value); |
||
182 | |||
183 | case 709: |
||
184 | return Array.IndexOf(Mathematics.GenerateRange(30, 3000, 10).ToArray(), value); |
||
185 | |||
186 | case 710: |
||
187 | return Array.IndexOf(new[] { string.Empty, "2", "4" }, value); |
||
188 | |||
189 | case 711: |
||
190 | return Array.IndexOf(new[] { "FREQ", "PITCH" }, value); |
||
191 | |||
192 | case 712: |
||
193 | return Array.IndexOf(new[] { "OFF", "DAKY", "RTS", "DTR" }, value); |
||
194 | |||
195 | case 713: |
||
196 | return Array.IndexOf(new[] { 15, 20, 25, 30 }, value); |
||
197 | |||
198 | case 801: |
||
199 | return Array.IndexOf(new[] { "PSK", "OTHERS" }, value); |
||
200 | |||
201 | case 802: |
||
202 | return Array.IndexOf(new[] { 1000, 1500, 2000 }, value); |
||
203 | |||
204 | case 803: |
||
205 | return Array.IndexOf(Mathematics.GenerateRange(-3000, 3000, 10).ToArray(), value); |
||
206 | |||
207 | case 804: |
||
208 | return Array.IndexOf(Mathematics.GenerateRange(-3000, 3000, 10).ToArray(), value); |
||
209 | |||
210 | case 805: |
||
211 | return Array.IndexOf(new[] { "OFF" }.Concat(Mathematics.GenerateRange(100, 1000, 50) |
||
212 | .Select(o => o.ToString())).ToArray(), value); |
||
213 | |||
214 | case 807: |
||
215 | return Array.IndexOf(new[] { "OFF" }.Concat(Mathematics.GenerateRange(700, 4000, 50) |
||
216 | .Select(o => o.ToString())).ToArray(), value); |
||
217 | |||
218 | case 1011: |
||
219 | case 812: |
||
220 | return Array.IndexOf(new[] { "USB", "LSB" }, value); |
||
221 | |||
222 | case 904: |
||
223 | return Array.IndexOf(Mathematics.GenerateRange(0, 1000, 10).ToArray(), value); |
||
224 | |||
225 | case 905: |
||
226 | return Array.IndexOf(Mathematics.GenerateRange(0, 4000, 10).ToArray(), value); |
||
227 | |||
228 | case 906: |
||
229 | return Array.IndexOf(new[] { "Tn-Rn", "Tn-Riv", "Tiv-Rn", "Tiv-Riv" }, value); |
||
230 | |||
231 | case 1001: |
||
232 | return Array.IndexOf(new[] { "OFF" }.Concat(Mathematics.GenerateRange(100, 1000, 50) |
||
233 | .Select(o => o.ToString())).ToArray(), value); |
||
234 | |||
235 | case 1003: |
||
236 | return Array.IndexOf(new[] { "OFF" }.Concat(Mathematics.GenerateRange(700, 4000, 50) |
||
237 | .Select(o => o.ToString())).ToArray(), value); |
||
238 | |||
239 | case 1005: |
||
240 | return Array.IndexOf(new[] { "SHIFT", "DTR", "RTS" }, value); |
||
241 | |||
242 | case 1009: |
||
243 | return Array.IndexOf(new[] { 170, 200, 425, 850 }, value); |
||
244 | |||
245 | case 1010: |
||
246 | return Array.IndexOf(new[] { 1275, 2125 }, value); |
||
247 | |||
248 | case 1101: |
||
249 | return Array.IndexOf(new[] { "OFF" }.Concat(Mathematics.GenerateRange(100, 1000, 50) |
||
250 | .Select(o => o.ToString())).ToArray(), value); |
||
251 | |||
252 | case 1103: |
||
253 | return Array.IndexOf(new[] { "OFF" }.Concat(Mathematics.GenerateRange(700, 4000, 50) |
||
254 | .Select(o => o.ToString())).ToArray(), value); |
||
255 | |||
256 | case 1109: |
||
257 | return Array.IndexOf( |
||
258 | new[] { "100-3000", "100-2900", "200-2800", "300-2700", "400-2600" }, value); |
||
259 | |||
260 | case 1201: |
||
261 | return Array.IndexOf(new[] { "NARROW", "MEDIUM", "WIDE" }, value); |
||
262 | |||
263 | case 1202: |
||
264 | return Array.IndexOf(Mathematics.GenerateRange(-40, 20).ToArray(), value); |
||
265 | |||
266 | case 1204: |
||
267 | return Array.IndexOf(new[] { "NARROW", "WIDE" }, value); |
||
268 | |||
269 | case 1301: |
||
270 | return Array.IndexOf(new[] { "OFF", "3", "5", "10" }, value); |
||
271 | |||
272 | case 1302: |
||
273 | return Array.IndexOf(new[] { 37.5, 75, 150, 375, 750 }, value); |
||
274 | |||
275 | case 1401: |
||
276 | return Array.IndexOf(new[] { 50, 100, 500 }, value); |
||
277 | |||
278 | case 1402: |
||
279 | return Array.IndexOf(new[] { 2, 5, 10 }, value); |
||
280 | |||
281 | case 1403: |
||
282 | case 1404: |
||
283 | return Array.IndexOf(new[] { 2, 5, 10 }, value); |
||
284 | case 1405: |
||
285 | return Array.IndexOf(new[] { 2, 5, 10 }, value); |
||
286 | case 1406: |
||
287 | return Array.IndexOf(new[] { 2.5, 5, 2.9, 10, 12.5, 25 }, value); |
||
288 | case 1407: |
||
289 | return Array.IndexOf(new[] { 5, 6.25, 10, 12.5, 15, 20, 25 }, value); |
||
290 | case 1501: |
||
291 | return Array.IndexOf(new[] { "OFF" }.Concat(Mathematics.GenerateRange(100, 700, 100) |
||
292 | .Select(o => o.ToString())).ToArray(), value); |
||
293 | case 1504: |
||
294 | return Array.IndexOf(new[] { "OFF" }.Concat(Mathematics.GenerateRange(700, 1500, 100) |
||
295 | .Select(o => o.ToString())).ToArray(), value); |
||
296 | case 1514: |
||
297 | case 1511: |
||
298 | case 1508: |
||
299 | case 1505: |
||
300 | return Array.IndexOf(Mathematics.GenerateRange(-20, 10).ToArray(), value); |
||
301 | case 1507: |
||
302 | return Array.IndexOf(new[] { "OFF" }.Concat(Mathematics.GenerateRange(1500, 3200, 100) |
||
303 | .Select(o => o.ToString())).ToArray(), value); |
||
304 | case 1510: |
||
305 | return Array.IndexOf(new[] { "OFF" }.Concat(Mathematics.GenerateRange(100, 700, 100) |
||
306 | .Select(o => o.ToString())).ToArray(), value); |
||
307 | case 1513: |
||
308 | return Array.IndexOf(new[] { "OFF" }.Concat(Mathematics.GenerateRange(700, 1500, 100) |
||
309 | .Select(o => o.ToString())).ToArray(), value); |
||
310 | case 1515: |
||
311 | return Array.IndexOf(Mathematics.GenerateRange(1, 10).ToArray(), value); |
||
312 | case 1516: |
||
313 | return Array.IndexOf(new[] { "OFF" }.Concat(Mathematics.GenerateRange(1500, 3200, 100) |
||
314 | .Select(o => o.ToString())).ToArray(), value); |
||
315 | case 1614: |
||
316 | case 1613: |
||
317 | case 1612: |
||
318 | case 1611: |
||
319 | case 1610: |
||
320 | case 1609: |
||
321 | case 1608: |
||
322 | case 1607: |
||
323 | case 1606: |
||
324 | case 1603: |
||
325 | case 1604: |
||
326 | case 1601: |
||
327 | return Array.IndexOf(Mathematics.GenerateRange(5, 100).ToArray(), value); |
||
328 | case 1605: |
||
329 | case 1602: |
||
330 | return Array.IndexOf(Mathematics.GenerateRange(5, 40).ToArray(), value); |
||
331 | case 1615: |
||
332 | return Array.IndexOf(new[] { "OFF", "EXTERNAL", "ATAS", "LAMP" }, value); |
||
333 | case 1616: |
||
334 | return Array.IndexOf(new[] { "MIC", "DATA" }, value); |
||
335 | case 1618: |
||
336 | return Array.IndexOf(Mathematics.GenerateRange(30, 3000, 10).ToArray(), value); |
||
337 | case 1622: |
||
338 | case 1620: |
||
339 | case 1619: |
||
340 | return Array.IndexOf(Mathematics.GenerateRange(0, 100).ToArray(), value); |
||
341 | case 1621: |
||
342 | return Array.IndexOf(Mathematics.GenerateRange(30, 3000).ToArray(), value); |
||
343 | default: |
||
344 | if (!int.TryParse(value, out var result)) |
||
345 | { |
||
346 | throw new ArgumentException(); |
||
347 | } |
||
348 | |||
349 | return result; |
||
350 | } |
||
351 | } |
||
352 | } |
||
353 | } |