This repository has been archived by the owner on Jun 30, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 9
/
status.h
97 lines (79 loc) · 2.25 KB
/
status.h
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
#ifndef _STATUS_H
#define _STATUS_H 1
#include <stdint.h>
enum status_type {
EOL = 0,
GPS_TIME, // Nanoseconds since GPS epoch (remember to update the leap second tables!)
COMMANDS, // Count of input commands
INPUT_SOURCE_SOCKET,
INPUT_DEST_SOCKET,
INPUT_SSRC,
INPUT_SAMPRATE, // Nominal sample rate (integer)
INPUT_PACKETS,
INPUT_SAMPLES,
INPUT_DROPS,
INPUT_DUPES,
OUTPUT_DEST_SOCKET,
OUTPUT_SSRC,
OUTPUT_TTL,
OUTPUT_SAMPRATE,
OUTPUT_PACKETS,
// Tuning
RADIO_FREQUENCY,
FIRST_LO_FREQUENCY,
SECOND_LO_FREQUENCY,
SHIFT_FREQUENCY,
DOPPLER_FREQUENCY,
DOPPLER_FREQUENCY_RATE,
// Hardware
CALIBRATE,
LNA_GAIN,
MIXER_GAIN,
IF_GAIN,
DC_I_OFFSET,
DC_Q_OFFSET,
IQ_IMBALANCE,
IQ_PHASE,
// Filtering
LOW_EDGE,
HIGH_EDGE,
KAISER_BETA,
FILTER_BLOCKSIZE,
FILTER_FIR_LENGTH,
NOISE_BANDWIDTH,
// Signals
IF_POWER,
BASEBAND_POWER,
NOISE_DENSITY,
// Demodulation
RADIO_MODE, // printable string "usb", "lsb", etc
DEMOD_MODE, // 0 = linear (default), 1 = AM envelope, 2 = FM
INDEPENDENT_SIDEBAND, // Linear only
DEMOD_SNR, // FM, PLL linear
DEMOD_GAIN, // AM, Linear
FREQ_OFFSET, // FM, PLL linear
PEAK_DEVIATION, // FM only
PL_TONE, // FM only
PLL_LOCK, // Linear PLL
PLL_SQUARE, // Linear PLL
PLL_PHASE, // Linear PLL
OUTPUT_CHANNELS, // 1 or 2 in Linear, otherwise 1
};
// Previous transmitted state, used to detect changes
struct state {
int length;
unsigned char value[256];
};
int encode_string(unsigned char **bp,enum status_type type,void *buf,int buflen);
int encode_eol(unsigned char **buf);
int encode_byte(unsigned char **buf,enum status_type type,unsigned char x);
int encode_int16(unsigned char **buf,enum status_type type,uint16_t x);
int encode_int32(unsigned char **buf,enum status_type type,uint32_t x);
int encode_int64(unsigned char **buf,enum status_type type,uint64_t x);
int encode_float(unsigned char **buf,enum status_type type,float x);
int encode_double(unsigned char **buf,enum status_type type,double x);
int compact_packet(struct state *s,unsigned char *pkt,int force);
uint64_t decode_int(unsigned char *,int);
float decode_float(unsigned char *,int);
double decode_double(unsigned char *,int);
#endif