Formatted the entire codebase and added a CI check for formatting

This commit is contained in:
AlexandreRouma
2021-12-19 22:11:44 +01:00
parent 8644957881
commit ea587db0cb
161 changed files with 3302 additions and 3393 deletions

View File

@ -12,7 +12,7 @@
#define CONCAT(a, b) ((std::string(a) + b).c_str())
SDRPP_MOD_INFO {
SDRPP_MOD_INFO{
/* Name: */ "airspy_source",
/* Description: */ "Airspy source module for SDR++",
/* Author: */ "Ryzerth",
@ -33,7 +33,7 @@ public:
handler.ctx = this;
handler.selectHandler = menuSelected;
handler.deselectHandler = menuDeselected;
handler.deselectHandler = menuDeselected;
handler.menuHandler = menuHandler;
handler.startHandler = start;
handler.stopHandler = stop;
@ -236,7 +236,7 @@ private:
AirspySourceModule* _this = (AirspySourceModule*)ctx;
spdlog::info("AirspySourceModule '{0}': Menu Deselect!", _this->name);
}
static void start(void* ctx) {
AirspySourceModule* _this = (AirspySourceModule*)ctx;
if (_this->running) { return; }
@ -255,7 +255,7 @@ private:
airspy_set_samplerate(_this->openDev, _this->sampleRateList[_this->srId]);
airspy_set_freq(_this->openDev, _this->freq);
if (_this->gainMode == 0) {
airspy_set_lna_agc(_this->openDev, 0);
airspy_set_mixer_agc(_this->openDev, 0);
@ -291,7 +291,7 @@ private:
_this->running = true;
spdlog::info("AirspySourceModule '{0}': Start!", _this->name);
}
static void stop(void* ctx) {
AirspySourceModule* _this = (AirspySourceModule*)ctx;
if (!_this->running) { return; }
@ -301,7 +301,7 @@ private:
_this->stream.clearWriteStop();
spdlog::info("AirspySourceModule '{0}': Stop!", _this->name);
}
static void tune(double freq, void* ctx) {
AirspySourceModule* _this = (AirspySourceModule*)ctx;
if (_this->running) {
@ -310,7 +310,7 @@ private:
_this->freq = freq;
spdlog::info("AirspySourceModule '{0}': Tune: {1}!", _this->name, freq);
}
static void menuHandler(void* ctx) {
AirspySourceModule* _this = (AirspySourceModule*)ctx;
float menuWidth = ImGui::GetContentRegionAvailWidth();
@ -536,8 +536,6 @@ private:
config.release(true);
}
}
}
static int callback(airspy_transfer_t* transfer) {

View File

@ -12,7 +12,7 @@
#define CONCAT(a, b) ((std::string(a) + b).c_str())
SDRPP_MOD_INFO {
SDRPP_MOD_INFO{
/* Name: */ "airspyhf_source",
/* Description: */ "Airspy HF+ source module for SDR++",
/* Author: */ "Ryzerth",
@ -127,7 +127,7 @@ public:
sprintf(buf, "%016" PRIX64, selectedSerial);
spdlog::error("Could not open Airspy HF+ {0}", buf);
}
selectedSerial = serial;
uint32_t sampleRates[256];
@ -212,7 +212,7 @@ private:
AirspyHFSourceModule* _this = (AirspyHFSourceModule*)ctx;
spdlog::info("AirspyHFSourceModule '{0}': Menu Deselect!", _this->name);
}
static void start(void* ctx) {
AirspyHFSourceModule* _this = (AirspyHFSourceModule*)ctx;
if (_this->running) { return; }
@ -243,7 +243,7 @@ private:
_this->running = true;
spdlog::info("AirspyHFSourceModule '{0}': Start!", _this->name);
}
static void stop(void* ctx) {
AirspyHFSourceModule* _this = (AirspyHFSourceModule*)ctx;
if (!_this->running) { return; }
@ -253,7 +253,7 @@ private:
_this->stream.clearWriteStop();
spdlog::info("AirspyHFSourceModule '{0}': Stop!", _this->name);
}
static void tune(double freq, void* ctx) {
AirspyHFSourceModule* _this = (AirspyHFSourceModule*)ctx;
if (_this->running) {
@ -262,7 +262,7 @@ private:
_this->freq = freq;
spdlog::info("AirspyHFSourceModule '{0}': Tune: {1}!", _this->name, freq);
}
static void menuHandler(void* ctx) {
AirspyHFSourceModule* _this = (AirspyHFSourceModule*)ctx;
float menuWidth = ImGui::GetContentRegionAvailWidth();
@ -330,18 +330,18 @@ private:
config.conf["devices"][_this->selectedSerStr]["attenuation"] = _this->atten;
config.release(true);
}
}
}
if (ImGui::Checkbox(CONCAT("HF LNA##_airspyhf_lna_", _this->name), &_this->hfLNA)) {
if (_this->running) {
airspyhf_set_hf_lna(_this->openDev, _this->hfLNA);
}
}
if (_this->selectedSerStr != "") {
config.acquire();
config.conf["devices"][_this->selectedSerStr]["lna"] = _this->hfLNA;
config.release(true);
}
}
}
}
static int callback(airspyhf_transfer_t* transfer) {

View File

@ -14,10 +14,10 @@
#define CONCAT(a, b) ((std::string(a) + b).c_str())
#define NUM_BUFFERS 128
#define NUM_TRANSFERS 1
#define NUM_BUFFERS 128
#define NUM_TRANSFERS 1
SDRPP_MOD_INFO {
SDRPP_MOD_INFO{
/* Name: */ "bladerf_source",
/* Description: */ "BladeRF source module for SDR++",
/* Author: */ "Ryzerth",
@ -100,11 +100,13 @@ public:
void selectFirst() {
if (devCount > 0) { selectByInfo(&devInfoList[0]); }
else { selectedSerial = ""; }
else {
selectedSerial = "";
}
}
void selectBySerial(std::string serial, bool reloadChannelId = true) {
if (serial == "") {
if (serial == "") {
selectFirst();
return;
}
@ -134,10 +136,10 @@ public:
// Get the board type
const char* bname = bladerf_get_board_name(openDev);
if (!strcmp(bname ,"bladerf1")) {
if (!strcmp(bname, "bladerf1")) {
selectedBladeType = BLADERF_TYPE_V1;
}
else if (!strcmp(bname ,"bladerf2")) {
else if (!strcmp(bname, "bladerf2")) {
selectedBladeType = BLADERF_TYPE_V2;
}
else {
@ -154,9 +156,13 @@ public:
if (config.conf["devices"][info->serial].contains("channelId")) {
chanId = config.conf["devices"][info->serial]["channelId"];
}
else { chanId = 0; }
else {
chanId = 0;
}
}
else {
chanId = 0;
}
else { chanId = 0; }
config.release();
}
@ -203,7 +209,7 @@ public:
channelNamesTxt = "";
char buf[32];
for (int i = 0; i < channelCount; i++) {
sprintf(buf, "RX %d", i+1);
sprintf(buf, "RX %d", i + 1);
channelNamesTxt += buf;
channelNamesTxt += '\0';
}
@ -338,7 +344,7 @@ private:
BladeRFSourceModule* _this = (BladeRFSourceModule*)ctx;
spdlog::info("BladeRFSourceModule '{0}': Menu Deselect!", _this->name);
}
static void start(void* ctx) {
BladeRFSourceModule* _this = (BladeRFSourceModule*)ctx;
if (_this->running) { return; }
@ -361,8 +367,7 @@ private:
// Setup device parameters
bladerf_set_sample_rate(_this->openDev, BLADERF_CHANNEL_RX(_this->chanId), _this->sampleRate, NULL);
bladerf_set_frequency(_this->openDev, BLADERF_CHANNEL_RX(_this->chanId), _this->freq);
bladerf_set_bandwidth(_this->openDev, BLADERF_CHANNEL_RX(_this->chanId), (_this->bwId == _this->bandwidths.size()) ?
std::clamp<uint64_t>(_this->sampleRate, _this->bwRange->min, _this->bwRange->max) : _this->bandwidths[_this->bwId], NULL);
bladerf_set_bandwidth(_this->openDev, BLADERF_CHANNEL_RX(_this->chanId), (_this->bwId == _this->bandwidths.size()) ? std::clamp<uint64_t>(_this->sampleRate, _this->bwRange->min, _this->bwRange->max) : _this->bandwidths[_this->bwId], NULL);
bladerf_set_gain_mode(_this->openDev, BLADERF_CHANNEL_RX(_this->chanId), _this->gainModes[_this->gainMode].mode);
if (_this->selectedBladeType == BLADERF_TYPE_V2) {
@ -373,7 +378,7 @@ private:
if (_this->gainModes[_this->gainMode].mode == BLADERF_GAIN_MANUAL) {
bladerf_set_gain(_this->openDev, BLADERF_CHANNEL_RX(_this->chanId), _this->overallGain);
}
_this->streamingEnabled = true;
// Setup synchronous transfer
@ -387,7 +392,7 @@ private:
spdlog::info("BladeRFSourceModule '{0}': Start!", _this->name);
}
static void stop(void* ctx) {
BladeRFSourceModule* _this = (BladeRFSourceModule*)ctx;
if (!_this->running) { return; }
@ -399,7 +404,7 @@ private:
if (_this->workerThread.joinable()) {
_this->workerThread.join();
}
// Disable streaming
bladerf_enable_module(_this->openDev, BLADERF_CHANNEL_RX(_this->chanId), false);
@ -409,7 +414,7 @@ private:
_this->stream.clearWriteStop();
spdlog::info("BladeRFSourceModule '{0}': Stop!", _this->name);
}
static void tune(double freq, void* ctx) {
BladeRFSourceModule* _this = (BladeRFSourceModule*)ctx;
_this->freq = freq;
@ -418,7 +423,7 @@ private:
}
spdlog::info("BladeRFSourceModule '{0}': Tune: {1}!", _this->name, freq);
}
static void menuHandler(void* ctx) {
BladeRFSourceModule* _this = (BladeRFSourceModule*)ctx;
float menuWidth = ImGui::GetContentRegionAvailWidth();
@ -472,8 +477,7 @@ private:
ImGui::SetNextItemWidth(menuWidth - ImGui::GetCursorPosX());
if (ImGui::Combo(CONCAT("##_balderf_bw_sel_", _this->name), &_this->bwId, _this->bandwidthsTxt.c_str())) {
if (_this->running) {
bladerf_set_bandwidth(_this->openDev, BLADERF_CHANNEL_RX(_this->chanId), (_this->bwId == _this->bandwidths.size()) ?
std::clamp<uint64_t>(_this->sampleRate, _this->bwRange->min, _this->bwRange->max) : _this->bandwidths[_this->bwId], NULL);
bladerf_set_bandwidth(_this->openDev, BLADERF_CHANNEL_RX(_this->chanId), (_this->bwId == _this->bandwidths.size()) ? std::clamp<uint64_t>(_this->sampleRate, _this->bwRange->min, _this->bwRange->max) : _this->bandwidths[_this->bwId], NULL);
}
if (_this->selectedSerial != "") {
config.acquire();
@ -500,7 +504,9 @@ private:
}
}
if (_this->selectedSerial != "") { if (_this->gainModes[_this->gainMode].mode != BLADERF_GAIN_MANUAL) { style::beginDisabled(); } }
if (_this->selectedSerial != "") {
if (_this->gainModes[_this->gainMode].mode != BLADERF_GAIN_MANUAL) { style::beginDisabled(); }
}
ImGui::LeftLabel("Gain");
ImGui::SetNextItemWidth(menuWidth - ImGui::GetCursorPosX());
if (ImGui::SliderInt("##_balderf_oag_sel_", &_this->overallGain, (_this->gainRange != NULL) ? _this->gainRange->min : 0, (_this->gainRange != NULL) ? _this->gainRange->max : 60)) {
@ -514,7 +520,9 @@ private:
config.release(true);
}
}
if (_this->selectedSerial != "") { if (_this->gainModes[_this->gainMode].mode != BLADERF_GAIN_MANUAL) { style::endDisabled(); } }
if (_this->selectedSerial != "") {
if (_this->gainModes[_this->gainMode].mode != BLADERF_GAIN_MANUAL) { style::endDisabled(); }
}
if (_this->selectedBladeType == BLADERF_TYPE_V2) {
if (ImGui::Checkbox("Bias-T##_balderf_biast_", &_this->biasT)) {
@ -526,13 +534,12 @@ private:
config.release(true);
}
}
}
void worker() {
int16_t* buffer = new int16_t[bufferSize * 2];
bladerf_metadata meta;
while (streamingEnabled) {
// Receive from the stream and break on error
int ret = bladerf_sync_rx(openDev, buffer, bufferSize, &meta, 3500);

View File

@ -13,7 +13,7 @@
#define CONCAT(a, b) ((std::string(a) + b).c_str())
SDRPP_MOD_INFO {
SDRPP_MOD_INFO{
/* Name: */ "file_source",
/* Description: */ "Wav file source module for SDR++",
/* Author: */ "Ryzerth",
@ -23,9 +23,9 @@ SDRPP_MOD_INFO {
ConfigManager config;
class FileSourceModule : public ModuleManager::Instance {
class FileSourceModule : public ModuleManager::Instance {
public:
FileSourceModule(std::string name) : fileSelect("", {"Wav IQ Files (*.wav)", "*.wav", "All Files", "*"}) {
FileSourceModule(std::string name) : fileSelect("", { "Wav IQ Files (*.wav)", "*.wav", "All Files", "*" }) {
this->name = name;
config.acquire();
@ -82,7 +82,7 @@ private:
gui::waterfall.centerFrequencyLocked = false;
spdlog::info("FileSourceModule '{0}': Menu Deselect!", _this->name);
}
static void start(void* ctx) {
FileSourceModule* _this = (FileSourceModule*)ctx;
if (_this->running) { return; }
@ -91,7 +91,7 @@ private:
_this->workerThread = _this->float32Mode ? std::thread(floatWorker, _this) : std::thread(worker, _this);
spdlog::info("FileSourceModule '{0}': Start!", _this->name);
}
static void stop(void* ctx) {
FileSourceModule* _this = (FileSourceModule*)ctx;
if (!_this->running) { return; }
@ -103,12 +103,12 @@ private:
_this->reader->rewind();
spdlog::info("FileSourceModule '{0}': Stop!", _this->name);
}
static void tune(double freq, void* ctx) {
FileSourceModule* _this = (FileSourceModule*)ctx;
spdlog::info("FileSourceModule '{0}': Tune: {1}!", _this->name, freq);
}
static void menuHandler(void* ctx) {
FileSourceModule* _this = (FileSourceModule*)ctx;

View File

@ -53,25 +53,25 @@ public:
void rewind() {
file.seekg(sizeof(WavHeader_t));
}
void close() {
file.close();
}
private:
struct WavHeader_t {
char signature[4]; // "RIFF"
uint32_t fileSize; // data bytes + sizeof(WavHeader_t) - 8
char fileType[4]; // "WAVE"
char formatMarker[4]; // "fmt "
uint32_t formatHeaderLength; // Always 16
uint16_t sampleType; // PCM (1)
char signature[4]; // "RIFF"
uint32_t fileSize; // data bytes + sizeof(WavHeader_t) - 8
char fileType[4]; // "WAVE"
char formatMarker[4]; // "fmt "
uint32_t formatHeaderLength; // Always 16
uint16_t sampleType; // PCM (1)
uint16_t channelCount;
uint32_t sampleRate;
uint32_t bytesPerSecond;
uint16_t bytesPerSample;
uint16_t bitDepth;
char dataMarker[4]; // "data"
char dataMarker[4]; // "data"
uint32_t dataSize;
};

View File

@ -12,7 +12,7 @@
#define CONCAT(a, b) ((std::string(a) + b).c_str())
SDRPP_MOD_INFO {
SDRPP_MOD_INFO{
/* Name: */ "hackrf_source",
/* Description: */ "HackRF source module for SDR++",
/* Author: */ "Ryzerth",
@ -38,21 +38,21 @@ const int sampleRates[] = {
const int bandwidths[] = {
1750000,
2500000,
3500000,
5000000,
5500000,
6000000,
7000000,
8000000,
9000000,
10000000,
12000000,
14000000,
15000000,
20000000,
24000000,
28000000,
2500000,
3500000,
5000000,
5500000,
6000000,
7000000,
8000000,
9000000,
10000000,
12000000,
14000000,
15000000,
20000000,
24000000,
28000000,
};
const char* bandwidthsTxt = "1.75MHz\0"
@ -220,7 +220,7 @@ private:
if (id == 16) { return hackrf_compute_baseband_filter_bw(sampleRate); }
return bandwidths[id];
}
static void start(void* ctx) {
HackRFSourceModule* _this = (HackRFSourceModule*)ctx;
if (_this->running) { return; }
@ -249,7 +249,7 @@ private:
_this->running = true;
spdlog::info("HackRFSourceModule '{0}': Start!", _this->name);
}
static void stop(void* ctx) {
HackRFSourceModule* _this = (HackRFSourceModule*)ctx;
if (!_this->running) { return; }
@ -263,7 +263,7 @@ private:
_this->stream.clearWriteStop();
spdlog::info("HackRFSourceModule '{0}': Stop!", _this->name);
}
static void tune(double freq, void* ctx) {
HackRFSourceModule* _this = (HackRFSourceModule*)ctx;
if (_this->running) {
@ -272,7 +272,7 @@ private:
_this->freq = freq;
spdlog::info("HackRFSourceModule '{0}': Tune: {1}!", _this->name, freq);
}
static void menuHandler(void* ctx) {
HackRFSourceModule* _this = (HackRFSourceModule*)ctx;
float menuWidth = ImGui::GetContentRegionAvailWidth();
@ -300,7 +300,7 @@ private:
if (ImGui::Button(CONCAT("Refresh##_hackrf_refr_", _this->name), ImVec2(refreshBtnWdith, 0))) {
_this->refresh();
_this->selectBySerial(_this->selectedSerial);
core::setInputSampleRate(_this->sampleRate);
core::setInputSampleRate(_this->sampleRate);
}
if (_this->running) { style::endDisabled(); }
@ -336,7 +336,7 @@ private:
config.acquire();
config.conf["devices"][_this->selectedSerial]["vgaGain"] = (int)_this->vga;
config.release(true);
}
}
if (ImGui::Checkbox(CONCAT("Bias-T##_hackrf_bt_", _this->name), &_this->biasT)) {
if (_this->running) {
@ -354,14 +354,14 @@ private:
config.acquire();
config.conf["devices"][_this->selectedSerial]["amp"] = _this->amp;
config.release(true);
}
}
}
static int callback(hackrf_transfer* transfer) {
HackRFSourceModule* _this = (HackRFSourceModule*)transfer->rx_ctx;
int count = transfer->valid_length / 2;
int8_t* buffer = (int8_t*)transfer->buffer;
volk_8i_s32f_convert_32f((float*)_this->stream.writeBuf, buffer, 128.0f, count*2);
volk_8i_s32f_convert_32f((float*)_this->stream.writeBuf, buffer, 128.0f, count * 2);
if (!_this->stream.swap(count)) { return -1; }
return 0;
}

View File

@ -12,7 +12,7 @@
#define CONCAT(a, b) ((std::string(a) + b).c_str())
SDRPP_MOD_INFO {
SDRPP_MOD_INFO{
/* Name: */ "limesdr_source",
/* Description: */ "LimeSDR source module for SDR++",
/* Author: */ "Ryzerth",
@ -33,7 +33,7 @@ public:
handler.ctx = this;
handler.selectHandler = menuSelected;
handler.deselectHandler = menuDeselected;
handler.deselectHandler = menuDeselected;
handler.menuHandler = menuHandler;
handler.startHandler = start;
handler.stopHandler = stop;
@ -124,7 +124,7 @@ public:
channelCount = LMS_GetNumChannels(dev, false);
char buf[32];
for (int i = 0; i < channelCount; i++) {
sprintf(buf, "CH %d", i+1);
sprintf(buf, "CH %d", i + 1);
channelNamesTxt += buf;
channelNamesTxt += '\0';
}
@ -134,9 +134,13 @@ public:
if (config.conf["devices"][selectedDevName].contains("channel")) {
chanId = config.conf["devices"][selectedDevName]["channel"];
}
else { chanId = 0; }
else {
chanId = 0;
}
}
else {
chanId = 0;
}
else { chanId = 0; }
config.release();
chanId = std::clamp<int>(chanId, 0, channelCount - 1);
@ -299,7 +303,7 @@ private:
return bandwidths[i];
}
}
return bandwidths[bandwidths.size()-1];
return bandwidths[bandwidths.size() - 1];
}
static void menuSelected(void* ctx) {
@ -312,11 +316,11 @@ private:
LimeSDRSourceModule* _this = (LimeSDRSourceModule*)ctx;
spdlog::info("LimeSDRSourceModule '{0}': Menu Deselect!", _this->name);
}
static void start(void* ctx) {
LimeSDRSourceModule* _this = (LimeSDRSourceModule*)ctx;
if (_this->running) { return; }
// Open device
_this->openDev = NULL;
LMS_Open(&_this->openDev, _this->devList[_this->devId], NULL);
@ -350,7 +354,7 @@ private:
_this->running = true;
spdlog::info("LimeSDRSourceModule '{0}': Start!", _this->name);
}
static void stop(void* ctx) {
LimeSDRSourceModule* _this = (LimeSDRSourceModule*)ctx;
if (!_this->running) { return; }
@ -366,7 +370,7 @@ private:
spdlog::info("LimeSDRSourceModule '{0}': Stop!", _this->name);
}
static void tune(double freq, void* ctx) {
LimeSDRSourceModule* _this = (LimeSDRSourceModule*)ctx;
_this->freq = freq;
@ -375,7 +379,7 @@ private:
}
spdlog::info("LimeSDRSourceModule '{0}': Tune: {1}!", _this->name, freq);
}
static void menuHandler(void* ctx) {
LimeSDRSourceModule* _this = (LimeSDRSourceModule*)ctx;
float menuWidth = ImGui::GetContentRegionAvailWidth();

View File

@ -12,7 +12,7 @@
#define CONCAT(a, b) ((std::string(a) + b).c_str())
SDRPP_MOD_INFO {
SDRPP_MOD_INFO{
/* Name: */ "plutosdr_source",
/* Description: */ "PlutoSDR source module for SDR++",
/* Author: */ "Ryzerth",
@ -38,7 +38,7 @@ public:
strcpy(&ip[3], _ip.c_str());
sampleRate = config.conf["sampleRate"];
gainMode = config.conf["gainMode"];
gain = config.conf["gain"];
gain = config.conf["gain"];
config.release();
// Generate the samplerate list and find srId
@ -116,18 +116,18 @@ private:
PlutoSDRSourceModule* _this = (PlutoSDRSourceModule*)ctx;
spdlog::info("PlutoSDRSourceModule '{0}': Menu Deselect!", _this->name);
}
static void start(void* ctx) {
PlutoSDRSourceModule* _this = (PlutoSDRSourceModule*)ctx;
if (_this->running) { return; }
// TODO: INIT CONTEXT HERE
_this->ctx = iio_create_context_from_uri(_this->ip);
if (_this->ctx == NULL) {
spdlog::error("Could not open pluto");
return;
}
_this->phy = iio_context_find_device(_this->ctx, "ad9361-phy");
_this->phy = iio_context_find_device(_this->ctx, "ad9361-phy");
if (_this->phy == NULL) {
spdlog::error("Could not connect to pluto phy");
iio_context_destroy(_this->ctx);
@ -145,17 +145,17 @@ private:
iio_channel_attr_write_bool(iio_device_find_channel(_this->phy, "altvoltage0", true), "powerdown", false);
iio_channel_attr_write(iio_device_find_channel(_this->phy, "voltage0", false), "rf_port_select", "A_BALANCED");
iio_channel_attr_write_longlong(iio_device_find_channel(_this->phy, "altvoltage0", true), "frequency", round(_this->freq)); // Freq
iio_channel_attr_write_longlong(iio_device_find_channel(_this->phy, "voltage0", false), "sampling_frequency", round(_this->sampleRate)); // Sample rate
iio_channel_attr_write(iio_device_find_channel(_this->phy, "voltage0", false), "gain_control_mode", gainModes[_this->gainMode]); // manual gain
iio_channel_attr_write_longlong(iio_device_find_channel(_this->phy, "voltage0", false), "hardwaregain", round(_this->gain)); // gain
iio_channel_attr_write_longlong(iio_device_find_channel(_this->phy, "altvoltage0", true), "frequency", round(_this->freq)); // Freq
iio_channel_attr_write_longlong(iio_device_find_channel(_this->phy, "voltage0", false), "sampling_frequency", round(_this->sampleRate)); // Sample rate
iio_channel_attr_write(iio_device_find_channel(_this->phy, "voltage0", false), "gain_control_mode", gainModes[_this->gainMode]); // manual gain
iio_channel_attr_write_longlong(iio_device_find_channel(_this->phy, "voltage0", false), "hardwaregain", round(_this->gain)); // gain
ad9361_set_bb_rate(_this->phy, round(_this->sampleRate));
_this->running = true;
_this->workerThread = std::thread(worker, _this);
spdlog::info("PlutoSDRSourceModule '{0}': Start!", _this->name);
}
static void stop(void* ctx) {
PlutoSDRSourceModule* _this = (PlutoSDRSourceModule*)ctx;
if (!_this->running) { return; }
@ -172,7 +172,7 @@ private:
spdlog::info("PlutoSDRSourceModule '{0}': Stop!", _this->name);
}
static void tune(double freq, void* ctx) {
PlutoSDRSourceModule* _this = (PlutoSDRSourceModule*)ctx;
_this->freq = freq;
@ -182,7 +182,7 @@ private:
}
spdlog::info("PlutoSDRSourceModule '{0}': Tune: {1}!", _this->name, freq);
}
static void menuHandler(void* ctx) {
PlutoSDRSourceModule* _this = (PlutoSDRSourceModule*)ctx;
float menuWidth = ImGui::GetContentRegionAvailWidth();
@ -195,10 +195,10 @@ private:
config.conf["IP"] = &_this->ip[3];
config.release(true);
}
ImGui::LeftLabel("Samplerate");
ImGui::SetNextItemWidth(menuWidth - ImGui::GetCursorPosX());
if (ImGui::Combo(CONCAT("##_pluto_sr_", _this->name), &_this->srId, _this->sampleRatesTxt.c_str())) {
_this->sampleRate = _this->sampleRates[_this->srId];
core::setInputSampleRate(_this->sampleRate);
@ -224,7 +224,7 @@ private:
if (_this->gainMode) { style::beginDisabled(); }
if (ImGui::SliderFloat(CONCAT("##_gain_select_", _this->name), &_this->gain, 0, 76)) {
if (_this->running) {
iio_channel_attr_write_longlong(iio_device_find_channel(_this->phy, "voltage0", false),"hardwaregain", round(_this->gain));
iio_channel_attr_write_longlong(iio_device_find_channel(_this->phy, "voltage0", false), "hardwaregain", round(_this->gain));
}
config.acquire();
config.conf["gain"] = _this->gain;
@ -238,14 +238,14 @@ private:
int blockSize = _this->sampleRate / 200.0f;
struct iio_channel *rx0_i, *rx0_q;
struct iio_buffer *rxbuf;
struct iio_buffer* rxbuf;
rx0_i = iio_device_find_channel(_this->dev, "voltage0", 0);
rx0_q = iio_device_find_channel(_this->dev, "voltage1", 0);
iio_channel_enable(rx0_i);
iio_channel_enable(rx0_q);
rxbuf = iio_device_create_buffer(_this->dev, blockSize, false);
if (!rxbuf) {
spdlog::error("Could not create RX buffer");
@ -264,7 +264,7 @@ private:
_this->stream.writeBuf[i].im = (float)buf[(i * 2) + 1] / 32768.0f;
}
volk_16i_s32f_convert_32f((float*)_this->stream.writeBuf, buf, 32768.0f, blockSize*2);
volk_16i_s32f_convert_32f((float*)_this->stream.writeBuf, buf, 32768.0f, blockSize * 2);
if (!_this->stream.swap(blockSize)) { break; };
}
@ -278,9 +278,9 @@ private:
float sampleRate;
SourceManager::SourceHandler handler;
std::thread workerThread;
struct iio_context *ctx = NULL;
struct iio_device *phy = NULL;
struct iio_device *dev = NULL;
struct iio_context* ctx = NULL;
struct iio_device* phy = NULL;
struct iio_device* dev = NULL;
bool running = false;
bool ipMode = true;
double freq;

View File

@ -13,7 +13,7 @@
#define CONCAT(a, b) ((std::string(a) + b).c_str())
SDRPP_MOD_INFO {
SDRPP_MOD_INFO{
/* Name: */ "rfspace_source",
/* Description: */ "RFspace source module for SDR++",
/* Author: */ "Ryzerth",
@ -88,7 +88,7 @@ private:
gui::mainWindow.playButtonLocked = false;
spdlog::info("SpyServerSourceModule '{0}': Menu Deselect!", _this->name);
}
static void start(void* ctx) {
SpyServerSourceModule* _this = (SpyServerSourceModule*)ctx;
if (_this->running) { return; }
@ -98,17 +98,17 @@ private:
_this->running = true;
spdlog::info("SpyServerSourceModule '{0}': Start!", _this->name);
}
static void stop(void* ctx) {
SpyServerSourceModule* _this = (SpyServerSourceModule*)ctx;
if (!_this->running) { return; }
// TODO: Stop
_this->running = false;
spdlog::info("SpyServerSourceModule '{0}': Stop!", _this->name);
}
static void tune(double freq, void* ctx) {
SpyServerSourceModule* _this = (SpyServerSourceModule*)ctx;
if (_this->running) {
@ -117,7 +117,7 @@ private:
_this->freq = freq;
spdlog::info("SpyServerSourceModule '{0}': Tune: {1}!", _this->name, freq);
}
static void menuHandler(void* ctx) {
SpyServerSourceModule* _this = (SpyServerSourceModule*)ctx;
float menuWidth = ImGui::GetContentRegionAvailWidth();
@ -154,7 +154,6 @@ private:
}
if (_this->running) { style::endDisabled(); }
if (connected) {
// TODO: Options here

View File

@ -24,7 +24,7 @@ namespace rfspace {
udpClient->readAsync(sizeof(udpHeader), (uint8_t*)&udpHeader, udpHandler, this);
// Start SDR
uint8_t args[4] = {0x70, 2, 0, 0};
uint8_t args[4] = { 0x70, 2, 0, 0 };
setControlItem(0x18, args, 4);
}

View File

@ -4,7 +4,7 @@
#include <dsp/types.h>
#include <atomic>
#define RFSPACE_MAX_SIZE 8192
#define RFSPACE_MAX_SIZE 8192
namespace rfspace {
enum {
@ -40,7 +40,7 @@ namespace rfspace {
// Wait for data
std::unique_lock<std::mutex> lck(mtx);
return cnd.wait_for(lck, std::chrono::milliseconds(timeoutMS), [this](){ return triggered; });
return cnd.wait_for(lck, std::chrono::milliseconds(timeoutMS), [this]() { return triggered; });
// Mark as not waiting
{
@ -75,7 +75,7 @@ namespace rfspace {
// Wait for waiter to handle
{
std::unique_lock<std::mutex> lck(mtx);
cnd.wait(lck, [this](){ return !triggered; });
cnd.wait(lck, [this]() { return !triggered; });
}
}
@ -86,7 +86,6 @@ namespace rfspace {
bool waiting;
std::mutex waitingmtx;
};
class RFspaceClientClass {
@ -122,9 +121,9 @@ namespace rfspace {
SyncEvent SCIRRecv;
int SCIRSize;
};
typedef std::unique_ptr<RFspaceClientClass> RFspaceClient;
RFspaceClient connect(std::string host, uint16_t port, dsp::stream<dsp::complex_t>* out);
}

View File

@ -12,7 +12,7 @@
#define CONCAT(a, b) ((std::string(a) + b).c_str())
SDRPP_MOD_INFO {
SDRPP_MOD_INFO{
/* Name: */ "rtl_sdr_source",
/* Description: */ "RTL-SDR source module for SDR++",
/* Author: */ "Ryzerth",
@ -61,7 +61,7 @@ public:
handler.ctx = this;
handler.selectHandler = menuSelected;
handler.deselectHandler = menuDeselected;
handler.deselectHandler = menuDeselected;
handler.menuHandler = menuHandler;
handler.startHandler = start;
handler.stopHandler = stop;
@ -243,7 +243,7 @@ private:
RTLSDRSourceModule* _this = (RTLSDRSourceModule*)ctx;
spdlog::info("RTLSDRSourceModule '{0}': Menu Deselect!", _this->name);
}
static void start(void* ctx) {
RTLSDRSourceModule* _this = (RTLSDRSourceModule*)ctx;
if (_this->running) { return; }
@ -256,7 +256,7 @@ private:
spdlog::error("Could not open RTL-SDR");
return;
}
spdlog::info("RTL-SDR Sample Rate: {0}", _this->sampleRate);
rtlsdr_set_sample_rate(_this->openDev, _this->sampleRate);
@ -283,7 +283,7 @@ private:
_this->running = true;
spdlog::info("RTLSDRSourceModule '{0}': Start!", _this->name);
}
static void stop(void* ctx) {
RTLSDRSourceModule* _this = (RTLSDRSourceModule*)ctx;
if (!_this->running) { return; }
@ -295,7 +295,7 @@ private:
rtlsdr_close(_this->openDev);
spdlog::info("RTLSDRSourceModule '{0}': Stop!", _this->name);
}
static void tune(double freq, void* ctx) {
RTLSDRSourceModule* _this = (RTLSDRSourceModule*)ctx;
if (_this->running) {
@ -308,12 +308,11 @@ private:
if (i > 1) {
spdlog::warn("RTL-SDR took {0} attempts to tune...", i);
}
}
_this->freq = freq;
spdlog::info("RTLSDRSourceModule '{0}': Tune: {1}!", _this->name, freq);
}
static void menuHandler(void* ctx) {
RTLSDRSourceModule* _this = (RTLSDRSourceModule*)ctx;
float menuWidth = ImGui::GetContentRegionAvailWidth();
@ -462,7 +461,7 @@ private:
rtlsdr_read_async(openDev, asyncHandler, this, 0, asyncCount);
}
static void asyncHandler(unsigned char *buf, uint32_t len, void *ctx) {
static void asyncHandler(unsigned char* buf, uint32_t len, void* ctx) {
RTLSDRSourceModule* _this = (RTLSDRSourceModule*)ctx;
int sampCount = len / 2;
for (int i = 0; i < sampCount; i++) {

View File

@ -10,7 +10,7 @@
#define CONCAT(a, b) ((std::string(a) + b).c_str())
SDRPP_MOD_INFO {
SDRPP_MOD_INFO{
/* Name: */ "rtl_tcp_source",
/* Description: */ "RTL-TCP source module for SDR++",
/* Author: */ "Ryzerth",
@ -48,7 +48,7 @@ const char* sampleRatesTxt[] = {
"3.2MHz"
};
#define SAMPLE_RATE_COUNT (sizeof(sampleRates) / sizeof(double))
#define SAMPLE_RATE_COUNT (sizeof(sampleRates) / sizeof(double))
class RTLTCPSourceModule : public ModuleManager::Instance {
public:
@ -135,7 +135,7 @@ private:
RTLTCPSourceModule* _this = (RTLTCPSourceModule*)ctx;
spdlog::info("RTLTCPSourceModule '{0}': Menu Deselect!", _this->name);
}
static void start(void* ctx) {
RTLTCPSourceModule* _this = (RTLTCPSourceModule*)ctx;
if (_this->running) { return; }
@ -160,12 +160,12 @@ private:
// Setting it twice because for some reason it refuses to do it on the first time
_this->client.setGainIndex(_this->gain);
}
_this->running = true;
_this->workerThread = std::thread(worker, _this);
spdlog::info("RTLTCPSourceModule '{0}': Start!", _this->name);
}
static void stop(void* ctx) {
RTLTCPSourceModule* _this = (RTLTCPSourceModule*)ctx;
if (!_this->running) { return; }
@ -176,7 +176,7 @@ private:
_this->client.disconnect();
spdlog::info("RTLTCPSourceModule '{0}': Stop!", _this->name);
}
static void tune(double freq, void* ctx) {
RTLTCPSourceModule* _this = (RTLTCPSourceModule*)ctx;
if (_this->running) {
@ -185,7 +185,7 @@ private:
_this->freq = freq;
spdlog::info("RTLTCPSourceModule '{0}': Tune: {1}!", _this->name, freq);
}
static void menuHandler(void* ctx) {
RTLTCPSourceModule* _this = (RTLTCPSourceModule*)ctx;
float menuWidth = ImGui::GetContentRegionAvailWidth();
@ -338,20 +338,20 @@ private:
};
MOD_EXPORT void _INIT_() {
config.setPath(options::opts.root + "/rtl_tcp_config.json");
json defConf;
defConf["host"] = "localhost";
defConf["port"] = 1234;
defConf["sampleRate"] = 2400000.0;
defConf["directSamplingMode"] = 0;
defConf["ppm"] = 0;
defConf["rtlAGC"] = false;
defConf["tunerAGC"] = false;
defConf["gainIndex"] = 0;
defConf["biasTee"] = false;
defConf["offsetTuning"] = false;
config.load(defConf);
config.enableAutoSave();
config.setPath(options::opts.root + "/rtl_tcp_config.json");
json defConf;
defConf["host"] = "localhost";
defConf["port"] = 1234;
defConf["sampleRate"] = 2400000.0;
defConf["directSamplingMode"] = 0;
defConf["ppm"] = 0;
defConf["rtlAGC"] = false;
defConf["tunerAGC"] = false;
defConf["gainIndex"] = 0;
defConf["biasTee"] = false;
defConf["offsetTuning"] = false;
config.load(defConf);
config.enableAutoSave();
config.acquire();
if (!config.conf.contains("biasTee")) {

View File

@ -12,17 +12,17 @@
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <netdb.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));
struct command_t {
unsigned char cmd;
unsigned int param;
} __attribute__((packed));
#ifdef _WIN32
#pragma pack(pop)
#endif
@ -30,7 +30,6 @@ struct command_t{
class RTLTCPClient {
public:
RTLTCPClient() {
}
bool connectToRTL(char* host, uint16_t port) {
@ -39,14 +38,14 @@ public:
}
#ifdef _WIN32
struct addrinfo *result = NULL;
struct addrinfo *ptr = NULL;
struct addrinfo* result = NULL;
struct addrinfo* ptr = NULL;
struct addrinfo hints;
WSADATA wsaData;
WSAStartup(MAKEWORD(2,2), &wsaData);
WSAStartup(MAKEWORD(2, 2), &wsaData);
ZeroMemory( &hints, sizeof(hints) );
ZeroMemory(&hints, sizeof(hints));
hints.ai_family = AF_UNSPEC;
hints.ai_socktype = SOCK_STREAM;
hints.ai_protocol = IPPROTO_TCP;
@ -88,13 +87,13 @@ public:
// TODO: Log error
return false;
}
struct hostent *server = gethostbyname(host);
struct hostent* server = gethostbyname(host);
struct sockaddr_in serv_addr;
bzero(&serv_addr, sizeof(struct sockaddr_in));
serv_addr.sin_family = AF_INET;
bcopy((char *)server->h_addr, (char *)&serv_addr.sin_addr.s_addr, server->h_length);
bcopy((char*)server->h_addr, (char*)&serv_addr.sin_addr.s_addr, server->h_length);
serv_addr.sin_port = htons(port);
if (connect(sockfd,(struct sockaddr *)&serv_addr,sizeof(serv_addr)) < 0) {
if (connect(sockfd, (struct sockaddr*)&serv_addr, sizeof(serv_addr)) < 0) {
// TODO: log error
return false;
}
@ -130,7 +129,7 @@ public:
cmd.cmd = command;
cmd.param = htonl(param);
#ifdef _WIN32
send(sock, (char*)&cmd, sizeof(command_t), 0);
send(sock, (char*)&cmd, sizeof(command_t), 0);
#else
(void)write(sockfd, &cmd, sizeof(command_t));
#endif
@ -196,7 +195,6 @@ private:
#else
int sockfd;
#endif
bool connected = false;
bool connected = false;
};

View File

@ -12,7 +12,7 @@
#define CONCAT(a, b) ((std::string(a) + b).c_str())
SDRPP_MOD_INFO {
SDRPP_MOD_INFO{
/* Name: */ "sddc_source",
/* Description: */ "SDDC source module for SDR++",
/* Author: */ "Ryzerth;pkuznetsov",
@ -142,7 +142,7 @@ private:
AirspyHFSourceModule* _this = (AirspyHFSourceModule*)ctx;
spdlog::info("AirspyHFSourceModule '{0}': Menu Deselect!", _this->name);
}
static void start(void* ctx) {
AirspyHFSourceModule* _this = (AirspyHFSourceModule*)ctx;
if (_this->running) { return; }
@ -153,19 +153,19 @@ private:
_this->running = true;
spdlog::info("AirspyHFSourceModule '{0}': Start!", _this->name);
}
static void stop(void* ctx) {
AirspyHFSourceModule* _this = (AirspyHFSourceModule*)ctx;
if (!_this->running) { return; }
_this->running = false;
_this->stream.stopWriter();
// Stop device
_this->stream.clearWriteStop();
spdlog::info("AirspyHFSourceModule '{0}': Stop!", _this->name);
}
static void tune(double freq, void* ctx) {
AirspyHFSourceModule* _this = (AirspyHFSourceModule*)ctx;
if (_this->running) {
@ -174,7 +174,7 @@ private:
_this->freq = freq;
spdlog::info("AirspyHFSourceModule '{0}': Tune: {1}!", _this->name, freq);
}
static void menuHandler(void* ctx) {
AirspyHFSourceModule* _this = (AirspyHFSourceModule*)ctx;
float menuWidth = ImGui::GetContentRegionAvailWidth();
@ -202,7 +202,6 @@ private:
if (_this->running) { style::endDisabled(); }
// All other controls
}
std::string name;

View File

@ -12,7 +12,7 @@
#define CONCAT(a, b) ((std::string(a) + b).c_str())
SDRPP_MOD_INFO {
SDRPP_MOD_INFO{
/* Name: */ "sdrplay_source",
/* Description: */ "SDRplay source module for SDR++",
/* Author: */ "Ryzerth",
@ -103,13 +103,13 @@ struct ifMode_t {
};
ifMode_t ifModes[] = {
{ sdrplay_api_IF_Zero, sdrplay_api_BW_1_536, 2000000, 2000000},
{ sdrplay_api_IF_2_048, sdrplay_api_BW_1_536, 8000000, 2000000},
{ sdrplay_api_IF_2_048, sdrplay_api_BW_5_000, 8000000, 2000000},
{ sdrplay_api_IF_1_620, sdrplay_api_BW_1_536, 6000000, 2000000},
{ sdrplay_api_IF_0_450, sdrplay_api_BW_0_600, 2000000, 1000000},
{ sdrplay_api_IF_0_450, sdrplay_api_BW_0_300, 2000000, 500000},
{ sdrplay_api_IF_0_450, sdrplay_api_BW_0_200, 2000000, 500000},
{ sdrplay_api_IF_Zero, sdrplay_api_BW_1_536, 2000000, 2000000 },
{ sdrplay_api_IF_2_048, sdrplay_api_BW_1_536, 8000000, 2000000 },
{ sdrplay_api_IF_2_048, sdrplay_api_BW_5_000, 8000000, 2000000 },
{ sdrplay_api_IF_1_620, sdrplay_api_BW_1_536, 6000000, 2000000 },
{ sdrplay_api_IF_0_450, sdrplay_api_BW_0_600, 2000000, 1000000 },
{ sdrplay_api_IF_0_450, sdrplay_api_BW_0_300, 2000000, 500000 },
{ sdrplay_api_IF_0_450, sdrplay_api_BW_0_200, 2000000, 500000 },
};
const char* ifModeTxt =
@ -147,7 +147,7 @@ public:
handler.ctx = this;
handler.selectHandler = menuSelected;
handler.deselectHandler = menuDeselected;
handler.deselectHandler = menuDeselected;
handler.menuHandler = menuHandler;
handler.startHandler = start;
handler.stopHandler = stop;
@ -210,24 +210,36 @@ public:
devList.push_back(devArr[i]);
std::string name = "";
switch (devArr[i].hwVer) {
case SDRPLAY_RSP1_ID:
name = "RSP1 ("; name += devArr[i].SerNo; name += ')';
break;
case SDRPLAY_RSP1A_ID:
name = "RSP1A ("; name += devArr[i].SerNo; name += ')';
break;
case SDRPLAY_RSP2_ID:
name = "RSP2 ("; name += devArr[i].SerNo; name += ')';
break;
case SDRPLAY_RSPduo_ID:
name = "RSPduo ("; name += devArr[i].SerNo; name += ')';
break;
case SDRPLAY_RSPdx_ID:
name = "RSPdx ("; name += devArr[i].SerNo; name += ')';
break;
default:
name = "Unknown ("; name += devArr[i].SerNo; name += ')';
break;
case SDRPLAY_RSP1_ID:
name = "RSP1 (";
name += devArr[i].SerNo;
name += ')';
break;
case SDRPLAY_RSP1A_ID:
name = "RSP1A (";
name += devArr[i].SerNo;
name += ')';
break;
case SDRPLAY_RSP2_ID:
name = "RSP2 (";
name += devArr[i].SerNo;
name += ')';
break;
case SDRPLAY_RSPduo_ID:
name = "RSPduo (";
name += devArr[i].SerNo;
name += ')';
break;
case SDRPLAY_RSPdx_ID:
name = "RSPdx (";
name += devArr[i].SerNo;
name += ')';
break;
default:
name = "Unknown (";
name += devArr[i].SerNo;
name += ')';
break;
}
devNameList.push_back(name);
devListTxt += name;
@ -372,9 +384,9 @@ public:
}
}
if(config.conf["devices"][selectedName].contains("ifModeId")) {
ifModeId=config.conf["devices"][selectedName]["ifModeId"];
if(ifModeId != 0){
if (config.conf["devices"][selectedName].contains("ifModeId")) {
ifModeId = config.conf["devices"][selectedName]["ifModeId"];
if (ifModeId != 0) {
sampleRate = ifModes[ifModeId].effectiveSamplerate;
}
}
@ -473,14 +485,14 @@ public:
}
config.release(created);
if (lnaGain >= lnaSteps) { lnaGain = lnaSteps - 1; }
// Release device after selecting
sdrplay_api_Uninit(openDev.dev);
sdrplay_api_ReleaseDevice(&openDev);
}
void rspDuoSelectTuner(sdrplay_api_TunerSelectT tuner, sdrplay_api_RspDuo_AmPortSelectT amPort) {
if (openDev.tuner != tuner) {
spdlog::info("Swapping tuners");
@ -500,7 +512,6 @@ public:
channelParams->tunerParams.gain.gRdB = gain;
sdrplay_api_Update(openDev.dev, openDev.tuner, sdrplay_api_Update_Tuner_Gr, sdrplay_api_Update_Ext1_None);
sdrplay_api_Update(openDev.dev, openDev.tuner, sdrplay_api_Update_Tuner_Gr, sdrplay_api_Update_Ext1_None);
}
void rspDuoSelectAntennaPort(int port) {
@ -534,7 +545,7 @@ private:
SDRPlaySourceModule* _this = (SDRPlaySourceModule*)ctx;
spdlog::info("SDRPlaySourceModule '{0}': Menu Deselect!", _this->name);
}
static void start(void* ctx) {
SDRPlaySourceModule* _this = (SDRPlaySourceModule*)ctx;
if (_this->running) { return; }
@ -620,11 +631,12 @@ private:
}
// General options
if(_this->ifModeId == 0){
if (_this->ifModeId == 0) {
_this->bandwidth = (_this->bandwidthId == 8) ? preferedBandwidth[_this->srId] : bandwidths[_this->bandwidthId];
_this->openDevParams->devParams->fsFreq.fsHz = _this->sampleRate;
_this->channelParams->tunerParams.bwType = _this->bandwidth;
} else {
}
else {
_this->openDevParams->devParams->fsFreq.fsHz = ifModes[_this->ifModeId].deviceSamplerate;
_this->channelParams->tunerParams.bwType = ifModes[_this->ifModeId].bw;
}
@ -658,13 +670,13 @@ private:
_this->running = true;
spdlog::info("SDRPlaySourceModule '{0}': Start!", _this->name);
}
static void stop(void* ctx) {
SDRPlaySourceModule* _this = (SDRPlaySourceModule*)ctx;
if (!_this->running) { return; }
_this->running = false;
_this->stream.stopWriter();
// Release device after stopping
sdrplay_api_Uninit(_this->openDev.dev);
sdrplay_api_ReleaseDevice(&_this->openDev);
@ -672,7 +684,7 @@ private:
_this->stream.clearWriteStop();
spdlog::info("SDRPlaySourceModule '{0}': Stop!", _this->name);
}
static void tune(double freq, void* ctx) {
SDRPlaySourceModule* _this = (SDRPlaySourceModule*)ctx;
if (_this->running) {
@ -682,7 +694,7 @@ private:
_this->freq = freq;
spdlog::info("SDRPlaySourceModule '{0}': Tune: {1}!", _this->name, freq);
}
static void menuHandler(void* ctx) {
SDRPlaySourceModule* _this = (SDRPlaySourceModule*)ctx;
float menuWidth = ImGui::GetContentRegionAvailWidth();
@ -690,8 +702,8 @@ private:
if (_this->running) { style::beginDisabled(); }
ImGui::SetNextItemWidth(menuWidth);
if (ImGui::Combo(CONCAT("##sdrplay_dev", _this->name), &_this->devId, _this->devListTxt.c_str())) {
_this->selectById(_this->devId);
config.acquire();
@ -736,28 +748,29 @@ private:
_this->selectByName(_this->selectedName);
}
}
ImGui::Text("IF Mode");
ImGui::SameLine();
ImGui::SetNextItemWidth(menuWidth - ImGui::GetCursorPosX());
if (ImGui::Combo(CONCAT("##sdrplay_ifmode", _this->name), &_this->ifModeId, ifModeTxt)) {
if(_this->ifModeId != 0){
if (_this->ifModeId != 0) {
_this->bandwidth = ifModes[_this->ifModeId].bw;
_this->sampleRate = ifModes[_this->ifModeId].effectiveSamplerate;
} else {
}
else {
config.acquire();
_this->sampleRate = config.conf["devices"][_this->selectedName]["sampleRate"];
_this->bandwidthId = config.conf["devices"][_this->selectedName]["bwMode"];
config.release(false);
_this->bandwidth = (_this->bandwidthId == 8) ? preferedBandwidth[_this->srId] : bandwidths[_this->bandwidthId];
}
}
core::setInputSampleRate(_this->sampleRate);
config.acquire();
config.conf["devices"][_this->selectedName]["ifModeId"] = _this->ifModeId;
config.release(true);
}
if (_this->running) { style::endDisabled(); }
if (_this->running) { style::endDisabled(); }
if (_this->selectedName != "") {
ImGui::PushItemWidth(menuWidth - ImGui::CalcTextSize("LNA Gain").x - 10);
@ -850,29 +863,29 @@ private:
}
switch (_this->openDev.hwVer) {
case SDRPLAY_RSP1_ID:
_this->RSP1Menu(menuWidth);
break;
case SDRPLAY_RSP1A_ID:
_this->RSP1AMenu(menuWidth);
break;
case SDRPLAY_RSP2_ID:
_this->RSP2Menu(menuWidth);
break;
case SDRPLAY_RSPduo_ID:
_this->RSPduoMenu(menuWidth);
break;
case SDRPLAY_RSPdx_ID:
_this->RSPdxMenu(menuWidth);
break;
default:
_this->RSPUnsupportedMenu(menuWidth);
break;
case SDRPLAY_RSP1_ID:
_this->RSP1Menu(menuWidth);
break;
case SDRPLAY_RSP1A_ID:
_this->RSP1AMenu(menuWidth);
break;
case SDRPLAY_RSP2_ID:
_this->RSP2Menu(menuWidth);
break;
case SDRPLAY_RSPduo_ID:
_this->RSPduoMenu(menuWidth);
break;
case SDRPLAY_RSPdx_ID:
_this->RSPdxMenu(menuWidth);
break;
default:
_this->RSPUnsupportedMenu(menuWidth);
break;
}
}
else {
ImGui::TextColored(ImVec4(1.0f, 0.0f, 0.0f, 1.0f), "No device available");
}
}
}
bool agcParamMenu(bool& valid) {
@ -881,7 +894,7 @@ private:
ImGui::OpenPopup("Edit##sdrplay_source_edit_agc_params_");
if (ImGui::BeginPopup("Edit##sdrplay_source_edit_agc_params_", ImGuiWindowFlags_NoResize)) {
ImGui::BeginTable(("sdrplay_source_agc_param_tbl"+name).c_str(), 2);
ImGui::BeginTable(("sdrplay_source_agc_param_tbl" + name).c_str(), 2);
ImGui::TableNextRow();
ImGui::TableSetColumnIndex(0);
@ -938,7 +951,7 @@ private:
}
return open;
}
void RSP1Menu(float menuWidth) {
// No options?
}
@ -1103,8 +1116,8 @@ private:
ImGui::TextColored(ImVec4(1.0f, 0.0f, 0.0f, 1.0f), "Device currently unsupported");
}
static void streamCB(short *xi, short *xq, sdrplay_api_StreamCbParamsT *params,
unsigned int numSamples, unsigned int reset, void *cbContext) {
static void streamCB(short* xi, short* xq, sdrplay_api_StreamCbParamsT* params,
unsigned int numSamples, unsigned int reset, void* cbContext) {
SDRPlaySourceModule* _this = (SDRPlaySourceModule*)cbContext;
// TODO: Optimise using volk and math
if (!_this->running) { return; }
@ -1121,7 +1134,7 @@ private:
}
static void eventCB(sdrplay_api_EventT eventId, sdrplay_api_TunerSelectT tuner,
sdrplay_api_EventParamsT *params, void *cbContext) {
sdrplay_api_EventParamsT* params, void* cbContext) {
SDRPlaySourceModule* _this = (SDRPlaySourceModule*)cbContext;
}
@ -1137,7 +1150,7 @@ private:
sdrplay_api_CallbackFnsT cbFuncs;
sdrplay_api_DeviceT openDev;
sdrplay_api_DeviceParamsT * openDevParams;
sdrplay_api_DeviceParamsT* openDevParams;
sdrplay_api_RxChannelParamsT* channelParams;
sdrplay_api_Bw_MHzT bandwidth;
@ -1149,7 +1162,7 @@ private:
int lnaGain = 9;
int gain = 59;
int lnaSteps = 9;
bool agc = false;
bool agcParamEdit = false;
int agcAttack = 500;

View File

@ -14,7 +14,7 @@
#define CONCAT(a, b) ((std::string(a) + b).c_str())
SDRPP_MOD_INFO {
SDRPP_MOD_INFO{
/* Name: */ "soapy_source",
/* Description: */ "SoapySDR source module for SDR++",
/* Author: */ "Ryzerth",
@ -70,7 +70,7 @@ public:
bool isEnabled() {
return enabled;
}
template <typename T>
std::string to_string_with_precision(const T a_value, const int n = 6) {
std::ostringstream out;
@ -90,15 +90,16 @@ private:
i++;
}
}
float selectBwBySr(double samplerate) {
float cur = bandwidthList[1];
std::vector<float> bwListReversed = bandwidthList;
std::reverse(bwListReversed.begin(), bwListReversed.end());
for(auto bw : bwListReversed) {
if(bw >= samplerate) {
for (auto bw : bwListReversed) {
if (bw >= samplerate) {
cur = bw;
} else {
}
else {
break;
}
}
@ -156,7 +157,7 @@ private:
antennaList = dev->listAntennas(SOAPY_SDR_RX, channelId);
txtAntennaList = "";
for (const std::string & ant : antennaList) {
for (const std::string& ant : antennaList) {
txtAntennaList += ant + '\0';
}
@ -164,27 +165,29 @@ private:
delete[] uiGains;
uiGains = new float[gainList.size()];
gainRanges.clear();
for (auto gain : gainList) {
gainRanges.push_back(dev->getGainRange(SOAPY_SDR_RX, channelId, gain));
}
SoapySDR::RangeList bandwidthRange = dev->getBandwidthRange(SOAPY_SDR_RX, channelId);
txtBwList = "";
bandwidthList.clear();
bandwidthList.push_back(-1);
txtBwList += "Auto";
txtBwList += '\0';
for(auto bwr : bandwidthRange) {
for (auto bwr : bandwidthRange) {
float bw = bwr.minimum();
bandwidthList.push_back(bw);
if (bw > 1.0e3 && bw <= 1.0e6) {
txtBwList += to_string_with_precision((bw / 1.0e3), 2) + " kHz";
} else if (bw > 1.0e6) {
}
else if (bw > 1.0e6) {
txtBwList += to_string_with_precision((bw / 1.0e6), 2) + " MHz";
} else {
}
else {
txtBwList += to_string_with_precision(bw, 0);
}
txtBwList += '\0';
@ -195,9 +198,11 @@ private:
for (double sr : sampleRates) {
if (sr > 1.0e3 && sr <= 1.0e6) {
txtSrList += to_string_with_precision((sr / 1.0e3), 2) + " kHz";
} else if (sr > 1.0e6) {
}
else if (sr > 1.0e6) {
txtSrList += to_string_with_precision((sr / 1.0e6), 2) + " MHz";
} else {
}
else {
txtSrList += to_string_with_precision(sr, 0);
}
txtSrList += '\0';
@ -209,9 +214,10 @@ private:
config.acquire();
if (config.conf["devices"].contains(name)) {
if(config.conf["devices"][name].contains("antenna")) {
if (config.conf["devices"][name].contains("antenna")) {
uiAntennaId = config.conf["devices"][name]["antenna"];
} else {
}
else {
uiAntennaId = 0;
}
int i = 0;
@ -224,9 +230,10 @@ private:
}
i++;
}
if(config.conf["devices"][name].contains("bandwidth")) {
if (config.conf["devices"][name].contains("bandwidth")) {
uiBandwidthId = config.conf["devices"][name]["bandwidth"];
} else if(bandwidthList.size() > 2) {
}
else if (bandwidthList.size() > 2) {
uiBandwidthId = 0;
}
if (hasAgc && config.conf["devices"][name].contains("agc")) {
@ -249,7 +256,7 @@ private:
uiGains[i] = gainRanges[i].minimum();
i++;
}
if(bandwidthList.size() > 2)
if (bandwidthList.size() > 2)
uiBandwidthId = 0;
if (hasAgc) {
agc = false;
@ -257,7 +264,6 @@ private:
selectSampleRate(sampleRates[0]); // Select default
}
config.release();
}
void saveCurrent() {
@ -269,7 +275,7 @@ private:
conf["gains"][gain] = uiGains[i];
i++;
}
if(bandwidthList.size() > 2)
if (bandwidthList.size() > 2)
conf["bandwidth"] = uiBandwidthId;
if (hasAgc) {
conf["agc"] = agc;
@ -292,7 +298,7 @@ private:
SoapyModule* _this = (SoapyModule*)ctx;
spdlog::info("SoapyModule '{0}': Menu Deselect!", _this->name);
}
static void start(void* ctx) {
SoapyModule* _this = (SoapyModule*)ctx;
if (_this->running) { return; }
@ -307,8 +313,8 @@ private:
_this->dev->setAntenna(SOAPY_SDR_RX, _this->channelId, _this->antennaList[_this->uiAntennaId]);
if(_this->bandwidthList.size() > 2) {
if(_this->bandwidthList[_this->uiBandwidthId] == -1)
if (_this->bandwidthList.size() > 2) {
if (_this->bandwidthList[_this->uiBandwidthId] == -1)
_this->dev->setBandwidth(SOAPY_SDR_RX, _this->channelId, _this->selectBwBySr(_this->sampleRates[_this->srId]));
else
_this->dev->setBandwidth(SOAPY_SDR_RX, _this->channelId, _this->bandwidthList[_this->uiBandwidthId]);
@ -332,7 +338,7 @@ private:
_this->workerThread = std::thread(_worker, _this);
spdlog::info("SoapyModule '{0}': Start!", _this->name);
}
static void stop(void* ctx) {
SoapyModule* _this = (SoapyModule*)ctx;
if (!_this->running) { return; }
@ -343,10 +349,10 @@ private:
_this->workerThread.join();
_this->stream.clearWriteStop();
SoapySDR::Device::unmake(_this->dev);
spdlog::info("SoapyModule '{0}': Stop!", _this->name);
}
static void tune(double freq, void* ctx) {
SoapyModule* _this = (SoapyModule*)ctx;
_this->freq = freq;
@ -355,12 +361,12 @@ private:
}
spdlog::info("SoapyModule '{0}': Tune: {1}!", _this->name, freq);
}
static void menuHandler(void* ctx) {
SoapyModule* _this = (SoapyModule*)ctx;
float menuWidth = ImGui::GetContentRegionAvailWidth();
// If no device is selected, draw only the refresh button
if (_this->devId < 0) {
if (ImGui::Button(CONCAT("Refresh##_dev_select_", _this->name), ImVec2(menuWidth, 0))) {
@ -382,7 +388,7 @@ private:
if (ImGui::Combo(CONCAT("##_sr_select_", _this->name), &_this->srId, _this->txtSrList.c_str())) {
_this->selectSampleRate(_this->sampleRates[_this->srId]);
if(_this->bandwidthList.size() > 2 && _this->running && _this->bandwidthList[_this->uiBandwidthId] == -1)
if (_this->bandwidthList.size() > 2 && _this->running && _this->bandwidthList[_this->uiBandwidthId] == -1)
_this->dev->setBandwidth(SOAPY_SDR_RX, _this->channelId, _this->selectBwBySr(_this->sampleRates[_this->srId]));
_this->saveCurrent();
}
@ -440,12 +446,13 @@ private:
ImGui::SetNextItemWidth(menuWidth - gainNameLen);
float step = _this->gainRanges[i].step();
bool res;
if(step == 0.0f) {
res = ImGui::SliderFloat((std::string("##_gain_sel_") + _this->name + gain).c_str(), &_this->uiGains[i], _this->gainRanges[i].minimum(), _this->gainRanges[i].maximum());
} else {
if (step == 0.0f) {
res = ImGui::SliderFloat((std::string("##_gain_sel_") + _this->name + gain).c_str(), &_this->uiGains[i], _this->gainRanges[i].minimum(), _this->gainRanges[i].maximum());
}
else {
res = ImGui::SliderFloatWithSteps((std::string("##_gain_sel_") + _this->name + gain).c_str(), &_this->uiGains[i], _this->gainRanges[i].minimum(), _this->gainRanges[i].maximum(), step);
}
if(res) {
if (res) {
if (_this->running) {
_this->dev->setGain(SOAPY_SDR_RX, _this->channelId, gain, _this->uiGains[i]);
}
@ -453,12 +460,12 @@ private:
}
i++;
}
if(_this->bandwidthList.size() > 2) {
if (_this->bandwidthList.size() > 2) {
ImGui::LeftLabel("Bandwidth");
ImGui::SetNextItemWidth(menuWidth - ImGui::GetCursorPosX());
if (ImGui::Combo(CONCAT("##_bw_select_", _this->name), &_this->uiBandwidthId, _this->txtBwList.c_str())) {
if(_this->running) {
if(_this->bandwidthList[_this->uiBandwidthId] == -1)
if (_this->running) {
if (_this->bandwidthList[_this->uiBandwidthId] == -1)
_this->dev->setBandwidth(SOAPY_SDR_RX, _this->channelId, _this->selectBwBySr(_this->sampleRates[_this->srId]));
else
_this->dev->setBandwidth(SOAPY_SDR_RX, _this->channelId, _this->bandwidthList[_this->uiBandwidthId]);
@ -472,7 +479,7 @@ private:
int blockSize = _this->sampleRate / 200.0f;
int flags = 0;
long long timeMs = 0;
while (_this->running) {
int res = _this->dev->readStream(_this->devStream, (void**)&_this->stream.writeBuf, blockSize, flags, timeMs);
if (res < 1) {
@ -515,12 +522,12 @@ private:
};
MOD_EXPORT void _INIT_() {
config.setPath(options::opts.root + "/soapy_source_config.json");
json defConf;
defConf["device"] = "";
defConf["devices"] = json({});
config.load(defConf);
config.enableAutoSave();
config.setPath(options::opts.root + "/soapy_source_config.json");
json defConf;
defConf["device"] = "";
defConf["devices"] = json({});
config.load(defConf);
config.enableAutoSave();
}
MOD_EXPORT ModuleManager::Instance* _CREATE_INSTANCE_(std::string name) {

View File

@ -13,7 +13,7 @@
#define CONCAT(a, b) ((std::string(a) + b).c_str())
SDRPP_MOD_INFO {
SDRPP_MOD_INFO{
/* Name: */ "spyserver_source",
/* Description: */ "SpyServer source module for SDR++",
/* Author: */ "Ryzerth",
@ -29,8 +29,8 @@ const char* deviceTypesStr[] = {
};
const char* streamFormatStr = "UInt8\0"
"Int16\0"
"Float32\0";
"Int16\0"
"Float32\0";
const SpyServerStreamFormat streamFormats[] = {
SPYSERVER_STREAM_FORMAT_UINT8,
@ -116,7 +116,7 @@ private:
gui::mainWindow.playButtonLocked = false;
spdlog::info("SpyServerSourceModule '{0}': Menu Deselect!", _this->name);
}
static void start(void* ctx) {
SpyServerSourceModule* _this = (SpyServerSourceModule*)ctx;
if (_this->running) { return; }
@ -133,17 +133,17 @@ private:
_this->running = true;
spdlog::info("SpyServerSourceModule '{0}': Start!", _this->name);
}
static void stop(void* ctx) {
SpyServerSourceModule* _this = (SpyServerSourceModule*)ctx;
if (!_this->running) { return; }
_this->client->stopStream();
_this->running = false;
spdlog::info("SpyServerSourceModule '{0}': Stop!", _this->name);
}
static void tune(double freq, void* ctx) {
SpyServerSourceModule* _this = (SpyServerSourceModule*)ctx;
if (_this->running) {
@ -152,7 +152,7 @@ private:
_this->freq = freq;
spdlog::info("SpyServerSourceModule '{0}': Tune: {1}!", _this->name, freq);
}
static void menuHandler(void* ctx) {
SpyServerSourceModule* _this = (SpyServerSourceModule*)ctx;
float menuWidth = ImGui::GetContentRegionAvailWidth();
@ -211,7 +211,7 @@ private:
_this->sampleRatesTxt += '\0';
}
_this->srId = std::clamp<int>(_this->srId, 0, _this->sampleRates.size()-1);
_this->srId = std::clamp<int>(_this->srId, 0, _this->sampleRates.size() - 1);
_this->sampleRate = _this->sampleRates[_this->srId];
core::setInputSampleRate(_this->sampleRate);
@ -227,7 +227,6 @@ private:
}
if (_this->running) { style::endDisabled(); }
if (connected) {
if (_this->running) { style::beginDisabled(); }
@ -248,7 +247,7 @@ private:
int srvBits = streamFormatsBitCount[_this->iqType];
_this->client->setSetting(SPYSERVER_SETTING_IQ_FORMAT, streamFormats[_this->iqType]);
_this->client->setSetting(SPYSERVER_SETTING_IQ_DIGITAL_GAIN, _this->client->computeDigitalGain(srvBits, _this->gain, _this->srId + _this->client->devInfo.MinimumIQDecimation));
config.acquire();
config.conf["devices"][_this->devRef]["sampleBitDepthId"] = _this->iqType;
config.release(true);

View File

@ -62,7 +62,7 @@ namespace spyserver {
bool SpyServerClientClass::waitForDevInfo(int timeoutMS) {
std::unique_lock lck(deviceInfoMtx);
auto now = std::chrono::system_clock::now();
deviceInfoCnd.wait_until(lck, now + (timeoutMS*1ms), [this](){ return deviceInfoAvailable; });
deviceInfoCnd.wait_until(lck, now + (timeoutMS * 1ms), [this]() { return deviceInfoAvailable; });
return deviceInfoAvailable;
}
@ -109,7 +109,7 @@ namespace spyserver {
SpyServerClientClass* _this = (SpyServerClientClass*)ctx;
if (count < sizeof(SpyServerMessageHeader)) {
_this->readSize(sizeof(SpyServerMessageHeader)-count, &buf[count]);
_this->readSize(sizeof(SpyServerMessageHeader) - count, &buf[count]);
}
int size = _this->readSize(_this->receivedHeader.BodySize, _this->readBuf);
@ -133,19 +133,19 @@ namespace spyserver {
_this->deviceInfoCnd.notify_all();
}
else if (mtype == SPYSERVER_MSG_TYPE_UINT8_IQ) {
int sampCount = _this->receivedHeader.BodySize / (sizeof(uint8_t)*2);
int sampCount = _this->receivedHeader.BodySize / (sizeof(uint8_t) * 2);
float gain = pow(10, (double)mflags / 20.0);
float scale = 1.0f / (gain * 128.0f);
for (int i = 0; i < sampCount; i++) {
_this->output->writeBuf[i].re = ((float)_this->readBuf[(2*i)] - 128.0f) * scale;
_this->output->writeBuf[i].im = ((float)_this->readBuf[(2*i)+1] - 128.0f) * scale;
_this->output->writeBuf[i].re = ((float)_this->readBuf[(2 * i)] - 128.0f) * scale;
_this->output->writeBuf[i].im = ((float)_this->readBuf[(2 * i) + 1] - 128.0f) * scale;
}
_this->output->swap(sampCount);
}
else if (mtype == SPYSERVER_MSG_TYPE_INT16_IQ) {
int sampCount = _this->receivedHeader.BodySize / (sizeof(int16_t)*2);
int sampCount = _this->receivedHeader.BodySize / (sizeof(int16_t) * 2);
float gain = pow(10, (double)mflags / 20.0);
volk_16i_s32f_convert_32f((float*)_this->output->writeBuf, (int16_t*)_this->readBuf, 32768.0 * gain, sampCount*2);
volk_16i_s32f_convert_32f((float*)_this->output->writeBuf, (int16_t*)_this->readBuf, 32768.0 * gain, sampCount * 2);
_this->output->swap(sampCount);
}
else if (mtype == SPYSERVER_MSG_TYPE_INT24_IQ) {
@ -155,7 +155,7 @@ namespace spyserver {
else if (mtype == SPYSERVER_MSG_TYPE_FLOAT_IQ) {
int sampCount = _this->receivedHeader.BodySize / sizeof(dsp::complex_t);
float gain = pow(10, (double)mflags / 20.0);
volk_32f_s32f_multiply_32f((float*)_this->output->writeBuf, (float*)_this->readBuf, gain, sampCount*2);
volk_32f_s32f_multiply_32f((float*)_this->output->writeBuf, (float*)_this->readBuf, gain, sampCount * 2);
_this->output->swap(sampCount);
}

View File

@ -44,11 +44,10 @@ namespace spyserver {
SpyServerMessageHeader receivedHeader;
dsp::stream<dsp::complex_t>* output;
};
typedef std::unique_ptr<SpyServerClientClass> SpyServerClient;
SpyServerClient connect(std::string host, uint16_t port, dsp::stream<dsp::complex_t>* out);
}

View File

@ -17,85 +17,85 @@ Corrections by Ryzerth.
#define SPYSERVER_MAX_COMMAND_BODY_SIZE (256)
#define SPYSERVER_MAX_MESSAGE_BODY_SIZE (1 << 20)
#define SPYSERVER_MAX_DISPLAY_PIXELS (1 << 15)
#define SPYSERVER_MIN_DISPLAY_PIXELS (100)
#define SPYSERVER_MAX_FFT_DB_RANGE (150)
#define SPYSERVER_MIN_FFT_DB_RANGE (10)
#define SPYSERVER_MAX_FFT_DB_OFFSET (100)
#define SPYSERVER_MAX_DISPLAY_PIXELS (1 << 15)
#define SPYSERVER_MIN_DISPLAY_PIXELS (100)
#define SPYSERVER_MAX_FFT_DB_RANGE (150)
#define SPYSERVER_MIN_FFT_DB_RANGE (10)
#define SPYSERVER_MAX_FFT_DB_OFFSET (100)
enum SpyServerDeviceType {
SPYSERVER_DEVICE_INVALID = 0,
SPYSERVER_DEVICE_AIRSPY_ONE = 1,
SPYSERVER_DEVICE_AIRSPY_HF = 2,
SPYSERVER_DEVICE_RTLSDR = 3,
SPYSERVER_DEVICE_INVALID = 0,
SPYSERVER_DEVICE_AIRSPY_ONE = 1,
SPYSERVER_DEVICE_AIRSPY_HF = 2,
SPYSERVER_DEVICE_RTLSDR = 3,
};
enum SpyServerCommandType {
SPYSERVER_CMD_HELLO = 0,
SPYSERVER_CMD_SET_SETTING = 2,
SPYSERVER_CMD_PING = 3,
SPYSERVER_CMD_HELLO = 0,
SPYSERVER_CMD_SET_SETTING = 2,
SPYSERVER_CMD_PING = 3,
};
enum SpyServerSettingType {
SPYSERVER_SETTING_STREAMING_MODE = 0,
SPYSERVER_SETTING_STREAMING_ENABLED = 1,
SPYSERVER_SETTING_GAIN = 2,
SPYSERVER_SETTING_STREAMING_MODE = 0,
SPYSERVER_SETTING_STREAMING_ENABLED = 1,
SPYSERVER_SETTING_GAIN = 2,
SPYSERVER_SETTING_IQ_FORMAT = 100, // 0x64
SPYSERVER_SETTING_IQ_FREQUENCY = 101, // 0x65
SPYSERVER_SETTING_IQ_DECIMATION = 102, // 0x66
SPYSERVER_SETTING_IQ_DIGITAL_GAIN = 103, // 0x67
SPYSERVER_SETTING_IQ_FORMAT = 100, // 0x64
SPYSERVER_SETTING_IQ_FREQUENCY = 101, // 0x65
SPYSERVER_SETTING_IQ_DECIMATION = 102, // 0x66
SPYSERVER_SETTING_IQ_DIGITAL_GAIN = 103, // 0x67
SPYSERVER_SETTING_FFT_FORMAT = 200, // 0xc8
SPYSERVER_SETTING_FFT_FREQUENCY = 201, // 0xc9
SPYSERVER_SETTING_FFT_DECIMATION = 202, // 0xca
SPYSERVER_SETTING_FFT_DB_OFFSET = 203, // 0xcb
SPYSERVER_SETTING_FFT_DB_RANGE = 204, // 0xcc
SPYSERVER_SETTING_FFT_DISPLAY_PIXELS = 205, // 0xcd
SPYSERVER_SETTING_FFT_FORMAT = 200, // 0xc8
SPYSERVER_SETTING_FFT_FREQUENCY = 201, // 0xc9
SPYSERVER_SETTING_FFT_DECIMATION = 202, // 0xca
SPYSERVER_SETTING_FFT_DB_OFFSET = 203, // 0xcb
SPYSERVER_SETTING_FFT_DB_RANGE = 204, // 0xcc
SPYSERVER_SETTING_FFT_DISPLAY_PIXELS = 205, // 0xcd
};
enum SpyServerStreamType {
SPYSERVER_STREAM_TYPE_STATUS = 0,
SPYSERVER_STREAM_TYPE_IQ = 1,
SPYSERVER_STREAM_TYPE_AF = 2,
SPYSERVER_STREAM_TYPE_FFT = 4,
SPYSERVER_STREAM_TYPE_STATUS = 0,
SPYSERVER_STREAM_TYPE_IQ = 1,
SPYSERVER_STREAM_TYPE_AF = 2,
SPYSERVER_STREAM_TYPE_FFT = 4,
};
enum SpyServerStreamingMode {
SPYSERVER_STREAM_MODE_IQ_ONLY = SPYSERVER_STREAM_TYPE_IQ, // 0x01
SPYSERVER_STREAM_MODE_AF_ONLY = SPYSERVER_STREAM_TYPE_AF, // 0x02
SPYSERVER_STREAM_MODE_FFT_ONLY = SPYSERVER_STREAM_TYPE_FFT, // 0x04
SPYSERVER_STREAM_MODE_FFT_IQ = SPYSERVER_STREAM_TYPE_FFT | SPYSERVER_STREAM_TYPE_IQ, // 0x05
SPYSERVER_STREAM_MODE_FFT_AF = SPYSERVER_STREAM_TYPE_FFT | SPYSERVER_STREAM_TYPE_AF, // 0x06
SPYSERVER_STREAM_MODE_IQ_ONLY = SPYSERVER_STREAM_TYPE_IQ, // 0x01
SPYSERVER_STREAM_MODE_AF_ONLY = SPYSERVER_STREAM_TYPE_AF, // 0x02
SPYSERVER_STREAM_MODE_FFT_ONLY = SPYSERVER_STREAM_TYPE_FFT, // 0x04
SPYSERVER_STREAM_MODE_FFT_IQ = SPYSERVER_STREAM_TYPE_FFT | SPYSERVER_STREAM_TYPE_IQ, // 0x05
SPYSERVER_STREAM_MODE_FFT_AF = SPYSERVER_STREAM_TYPE_FFT | SPYSERVER_STREAM_TYPE_AF, // 0x06
};
enum SpyServerStreamFormat {
SPYSERVER_STREAM_FORMAT_INVALID = 0,
SPYSERVER_STREAM_FORMAT_UINT8 = 1,
SPYSERVER_STREAM_FORMAT_INT16 = 2,
SPYSERVER_STREAM_FORMAT_INT24 = 3,
SPYSERVER_STREAM_FORMAT_FLOAT = 4,
SPYSERVER_STREAM_FORMAT_DINT4 = 5,
SPYSERVER_STREAM_FORMAT_INVALID = 0,
SPYSERVER_STREAM_FORMAT_UINT8 = 1,
SPYSERVER_STREAM_FORMAT_INT16 = 2,
SPYSERVER_STREAM_FORMAT_INT24 = 3,
SPYSERVER_STREAM_FORMAT_FLOAT = 4,
SPYSERVER_STREAM_FORMAT_DINT4 = 5,
};
enum SpyServerMessageType {
SPYSERVER_MSG_TYPE_DEVICE_INFO = 0,
SPYSERVER_MSG_TYPE_CLIENT_SYNC = 1,
SPYSERVER_MSG_TYPE_PONG = 2,
SPYSERVER_MSG_TYPE_READ_SETTING = 3,
SPYSERVER_MSG_TYPE_DEVICE_INFO = 0,
SPYSERVER_MSG_TYPE_CLIENT_SYNC = 1,
SPYSERVER_MSG_TYPE_PONG = 2,
SPYSERVER_MSG_TYPE_READ_SETTING = 3,
SPYSERVER_MSG_TYPE_UINT8_IQ = 100, // 0x64
SPYSERVER_MSG_TYPE_INT16_IQ = 101, // 0x65
SPYSERVER_MSG_TYPE_INT24_IQ = 102, // 0x66
SPYSERVER_MSG_TYPE_FLOAT_IQ = 103, // 0x67
SPYSERVER_MSG_TYPE_UINT8_IQ = 100, // 0x64
SPYSERVER_MSG_TYPE_INT16_IQ = 101, // 0x65
SPYSERVER_MSG_TYPE_INT24_IQ = 102, // 0x66
SPYSERVER_MSG_TYPE_FLOAT_IQ = 103, // 0x67
SPYSERVER_MSG_TYPE_UINT8_AF = 200, // 0xc8
SPYSERVER_MSG_TYPE_INT16_AF = 201, // 0xc9
SPYSERVER_MSG_TYPE_INT24_AF = 202, // 0xca
SPYSERVER_MSG_TYPE_FLOAT_AF = 203, // 0xcb
SPYSERVER_MSG_TYPE_UINT8_AF = 200, // 0xc8
SPYSERVER_MSG_TYPE_INT16_AF = 201, // 0xc9
SPYSERVER_MSG_TYPE_INT24_AF = 202, // 0xca
SPYSERVER_MSG_TYPE_FLOAT_AF = 203, // 0xcb
SPYSERVER_MSG_TYPE_DINT4_FFT = 300, //0x12C
SPYSERVER_MSG_TYPE_UINT8_FFT = 301, //0x12D
SPYSERVER_MSG_TYPE_DINT4_FFT = 300, //0x12C
SPYSERVER_MSG_TYPE_UINT8_FFT = 301, //0x12D
};
struct SpyServerClientHandshake {