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