HamBook – Blame information for rev 45
?pathlinks?
Rev | Author | Line No. | Line |
---|---|---|---|
44 | office | 1 | using HamBook.Radios.Generic; |
2 | using System; |
||
3 | using System.Collections.Generic; |
||
4 | using System.Linq; |
||
5 | using System.Text; |
||
6 | using System.Threading.Tasks; |
||
45 | office | 7 | using System.Xml.Serialization; |
44 | office | 8 | |
9 | namespace HamBook.Radios.Yaesu.FT_891 |
||
10 | { |
||
45 | office | 11 | [XmlRoot(Namespace = "Yaesu FT-891")] |
44 | office | 12 | public class MemoryRadioMode : Generic.MemoryRadioMode |
13 | { |
||
14 | public override char Code { get; } |
||
15 | |||
16 | public override string Name { get; } |
||
17 | |||
45 | office | 18 | public MemoryRadioMode() |
19 | { |
||
20 | |||
21 | } |
||
22 | |||
44 | office | 23 | public MemoryRadioMode(string name) |
24 | { |
||
25 | Name = name; |
||
26 | Code = NameToCode(name); |
||
27 | } |
||
28 | |||
29 | public MemoryRadioMode(char code) |
||
30 | { |
||
31 | Code = code; |
||
32 | Name = CodeToName(code); |
||
33 | } |
||
34 | |||
35 | public override char NameToCode(string name) |
||
36 | { |
||
37 | switch (name) |
||
38 | { |
||
39 | case "LSB": |
||
40 | return '1'; |
||
41 | case "USB": |
||
42 | return '2'; |
||
43 | case "CW": |
||
44 | return '3'; |
||
45 | case "FM": |
||
46 | return '4'; |
||
47 | case "AM": |
||
48 | return '5'; |
||
49 | case "RTTY-LSB": |
||
50 | return '6'; |
||
51 | case "CW-R": |
||
52 | return '7'; |
||
53 | case "DATA-LSB": |
||
54 | return '8'; |
||
55 | case "RTTY-USB": |
||
56 | return '9'; |
||
57 | case "FM-N": |
||
58 | return 'B'; |
||
59 | case "DATA-USB": |
||
60 | return 'C'; |
||
61 | case "AM-N": |
||
62 | return 'D'; |
||
63 | default: |
||
64 | throw new ArgumentException(); |
||
65 | } |
||
66 | } |
||
67 | |||
68 | public override string CodeToName(char code) |
||
69 | { |
||
70 | switch (code) |
||
71 | { |
||
72 | case '1': |
||
73 | return "LSB"; |
||
74 | case '2': |
||
75 | return "USB"; |
||
76 | case '3': |
||
77 | return "CW"; |
||
78 | case '4': |
||
79 | return "FM"; |
||
80 | case '5': |
||
81 | return "AM"; |
||
82 | case '6': |
||
83 | return "RTTY-USB"; |
||
84 | case '7': |
||
85 | return "CW-R"; |
||
86 | case '8': |
||
87 | return "DATA-LSB"; |
||
88 | case '9': |
||
89 | return "RTTY-USB"; |
||
90 | case 'B': |
||
91 | return "FM-N"; |
||
92 | case 'C': |
||
93 | return "DATA-USB"; |
||
94 | case 'D': |
||
95 | return "AM-N"; |
||
96 | default: |
||
97 | throw new ArgumentException(); |
||
98 | } |
||
99 | } |
||
100 | } |
||
101 | } |