Skip to content

Commit 8860f36

Browse files
committed
Merge remote-tracking branch 'upstream/master'
2 parents 239a198 + bddfe53 commit 8860f36

File tree

15 files changed

+957
-160
lines changed

15 files changed

+957
-160
lines changed

CMakeLists.txt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ option(OPT_BUILD_WEATHER_SAT_DECODER "Build the HRPT decoder module (no dependen
5050
# Misc
5151
option(OPT_BUILD_DISCORD_PRESENCE "Build the Discord Rich Presence module" ON)
5252
option(OPT_BUILD_FREQUENCY_MANAGER "Build the Frequency Manager module" ON)
53+
option(OPT_BUILD_IQ_EXPORTER "Build the IQ Exporter module" ON)
5354
option(OPT_BUILD_RECORDER "Audio and baseband recorder" ON)
5455
option(OPT_BUILD_RIGCTL_CLIENT "Rigctl client to make SDR++ act as a panadapter" ON)
5556
option(OPT_BUILD_RIGCTL_SERVER "Rigctl backend for controlling SDR++ with software like gpredict" ON)
@@ -247,7 +248,6 @@ if (OPT_BUILD_WEATHER_SAT_DECODER)
247248
add_subdirectory("decoder_modules/weather_sat_decoder")
248249
endif (OPT_BUILD_WEATHER_SAT_DECODER)
249250

250-
add_subdirectory("decoder_modules/pager_decoder")
251251

252252
# Misc
253253
if (OPT_BUILD_DISCORD_PRESENCE)
@@ -258,6 +258,10 @@ if (OPT_BUILD_FREQUENCY_MANAGER)
258258
add_subdirectory("misc_modules/frequency_manager")
259259
endif (OPT_BUILD_FREQUENCY_MANAGER)
260260

261+
if (OPT_BUILD_IQ_EXPORTER)
262+
add_subdirectory("misc_modules/iq_exporter")
263+
endif (OPT_BUILD_IQ_EXPORTER)
264+
261265
if (OPT_BUILD_RECORDER)
262266
add_subdirectory("misc_modules/recorder")
263267
endif (OPT_BUILD_RECORDER)

core/src/utils/net.cpp

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,16 @@ namespace net {
138138
}
139139

140140
int Socket::send(const uint8_t* data, size_t len, const Address* dest) {
141-
return sendto(sock, (const char*)data, len, 0, (sockaddr*)(dest ? &dest->addr : (raddr ? &raddr->addr : NULL)), sizeof(sockaddr_in));
141+
// Send data
142+
int err = sendto(sock, (const char*)data, len, 0, (sockaddr*)(dest ? &dest->addr : (raddr ? &raddr->addr : NULL)), sizeof(sockaddr_in));
143+
144+
// On error, close socket
145+
if (err <= 0 && !WOULD_BLOCK) {
146+
close();
147+
return err;
148+
}
149+
150+
return err;
142151
}
143152

144153
int Socket::sendstr(const std::string& str, const Address* dest) {
Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
#pragma once
2+
#include <signal_path/vfo_manager.h>
23

34
class Decoder {
45
public:
5-
6-
virtual void showMenu();
7-
6+
virtual ~Decoder() {}
7+
virtual void showMenu() {};
8+
virtual void setVFO(VFOManager::VFO* vfo) = 0;
9+
virtual void start() = 0;
10+
virtual void stop() = 0;
811
};
Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
#pragma once
2+
#include "../decoder.h"
3+
#include <signal_path/vfo_manager.h>
4+
#include <utils/optionlist.h>
5+
#include <gui/widgets/symbol_diagram.h>
6+
#include <gui/style.h>
7+
#include <dsp/sink/handler_sink.h>
8+
#include "flex.h"
9+
10+
class FLEXDecoder : public Decoder {
11+
dsp::stream<float> dummy1;
12+
dsp::stream<uint8_t> dummy2;
13+
public:
14+
FLEXDecoder(const std::string& name, VFOManager::VFO* vfo) : diag(0.6, 1600) {
15+
this->name = name;
16+
this->vfo = vfo;
17+
18+
// Define baudrate options
19+
baudrates.define(1600, "1600 Baud", 1600);
20+
baudrates.define(3200, "3200 Baud", 3200);
21+
baudrates.define(6400, "6400 Baud", 6400);
22+
23+
// Init DSP
24+
vfo->setBandwidthLimits(12500, 12500, true);
25+
vfo->setSampleRate(16000, 12500);
26+
reshape.init(&dummy1, 1600.0, (1600 / 30.0) - 1600.0);
27+
dataHandler.init(&dummy2, _dataHandler, this);
28+
diagHandler.init(&reshape.out, _diagHandler, this);
29+
}
30+
31+
~FLEXDecoder() {
32+
stop();
33+
}
34+
35+
void showMenu() {
36+
ImGui::LeftLabel("Baudrate");
37+
ImGui::FillWidth();
38+
if (ImGui::Combo(("##pager_decoder_flex_br_" + name).c_str(), &brId, baudrates.txt)) {
39+
// TODO
40+
}
41+
42+
ImGui::FillWidth();
43+
diag.draw();
44+
}
45+
46+
void setVFO(VFOManager::VFO* vfo) {
47+
this->vfo = vfo;
48+
vfo->setBandwidthLimits(12500, 12500, true);
49+
vfo->setSampleRate(24000, 12500);
50+
// dsp.setInput(vfo->output);
51+
}
52+
53+
void start() {
54+
flog::debug("FLEX start");
55+
// dsp.start();
56+
reshape.start();
57+
dataHandler.start();
58+
diagHandler.start();
59+
}
60+
61+
void stop() {
62+
flog::debug("FLEX stop");
63+
// dsp.stop();
64+
reshape.stop();
65+
dataHandler.stop();
66+
diagHandler.stop();
67+
}
68+
69+
private:
70+
static void _dataHandler(uint8_t* data, int count, void* ctx) {
71+
FLEXDecoder* _this = (FLEXDecoder*)ctx;
72+
// _this->decoder.process(data, count);
73+
}
74+
75+
static void _diagHandler(float* data, int count, void* ctx) {
76+
FLEXDecoder* _this = (FLEXDecoder*)ctx;
77+
float* buf = _this->diag.acquireBuffer();
78+
memcpy(buf, data, count * sizeof(float));
79+
_this->diag.releaseBuffer();
80+
}
81+
82+
std::string name;
83+
84+
VFOManager::VFO* vfo;
85+
dsp::buffer::Reshaper<float> reshape;
86+
dsp::sink::Handler<uint8_t> dataHandler;
87+
dsp::sink::Handler<float> diagHandler;
88+
89+
flex::Decoder decoder;
90+
91+
ImGui::SymbolDiagram diag;
92+
93+
int brId = 0;
94+
95+
OptionList<int, int> baudrates;
96+
};
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#include "flex.h"
2+
3+
namespace flex {
4+
// TODO
5+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#pragma once
2+
3+
namespace flex {
4+
class Decoder {
5+
public:
6+
// TODO
7+
8+
private:
9+
// TODO
10+
};
11+
}

0 commit comments

Comments
 (0)