forked from old-dab/rtlsdr
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathprotocol_rtl_tcp.txt
More file actions
71 lines (49 loc) · 2.48 KB
/
protocol_rtl_tcp.txt
File metadata and controls
71 lines (49 loc) · 2.48 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
The command protocol of rtl_tcp is on port 1234 (by default):
=============================================================
Commands are directed from a client application towards rtl_tcp.
Each command consists of 2 fields:
1- command_id: value of enum RTL_TCP_COMMANDS, defined in rtl_tcp.h.
This element is an unsigned character, starting at offset 0
with length: 1 byte.
2- parameter: depends on the command id,
e.g. is a frequency for SET_FREQUENCY.
This element is a (signed or unsigned) 32 bit integer,
starting at offset 1 with length: 4 bytes.
Both fields are in Network Byte Order (Big Endian).
Size of one command is 5 bytes, without padding.
Reverse direction on command connection:
========================================
With accepting a connection, rtl_tcp initially transmits some dongle_info.
The dongle_info consists of 3 fields:
1- magic string: identifies the rtl_tcp protocol. The value is "RTL0".
This element is a fixed size string, starting at offset 0
with length 4 bytes.
2- tuner type: identifies the tuner chip built in the controlled RTL-SDR model,
e.g. E4000 or R820T.
This element is an unsigned 32 bit integer, starting at offset 4
with length: 4 bytes.
3- tuner gain count: reports the number of available gain values,
necessary for the command SET_TUNER_GAIN_BY_INDEX.
This element is an unsigned 32 bit integer, starting at offset 8
with length: 4 bytes.
Both fields are in Network Byte Order (Big Endian).
Size of one dongle_info is 12 bytes, without padding.
After that initial dongle_info, from offset 12 byte, just raw I/Q data is transferred.
For each I/Q frame, in the commanded samplerate, I and Q values are transferred,
each as unsigned 8 bit sample. Thus one I/Q-frame is 2 bytes, each frame 1 byte.
Response channel:
=================
The command channel does not allow specific response on commands.
This is why an additional response channel got necessary.
rtl_tcp now offers an additional tcp server "response" channel,
by default, on the next port as the command protocol.
Thus, by default on port 1235.
The first two bytes of the response contain the complete length of the buffer sent.
This is followed by any number of messages with the following structure:
- 1 byte indication: The counterpart to the command, it shows what is being reported
- 2 byte length of the indication payload.
- n byte indication payload
All fields are in Network Byte Order (Big Endian).
Indications:
0x00 = gain indication.
0x48 = report i2c registers