-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathRTLTCPClient.h
More file actions
45 lines (33 loc) · 1.1 KB
/
RTLTCPClient.h
File metadata and controls
45 lines (33 loc) · 1.1 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
/*
* RTLTCPClient.h - TCP client for rtl_tcp server - connect to server
* and stream I/Q data to standard output. On connect,
* the client will send frequency and sample rate to
* the server.
*
* Copyright (C) 2019
* Mark Broihier
*
*/
/* ---------------------------------------------------------------------- */
#include <netinet/in.h>
#include <sys/socket.h>
#include <sys/types.h>
/* ---------------------------------------------------------------------- */
class RTLTCPClient {
private:
int readSignal();
int writeSignalPipe();
struct sockaddr_in RTLServerSocketAddr, mySocketAddr;
int mySocket;
int myConnection;
union RTLCommand {
unsigned char bytes[5];
unsigned char cmd;
};
RTLCommand commandPacket;
void doWork(const char * address, int port, int frequency, int sampleRate, int mode, int gain);
public:
RTLTCPClient(const char * address, int port);
RTLTCPClient(const char * address, int port, int frequency, int sampleRate, int mode, int gain);
~RTLTCPClient(void);
};