-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathtypes.py
More file actions
190 lines (172 loc) · 7.34 KB
/
Copy pathtypes.py
File metadata and controls
190 lines (172 loc) · 7.34 KB
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
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
"""
ka9q-radio protocol types and constants
Auto-generated by scripts/sync_types.py from ka9q-radio C headers.
Validated against ka9q-radio commit: 401992cdecaa
DO NOT EDIT MANUALLY — run: python scripts/sync_types.py --apply
"""
class StatusType:
"""TLV type identifiers for radiod status/control protocol"""
EOL = 0
COMMAND_TAG = 1 # Echoes tag from requester
CMD_CNT = 2 # Count of input commands
GPS_TIME = 3 # Nanoseconds since GPS epoch (remember to update the leap second tables!)
DESCRIPTION = 4 # Free form text describing source
STATUS_DEST_SOCKET = 5
SETOPTS = 6
CLEAROPTS = 7
RTP_TIMESNAP = 8 # snapshot of current real-time-protocol timestamp, for linking RTP timestamps to clock time via GPS_TIME
BIN_BYTE_DATA = 9 # Vector of 1-byte spectrum analyzer data
INPUT_SAMPRATE = 10 # Nominal sample rate (integer)
SPECTRUM_BASE = 11 # base level of 1-byte analyzer data, dB
SPECTRUM_AVG = 12 # Number of FFTs averaged into each spectrum response
INPUT_SAMPLES = 13
WINDOW_TYPE = 14 # Window type for FFT analyzer
NOISE_BW = 15 # Noise bandwidth of FFT spectrum bin, in bins
OUTPUT_DATA_SOURCE_SOCKET = 16
OUTPUT_DATA_DEST_SOCKET = 17
OUTPUT_SSRC = 18
OUTPUT_TTL = 19
OUTPUT_SAMPRATE = 20
OUTPUT_METADATA_PACKETS = 21
OUTPUT_DATA_PACKETS = 22
OUTPUT_ERRORS = 23
CALIBRATE = 24
LNA_GAIN = 25
MIXER_GAIN = 26
IF_GAIN = 27
DC_I_OFFSET = 28
DC_Q_OFFSET = 29
IQ_IMBALANCE = 30
IQ_PHASE = 31
DIRECT_CONVERSION = 32 # Boolean indicating SDR is direct conversion -- should avoid DC
RADIO_FREQUENCY = 33
FIRST_LO_FREQUENCY = 34
SECOND_LO_FREQUENCY = 35
SHIFT_FREQUENCY = 36
DOPPLER_FREQUENCY = 37
DOPPLER_FREQUENCY_RATE = 38
LOW_EDGE = 39
HIGH_EDGE = 40
KAISER_BETA = 41
FILTER_BLOCKSIZE = 42
FILTER_FIR_LENGTH = 43
FILTER2 = 44
IF_POWER = 45
BASEBAND_POWER = 46
NOISE_DENSITY = 47
DEMOD_TYPE = 48 # 0 = linear (default), 1 = FM, 2 = WFM/Stereo, 3 = spectrum
OUTPUT_CHANNELS = 49 # 1 or 2 in Linear and WFM, 1 in FM
INDEPENDENT_SIDEBAND = 50 # Linear only
PLL_ENABLE = 51
PLL_LOCK = 52 # Linear PLL
PLL_SQUARE = 53 # Linear PLL
PLL_PHASE = 54 # Linear PLL
PLL_BW = 55 # PLL loop bandwidth
ENVELOPE = 56 # Envelope detection in linear mode
SNR_SQUELCH = 57 # Enable SNR squelch, all modes
PLL_SNR = 58 # FM, PLL linear
FREQ_OFFSET = 59 # FM, PLL linear
PEAK_DEVIATION = 60 # FM only
PL_TONE = 61 # PL tone squelch frequency (FM only)
AGC_ENABLE = 62 # boolean, linear modes only
HEADROOM = 63 # Audio level headroom, stored as amplitude ratio, exchanged as dB
AGC_HANGTIME = 64 # AGC hang time, stored as samples, exchanged as sec
AGC_RECOVERY_RATE = 65 # stored as amplitude ratio/sample, exchanged as dB/sec
FM_SNR = 66 # selected FM SNR (variance or signal snr)
AGC_THRESHOLD = 67 # stored as amplitude ratio, exchanged as dB
GAIN = 68 # AM, Linear only, stored as amplitude ratio, exchanged as dB
OUTPUT_LEVEL = 69 # All modes
OUTPUT_SAMPLES = 70
OPUS_BIT_RATE = 71
MAXDELAY = 72 # Maximum allowable aggregation delay, blocks (0-5)
FILTER2_BLOCKSIZE = 73
FILTER2_FIR_LENGTH = 74
FILTER2_KAISER_BETA = 75
SPECTRUM_FFT_N = 76
FILTER_DROPS = 77
LOCK = 78 # Tuner is locked, will ignore retune commands (boolean)
TP1 = 79 # General purpose test points (floating point)
TP2 = 80
UNUSED4 = 81
AD_BITS_PER_SAMPLE = 82 # Front end A/D width, used for gain scaling
SQUELCH_OPEN = 83 # Squelch opening threshold SNR
SQUELCH_CLOSE = 84 # and closing
PRESET = 85 # char string containing mode presets
DEEMPH_TC = 86 # De-emphasis time constant (FM only)
DEEMPH_GAIN = 87 # De-emphasis gain (FM only)
UNUSED3 = 88
PL_DEVIATION = 89 # Measured PL tone deviation, Hz (FM only)
THRESH_EXTEND = 90 # threshold extension enable (FM only)
SPECTRUM_SHAPE = 91 # parameter for spectrum analysis window (eg, Kaiser beta)
UNUSED2 = 92
RESOLUTION_BW = 93 # Bandwidth (Hz) of noncoherent integration bin, some multiple of COHERENT_BIN_SPACING
BIN_COUNT = 94 # Integer number of bins accumulating energy noncoherently
CROSSOVER = 95 # Frequency in Hz where spectrum algorithm changes
BIN_DATA = 96 # Vector of relative bin energies, real (I^2 + Q^2)
RF_ATTEN = 97 # Front end attenuation (introduced with rx888)
RF_GAIN = 98 # Front end gain (introduced with rx888)
RF_AGC = 99 # Front end AGC on/off
FE_LOW_EDGE = 100 # edges of front end filter
FE_HIGH_EDGE = 101
FE_ISREAL = 102 # Boolean, true -> front end uses real sampling, false -> front end uses complex
UNUSED = 103
AD_OVER = 104 # A/D full scale samples, proxy for overranges
RTP_PT = 105 # Real Time Protocol Payload Type
STATUS_INTERVAL = 106 # Automatically send channel status over *data* channel every STATUS_INTERVAL frames
OUTPUT_ENCODING = 107 # Output data encoding (see enum encoding in multicast.h)
SAMPLES_SINCE_OVER = 108 # Samples since last A/D overrange
PLL_WRAPS = 109 # Count of complete linear mode PLL rotations
RF_LEVEL_CAL = 110 # Adjustment relating dBm to dBFS
OPUS_DTX = 111 # Opus encoder discontinuous transmission enable/disable
OPUS_APPLICATION = 112 # Opus encoder application voice/audio/etc
OPUS_BANDWIDTH = 113 # Opus encoder audio bandwidth limita
OPUS_FEC = 114 # Opus encoder forward error correction loss rate, %
SPECTRUM_STEP = 115 # size of byte spectrum data level step, dB
SPECTRUM_OVERLAP = 116 # Overlap of FFT windows when averaging (0-1)
LIFETIME = 117 # frames until channel goes away
# Command packet type
CMD = 1
# Encoding types — auto-generated from ka9q-radio/src/rtp.h
class Encoding:
"""Output encoding types — values must match ka9q-radio/src/rtp.h enum encoding"""
NO_ENCODING = 0
S16LE = 1
S16BE = 2
OPUS = 3
F32LE = 4
AX25 = 5
F16LE = 6
OPUS_VOIP = 7 # Opus with APPLICATION_VOIP
F32BE = 8
F16BE = 9
MULAW = 10
ALAW = 11
UNUSED_ENCODING = 12 # Sentinel, not used
# Backward compatibility aliases
F32 = F32LE
F16 = F16LE
# Demodulator types — auto-generated from ka9q-radio (see ENUM_SEARCH_PATHS)
class DemodType:
"""Demodulator types — values must match ka9q-radio enum demod_type (status.h since 2026-09-19)"""
INVALID_DEMOD = -1 # used as sentinel
LINEAR_DEMOD = 0 # Linear demodulation, i.e., everything else: SSB, CW, DSB, CAM, IQ
FM_DEMOD = 1 # Frequency/phase demodulation
WFM_DEMOD = 2 # wideband frequency modulation (broadcast stereo)
SPECT_DEMOD = 3 # Spectrum analysis pseudo-demod
SPECT2_DEMOD = 4 # spectrum v2: 8-bit log bins, low-to-high order
IDLE_DEMOD = 5 # placeholder that just processes commands
N_DEMOD = 6 # Dummy equal to number of valid entries
# Window types — auto-generated from ka9q-radio/src/window.h
class WindowType:
"""FFT window types — values must match ka9q-radio/src/window.h enum window_type"""
INVALID_WINDOW = -1
KAISER_WINDOW = 0
RECT_WINDOW = 1 # essentially kaiser with beta = 0
BLACKMAN_WINDOW = 2
EXACT_BLACKMAN_WINDOW = 3
GAUSSIAN_WINDOW = 4
HANN_WINDOW = 5
HAMMING_WINDOW = 6
BLACKMAN_HARRIS_WINDOW = 7
HP5FT_WINDOW = 8
N_WINDOW = 9