mirror of
https://github.com/AlexandreRouma/SDRPlusPlus.git
synced 2026-04-19 06:42:43 +00:00
changes to the build system
This commit is contained in:
69
spyserver_source/src/spyserver_client.h
Normal file
69
spyserver_source/src/spyserver_client.h
Normal file
@@ -0,0 +1,69 @@
|
||||
#pragma once
|
||||
#include <spyserver_protocol.h>
|
||||
#include <dsp/stream.h>
|
||||
#include <dsp/types.h>
|
||||
#include <thread>
|
||||
#include <string>
|
||||
|
||||
#ifdef _WIN32
|
||||
#include <WinSock2.h>
|
||||
#include <WS2tcpip.h>
|
||||
#else
|
||||
#include <unistd.h>
|
||||
#include <strings.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
#include <netinet/in.h>
|
||||
#include <netdb.h>
|
||||
#endif
|
||||
|
||||
#ifdef _WIN32
|
||||
#define __attribute__(x)
|
||||
#pragma pack(push, 1)
|
||||
#endif
|
||||
struct command_t{
|
||||
unsigned char cmd;
|
||||
unsigned int param;
|
||||
}__attribute__((packed));
|
||||
#ifdef _WIN32
|
||||
#pragma pack(pop)
|
||||
#endif
|
||||
|
||||
class SpyServerClient {
|
||||
public:
|
||||
SpyServerClient();
|
||||
|
||||
bool connectToSpyserver(char* host, int port);
|
||||
bool disconnect();
|
||||
|
||||
void start();
|
||||
void stop();
|
||||
|
||||
void setSampleRate(uint32_t setSampleRate);
|
||||
|
||||
void tune(uint32_t freq);
|
||||
|
||||
dsp::stream<dsp::complex_t> iqStream;
|
||||
|
||||
private:
|
||||
int receive(char* buf, int count);
|
||||
int receiveSync(char* buf, int count);
|
||||
int checkError(int err, int expected);
|
||||
void worker();
|
||||
|
||||
void sendCommand(uint32_t cmd, void* body, size_t bodySize);
|
||||
void setSetting(uint32_t setting, uint32_t value);
|
||||
|
||||
void hello();
|
||||
|
||||
#ifdef _WIN32
|
||||
SOCKET sock;
|
||||
#else
|
||||
int sockfd;
|
||||
#endif
|
||||
bool connected = false;
|
||||
bool waiting = false;
|
||||
|
||||
std::thread workerThread;
|
||||
|
||||
};
|
||||
Reference in New Issue
Block a user