-
Notifications
You must be signed in to change notification settings - Fork 0
/
constant.go
144 lines (128 loc) · 3.05 KB
/
constant.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
package rig
import "strings"
type Mode uint32
const (
ModeNone Mode = 0
ModeAM Mode = 1 << iota // Amplitude Modulation
ModeCW // Continuous Wave
ModeUSB // Upper Side Band
ModeLSB // Lower Side Band
ModeRTTY // Radio Teletype
ModeFM // Narrow band FM
ModeWFM // Broadcast wide band FM
ModeCWR // Continuous Wave Reverse
ModeRTTYR // Radio Teletype Reverse
ModeAMS // Amplitude Modulation Synchronous
ModePKTLSB // Packet/Digital LSB
ModePKTUSB // Packet/Digital USB
ModePKTFM // Packet/Digital FM
ModeECSSUSB // Exalted Carrier Single Side Band USB
ModeECSSLSB // Exalted Carrier Single Side Band LSB
ModeFAX // Facsimile
ModeSAM // Synchronous AM double side band
ModeSAL // Synchronous AM lower side band
ModeSAH // Synchronous AM upper side band
ModeDSB // Double side band suppressed carrier
)
var (
ModeName = map[Mode]string{
ModeNone: "none",
ModeAM: "AM",
ModeCW: "CW",
ModeUSB: "USB",
ModeLSB: "LSB",
ModeRTTY: "RTTY",
ModeFM: "FM",
ModeWFM: "WFM",
ModeCWR: "CWR",
ModeRTTYR: "RTTYR",
ModeAMS: "AMS",
ModePKTLSB: "PKTLSB",
ModePKTUSB: "PKTUSB",
ModePKTFM: "PKTFM",
ModeECSSUSB: "ECSSUSB",
ModeECSSLSB: "ECSSLSB",
ModeFAX: "FAX",
ModeSAM: "SAM",
ModeSAL: "SAL",
ModeSAH: "SAH",
ModeDSB: "DSB",
}
ModeValue = map[string]Mode{}
)
func (m Mode) String() string {
if s, ok := ModeName[m]; ok {
return s
}
return "unknown"
}
type ITURegion uint8
const (
ITURegion1 ITURegion = iota + 1
ITURegion2
ITURegion3
)
type VFO uint32
const (
VFONone VFO = 0
VFOA VFO = 1 << iota
VFOB
VFOC
VFOSub VFO = 1 << 25
VFOMain VFO = 1 << 26
VFOLast VFO = 1 << 27
VFOMemory VFO = 1 << 28
VFOCurrent VFO = 1 << 29
)
func (v VFO) String() string {
if s, ok := VFOName[v]; ok {
return s
}
return "unknown"
}
var (
VFOName = map[VFO]string{
VFONone: "none",
VFOA: "VFO A",
VFOB: "VFO B",
VFOC: "VFO C",
VFOSub: "sub",
VFOMain: "main",
VFOMemory: "memory",
VFOCurrent: "current",
}
VFOValue = map[string]VFO{}
)
type SplitMode uint8
const (
SplitModeNone SplitMode = iota
SplitModeOff
SplitModeOn
SplitModeTX
)
func (m SplitMode) String() string {
if s, ok := SplitModeName[m]; ok {
return s
}
return "unknown"
}
var (
SplitModeName = map[SplitMode]string{
SplitModeNone: "none",
SplitModeOff: "off",
SplitModeOn: "on",
SplitModeTX: "tx",
}
SplitModeValue = map[string]SplitMode{}
)
func init() {
for m, n := range ModeName {
ModeValue[n] = m
}
for v, n := range VFOName {
VFOValue[strings.Replace(n, " ", "", -1)] = v
}
for m, n := range SplitModeName {
SplitModeValue[n] = m
}
}