Fixed scripting + cleaner code + fixed RTLTCP

This commit is contained in:
AlexandreRouma 2020-10-07 22:44:54 +02:00
parent 46d5b8a750
commit 3b6a3ff94d
33 changed files with 274 additions and 100 deletions

View File

@ -10,6 +10,12 @@ add_subdirectory("file_source")
add_subdirectory("rtl_tcp_source") add_subdirectory("rtl_tcp_source")
add_subdirectory("demo") add_subdirectory("demo")
if (MSVC)
set(CMAKE_CXX_FLAGS "-O2 /std:c++17")
else()
set(CMAKE_CXX_FLAGS "-O3 -std=c++17")
endif (MSVC)
add_executable(sdrpp "src/main.cpp" "win32/resources.rc") add_executable(sdrpp "src/main.cpp" "win32/resources.rc")
target_link_libraries(sdrpp PRIVATE sdrpp_core) target_link_libraries(sdrpp PRIVATE sdrpp_core)

View File

@ -1,4 +1,7 @@
#include <config.h> #include <config.h>
#include <spdlog/spdlog.h>
#include <fstream>
#include <filesystem>
ConfigManager::ConfigManager() { ConfigManager::ConfigManager() {

View File

@ -1,13 +1,8 @@
#pragma once #pragma once
#include <json.hpp> #include <json.hpp>
#include <fstream>
#include <spdlog/spdlog.h>
#include <filesystem>
#include <sstream>
#include <iomanip>
#include <thread> #include <thread>
#include <chrono>
#include <string> #include <string>
#include <mutex>
using nlohmann::json; using nlohmann::json;

View File

@ -16,12 +16,11 @@
#include <core.h> #include <core.h>
#include <duktape/duktape.h> #include <duktape/duktape.h>
#include <duktape/duk_console.h> #include <duktape/duk_console.h>
#include <scripting.h>
#include <dsp/block.h>
#define STB_IMAGE_RESIZE_IMPLEMENTATION #define STB_IMAGE_RESIZE_IMPLEMENTATION
#include <stb_image_resize.h> #include <stb_image_resize.h>
#include <gui/gui.h>
#include <signal_path/signal_path.h>
#ifdef _WIN32 #ifdef _WIN32
#include <Windows.h> #include <Windows.h>
@ -97,9 +96,9 @@ int sdrpp_main() {
// duk_pop(ctx); // duk_pop(ctx);
core::scriptManager.createScript("TestScript 1", "test.js"); core::scriptManager.createScript("TestScript 1", "test.js");
core::scriptManager.createScript("TestScript 2", "test.js"); //core::scriptManager.createScript("TestScript 2", "test.js");
core::scriptManager.createScript("TestScript 3", "test.js"); //core::scriptManager.createScript("TestScript 3", "test.js");
core::scriptManager.createScript("TestScript 4", "test.js"); //core::scriptManager.createScript("TestScript 4", "test.js");
// TESTING // TESTING

View File

@ -1,6 +1,7 @@
#pragma once #pragma once
#include <vector> #include <vector>
#include <dsp/stream.h> #include <dsp/stream.h>
#include <volk.h>
namespace dsp { namespace dsp {
template <class D, class I, class O, int IC, int OC> template <class D, class I, class O, int IC, int OC>

View File

@ -1,4 +1,9 @@
#include <gui/bandplan.h> #include <gui/bandplan.h>
#include <fstream>
#include <spdlog/spdlog.h>
#include <filesystem>
#include <sstream>
#include <iomanip>
namespace bandplan { namespace bandplan {
std::map<std::string, BandPlan_t> bandplans; std::map<std::string, BandPlan_t> bandplans;

View File

@ -1,11 +1,7 @@
#pragma once #pragma once
#include <json.hpp> #include <json.hpp>
#include <fstream>
#include <spdlog/spdlog.h>
#include <filesystem>
#include <sstream>
#include <iomanip>
#include <imgui/imgui.h> #include <imgui/imgui.h>
#include <stdint.h>
using nlohmann::json; using nlohmann::json;

View File

@ -1,6 +1,7 @@
#include <gui/dialogs/credits.h> #include <gui/dialogs/credits.h>
#include <imgui.h> #include <imgui.h>
#include <gui/icons.h> #include <gui/icons.h>
#include <config.h>
namespace credits { namespace credits {
ImFont* bigFont; ImFont* bigFont;

View File

@ -1,4 +1,5 @@
#include <gui/frequency_select.h> #include <gui/frequency_select.h>
#include <config.h>
bool isInArea(ImVec2 val, ImVec2 min, ImVec2 max) { bool isInArea(ImVec2 val, ImVec2 min, ImVec2 max) {
return val.x >= min.x && val.x < max.x && val.y >= min.y && val.y < max.y; return val.x >= min.x && val.x < max.x && val.y >= min.y && val.y < max.y;

View File

@ -2,7 +2,6 @@
#include <imgui.h> #include <imgui.h>
#include <imgui_internal.h> #include <imgui_internal.h>
#include <stdint.h> #include <stdint.h>
#include <config.h>
class FrequencySelect { class FrequencySelect {
public: public:

View File

@ -8,4 +8,6 @@ namespace gui {
SDRPP_EXPORT ImGui::WaterFall waterfall; SDRPP_EXPORT ImGui::WaterFall waterfall;
SDRPP_EXPORT FrequencySelect freqSelect; SDRPP_EXPORT FrequencySelect freqSelect;
SDRPP_EXPORT Menu menu; SDRPP_EXPORT Menu menu;
void selectSource(std::string name);
}; };

View File

@ -1,4 +1,7 @@
#include <gui/icons.h> #include <gui/icons.h>
#include <stdint.h>
#include <GL/glew.h>
#include <config.h>
#define STB_IMAGE_IMPLEMENTATION #define STB_IMAGE_IMPLEMENTATION
#include <imgui/stb_image.h> #include <imgui/stb_image.h>

View File

@ -1,8 +1,7 @@
#pragma once #pragma once
#include <imgui/imgui.h> #include <imgui/imgui.h>
#include <stdint.h>
#include <GL/glew.h> #include <GL/glew.h>
#include <config.h> #include <string>
namespace icons { namespace icons {
extern ImTextureID LOGO; extern ImTextureID LOGO;

View File

@ -1,5 +1,40 @@
#include <gui/main_window.h> #include <gui/main_window.h>
#include <gui/gui.h> #include <gui/gui.h>
#include "imgui.h"
#include "imgui_impl_glfw.h"
#include "imgui_impl_opengl3.h"
#include <stdio.h>
#include <GL/glew.h>
#include <GLFW/glfw3.h>
#include <imgui_plot.h>
#include <dsp/resampling.h>
#include <dsp/demodulator.h>
#include <dsp/filter.h>
#include <thread>
#include <complex>
#include <dsp/source.h>
#include <dsp/math.h>
#include <gui/waterfall.h>
#include <gui/frequency_select.h>
#include <fftw3.h>
#include <signal_path/dsp.h>
#include <gui/icons.h>
#include <gui/bandplan.h>
#include <watcher.h>
#include <module.h>
#include <signal_path/vfo_manager.h>
#include <signal_path/audio.h>
#include <gui/style.h>
#include <config.h>
#include <signal_path/signal_path.h>
#include <core.h>
#include <gui/menus/source.h>
#include <gui/menus/display.h>
#include <gui/menus/bandplan.h>
#include <gui/menus/audio.h>
#include <gui/menus/scripting.h>
#include <gui/dialogs/credits.h>
#include <signal_path/source.h>
std::thread worker; std::thread worker;
std::mutex fft_mtx; std::mutex fft_mtx;
@ -107,7 +142,6 @@ void windowInit() {
float frequency = core::configManager.conf["frequency"]; float frequency = core::configManager.conf["frequency"];
gui::freqSelect.setFrequency(frequency); gui::freqSelect.setFrequency(frequency);
gui::freqSelect.frequencyChanged = false; gui::freqSelect.frequencyChanged = false;
sigpath::sourceManager.tune(frequency); sigpath::sourceManager.tune(frequency);
@ -460,11 +494,3 @@ void drawWindow() {
credits::show(); credits::show();
} }
} }
void bindVolumeVariable(float* vol) {
volume = vol;
}
void unbindVolumeVariable() {
volume = &dummyVolume;
}

View File

@ -1,43 +1,7 @@
#pragma once #pragma once
#include "imgui.h" #include "imgui.h"
#include "imgui_impl_glfw.h"
#include "imgui_impl_opengl3.h"
#include <stdio.h>
#include <GL/glew.h>
#include <GLFW/glfw3.h>
#include <imgui_plot.h>
#include <dsp/resampling.h>
#include <dsp/demodulator.h>
#include <dsp/filter.h>
#include <thread>
#include <complex>
#include <dsp/source.h>
#include <dsp/math.h>
#include <gui/waterfall.h>
#include <gui/frequency_select.h>
#include <fftw3.h>
#include <signal_path/dsp.h>
#include <gui/icons.h>
#include <gui/bandplan.h>
#include <watcher.h>
#include <module.h>
#include <signal_path/vfo_manager.h>
#include <signal_path/audio.h>
#include <gui/style.h>
#include <config.h>
#include <signal_path/signal_path.h>
#include <core.h>
#include <gui/menus/source.h>
#include <gui/menus/display.h>
#include <gui/menus/bandplan.h>
#include <gui/menus/audio.h>
#include <gui/menus/scripting.h>
#include <gui/dialogs/credits.h>
#include <signal_path/source.h>
#define WINDOW_FLAGS ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoBringToFrontOnFocus | ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoBackground #define WINDOW_FLAGS ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoBringToFrontOnFocus | ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoBackground
void windowInit(); void windowInit();
void drawWindow(); void drawWindow();
void bindVolumeVariable(float* vol);
void unbindVolumeVariable();

View File

@ -1,4 +1,5 @@
#include <gui/menu.h> #include <gui/menu.h>
#include <imgui/imgui.h>
Menu::Menu() { Menu::Menu() {

View File

@ -1,5 +1,4 @@
#pragma once #pragma once
#include <imgui/imgui.h>
#include <string> #include <string>
#include <vector> #include <vector>
#include <map> #include <map>

View File

@ -1,6 +1,7 @@
#include <gui/menus/scripting.h> #include <gui/menus/scripting.h>
#include <core.h> #include <core.h>
#include <gui/style.h> #include <gui/style.h>
#include <imgui/imgui.h>
namespace scriptingmenu { namespace scriptingmenu {
void init() { void init() {

View File

@ -1,4 +1,7 @@
#include <gui/style.h> #include <gui/style.h>
#include <imgui.h>
#include <imgui_internal.h>
#include <config.h>
namespace style { namespace style {
void setDefaultStyle() { void setDefaultStyle() {

View File

@ -1,7 +1,4 @@
#pragma once #pragma once
#include <imgui.h>
#include <imgui_internal.h>
#include <config.h>
namespace style { namespace style {
void setDefaultStyle(); void setDefaultStyle();

View File

@ -1,4 +1,9 @@
#include <gui/waterfall.h> #include <gui/waterfall.h>
#include <imgui.h>
#include <imgui_internal.h>
#include <GL/glew.h>
#include <imutils.h>
#include <algorithm>
float COLOR_MAP[][3] = { float COLOR_MAP[][3] = {
{0x00, 0x00, 0x20}, {0x00, 0x00, 0x20},

View File

@ -1,12 +1,10 @@
#pragma once #pragma once
#include <imgui.h>
#include <imgui_internal.h>
#include <vector> #include <vector>
#include <mutex> #include <mutex>
#include <GL/glew.h>
#include <imutils.h>
#include <gui/bandplan.h> #include <gui/bandplan.h>
#include <algorithm> #include <imgui/imgui.h>
#include <imgui/imgui_internal.h>
#include <GL/glew.h>
#define WATERFALL_RESOLUTION 1000000 #define WATERFALL_RESOLUTION 1000000

View File

@ -1,12 +1,14 @@
#include <module.h> #include <module.h>
#include <signal_path/vfo_manager.h> #include <filesystem>
#include <gui/main_window.h> #include <spdlog/spdlog.h>
#include <signal_path/audio.h> #include <json.hpp>
#include <fstream>
using nlohmann::json;
namespace mod { namespace mod {
std::map<std::string, Module_t> modules; std::map<std::string, Module_t> modules;
std::vector<std::string> moduleNames; std::vector<std::string> moduleNames;
ImGui::WaterFall* _wtf;
void loadModule(std::string path, std::string name) { void loadModule(std::string path, std::string name) {
if (!std::filesystem::exists(path)) { if (!std::filesystem::exists(path)) {

View File

@ -1,13 +1,6 @@
#pragma once #pragma once
#include <string> #include <string>
#include <map> #include <map>
#include <filesystem>
#include <stdint.h>
#include <imgui.h>
#include <spdlog/spdlog.h>
#include <dsp/types.h>
#include <dsp/stream.h>
#include <gui/waterfall.h>
#include <json.hpp> #include <json.hpp>
#ifdef _WIN32 #ifdef _WIN32

View File

@ -3,6 +3,8 @@
#include <version.h> #include <version.h>
#include <fstream> #include <fstream>
#include <sstream> #include <sstream>
#include <signal_path/signal_path.h>
#include <imgui/imgui.h>
ScriptManager::ScriptManager() { ScriptManager::ScriptManager() {
@ -42,9 +44,16 @@ duk_context* ScriptManager::createContext(ScriptManager* _this, std::string name
duk_idx_t sdrppBase = duk_push_object(ctx); duk_idx_t sdrppBase = duk_push_object(ctx);
// API
duk_push_string(ctx, VERSION_STR); duk_push_string(ctx, VERSION_STR);
duk_put_prop_string(ctx, sdrppBase, "version"); duk_put_prop_string(ctx, sdrppBase, "version");
duk_push_c_function(ctx, ScriptManager::duk_setSource, 1);
duk_put_prop_string(ctx, sdrppBase, "selectSource");
// Modules
duk_idx_t modObjId = duk_push_object(ctx); duk_idx_t modObjId = duk_push_object(ctx);
for (const auto& [name, handler] : _this->handlers) { for (const auto& [name, handler] : _this->handlers) {
duk_idx_t objId = duk_push_object(ctx); duk_idx_t objId = duk_push_object(ctx);
@ -73,3 +82,12 @@ void ScriptManager::bindScriptRunHandler(std::string name, ScriptManager::Script
// TODO: check if it exists and add a "unbind" function // TODO: check if it exists and add a "unbind" function
handlers[name] = handler; handlers[name] = handler;
} }
duk_ret_t ScriptManager::duk_setSource(duk_context* dukCtx) {
const char* name = duk_require_string(dukCtx, -1);
sigpath::sourceManager.selectSource(name);
duk_pop_n(dukCtx, 1); // Pop demod name, this and context
return 0;
}

View File

@ -43,6 +43,9 @@ public:
private: private:
static duk_context* createContext(ScriptManager* _this, std::string name); static duk_context* createContext(ScriptManager* _this, std::string name);
// API
static duk_ret_t duk_setSource(duk_context* ctx);
std::map<std::string, ScriptManager::ScriptRunHandler_t> handlers; std::map<std::string, ScriptManager::ScriptRunHandler_t> handlers;
}; };

View File

@ -3,7 +3,6 @@
#include <dsp/routing.h> #include <dsp/routing.h>
#include <io/audio.h> #include <io/audio.h>
#include <map> #include <map>
#include <watcher.h>
namespace audio { namespace audio {
enum { enum {

View File

@ -8,7 +8,6 @@
#include <dsp/sink.h> #include <dsp/sink.h>
#include <dsp/correction.h> #include <dsp/correction.h>
#include <dsp/vfo.h> #include <dsp/vfo.h>
#include <io/audio.h>
#include <map> #include <map>
#include <module.h> #include <module.h>

View File

@ -130,6 +130,21 @@ private:
duk_push_c_function(dukCtx, duk_setDemodulator, 1); duk_push_c_function(dukCtx, duk_setDemodulator, 1);
duk_put_prop_string(dukCtx, objId, "setDemodulator"); duk_put_prop_string(dukCtx, objId, "setDemodulator");
duk_push_c_function(dukCtx, duk_getDemodulator, 0);
duk_put_prop_string(dukCtx, objId, "getDemodulator");
duk_push_c_function(dukCtx, duk_setBandwidth, 1);
duk_put_prop_string(dukCtx, objId, "setBandwidth");
duk_push_c_function(dukCtx, duk_getBandwidth, 0);
duk_put_prop_string(dukCtx, objId, "getBandwidth");
duk_push_c_function(dukCtx, duk_getMaxBandwidth, 0);
duk_put_prop_string(dukCtx, objId, "getMaxBandwidth");
duk_push_c_function(dukCtx, duk_getMinBandwidth, 0);
duk_put_prop_string(dukCtx, objId, "getMinBandwidth");
duk_push_pointer(dukCtx, ctx); duk_push_pointer(dukCtx, ctx);
duk_put_prop_string(dukCtx, objId, DUK_HIDDEN_SYMBOL("radio_ctx")); duk_put_prop_string(dukCtx, objId, DUK_HIDDEN_SYMBOL("radio_ctx"));
} }
@ -138,17 +153,159 @@ private:
const char* str = duk_require_string(dukCtx, -1); const char* str = duk_require_string(dukCtx, -1);
std::string modName = str; std::string modName = str;
if (modName == "USB") { duk_push_this(dukCtx);
if (!duk_get_prop_literal(dukCtx, -1, DUK_HIDDEN_SYMBOL("radio_ctx"))) {
printf("COULD NOT RETRIEVE POINTER\n");
}
RadioModule* _this = (RadioModule*)duk_require_pointer(dukCtx, -1);
duk_pop_n(dukCtx, 3); // Pop demod name, this and context
if (modName == "NFM") {
_this->demod = 0;
_this->bandWidth = 16000;
_this->bandWidthMin = 8000;
_this->bandWidthMax = 16000;
_this->sigPath.setDemodulator(SigPath::DEMOD_NFM, _this->bandWidth);
}
else if (modName == "WFM") {
_this->demod = 1;
_this->bandWidth = 200000;
_this->bandWidthMin = 100000;
_this->bandWidthMax = 200000;
_this->sigPath.setDemodulator(SigPath::DEMOD_FM, _this->bandWidth);
}
else if (modName == "AM") {
_this->demod = 2;
_this->bandWidth = 12500;
_this->bandWidthMin = 6250;
_this->bandWidthMax = 12500;
_this->sigPath.setDemodulator(SigPath::DEMOD_AM, _this->bandWidth);
}
else if (modName == "DSB") {
_this->demod = 3;
_this->bandWidth = 6000;
_this->bandWidthMin = 3000;
_this->bandWidthMax = 6000;
_this->sigPath.setDemodulator(SigPath::DEMOD_DSB, _this->bandWidth);
}
else if (modName == "USB") {
_this->demod = 4; _this->demod = 4;
_this->bandWidth = 3000; _this->bandWidth = 3000;
_this->bandWidthMin = 1500; _this->bandWidthMin = 1500;
_this->bandWidthMax = 3000; _this->bandWidthMax = 3000;
_this->sigPath.setDemodulator(SigPath::DEMOD_USB, _this->bandWidth); _this->sigPath.setDemodulator(SigPath::DEMOD_USB, _this->bandWidth);
} }
else if (modName == "CW") { _this->demod = 5; }
else if (modName == "LSB") {
_this->demod = 6;
_this->bandWidth = 3000;
_this->bandWidthMin = 1500;
_this->bandWidthMax = 3000;
_this->sigPath.setDemodulator(SigPath::DEMOD_LSB, _this->bandWidth);
}
else if (modName == "RAW") {
_this->demod = 7;
_this->bandWidth = 10000;
_this->bandWidthMin = 3000;
_this->bandWidthMax = 10000;
_this->sigPath.setDemodulator(SigPath::DEMOD_RAW, _this->bandWidth);
}
else {
duk_push_string(dukCtx, "Invalid demodulator name");
duk_throw(dukCtx);
}
return 0; return 0;
} }
static duk_ret_t duk_getDemodulator(duk_context* dukCtx) {
duk_push_this(dukCtx);
if (!duk_get_prop_literal(dukCtx, -1, DUK_HIDDEN_SYMBOL("radio_ctx"))) {
printf("COULD NOT RETRIEVE POINTER\n");
}
RadioModule* _this = (RadioModule*)duk_require_pointer(dukCtx, -1);
duk_pop_n(dukCtx, 2); // Pop demod name, this and context
const char* demodNames[] = {"NFM", "WFM", "AM", "DSB", "USB", "CW", "LSB", "RAW"};
duk_push_string(dukCtx, demodNames[_this->demod]);
return 1;
}
static duk_ret_t duk_setBandwidth(duk_context* dukCtx) {
double bandwidth = duk_require_number(dukCtx, -1);
duk_push_this(dukCtx);
if (!duk_get_prop_literal(dukCtx, -1, DUK_HIDDEN_SYMBOL("radio_ctx"))) {
printf("COULD NOT RETRIEVE POINTER\n");
}
RadioModule* _this = (RadioModule*)duk_require_pointer(dukCtx, -1);
duk_pop_n(dukCtx, 3); // Pop demod name, this and context
if (bandwidth > _this->bandWidthMax || bandwidth < _this->bandWidthMin) {
duk_push_string(dukCtx, "Bandwidth out of range");
duk_throw(dukCtx);
}
_this->bandWidth = bandwidth;
_this->bandWidth = std::clamp<int>(_this->bandWidth, _this->bandWidthMin, _this->bandWidthMax);
_this->sigPath.setBandwidth(_this->bandWidth);
return 0;
}
static duk_ret_t duk_getBandwidth(duk_context* dukCtx) {
duk_push_this(dukCtx);
if (!duk_get_prop_literal(dukCtx, -1, DUK_HIDDEN_SYMBOL("radio_ctx"))) {
printf("COULD NOT RETRIEVE POINTER\n");
}
RadioModule* _this = (RadioModule*)duk_require_pointer(dukCtx, -1);
duk_pop_n(dukCtx, 2); // Pop demod name, this and context
duk_push_number(dukCtx, _this->bandWidth);
return 1;
}
static duk_ret_t duk_getMaxBandwidth(duk_context* dukCtx) {
duk_push_this(dukCtx);
if (!duk_get_prop_literal(dukCtx, -1, DUK_HIDDEN_SYMBOL("radio_ctx"))) {
printf("COULD NOT RETRIEVE POINTER\n");
}
RadioModule* _this = (RadioModule*)duk_require_pointer(dukCtx, -1);
duk_pop_n(dukCtx, 2); // Pop demod name, this and context
duk_push_number(dukCtx, _this->bandWidthMax);
return 1;
}
static duk_ret_t duk_getMinBandwidth(duk_context* dukCtx) {
duk_push_this(dukCtx);
if (!duk_get_prop_literal(dukCtx, -1, DUK_HIDDEN_SYMBOL("radio_ctx"))) {
printf("COULD NOT RETRIEVE POINTER\n");
}
RadioModule* _this = (RadioModule*)duk_require_pointer(dukCtx, -1);
duk_pop_n(dukCtx, 2); // Pop demod name, this and context
duk_push_number(dukCtx, _this->bandWidthMin);
return 1;
}
std::string name; std::string name;
int demod = 1; int demod = 1;
int deemp = 0; int deemp = 0;

View File

@ -3,7 +3,7 @@
"bandPlan": "General", "bandPlan": "General",
"bandPlanEnabled": true, "bandPlanEnabled": true,
"fftHeight": 300, "fftHeight": 300,
"frequency": 96571704, "frequency": 96035792,
"max": 0.0, "max": 0.0,
"maximized": false, "maximized": false,
"menuOrder": [ "menuOrder": [
@ -21,7 +21,7 @@
"source": "", "source": "",
"sourceSettings": {}, "sourceSettings": {},
"windowSize": { "windowSize": {
"h": 720, "h": 1053,
"w": 1280 "w": 959
} }
} }

View File

@ -1,7 +1,6 @@
{ {
"Radio": "./radio/Release/radio.dll", "Radio": "./radio/radio.so",
"Recorder": "./recorder/Release/recorder.dll", "Recorder": "./recorder/recorder.so",
"Soapy": "./soapy/Release/soapy.dll", "Soapy": "./soapy/soapy.so",
"FileSource": "./file_source/Release/file_source.dll", "RTLTCPSource": "./rtl_tcp_source/rtl_tcp_source.so"
"RTLTCPSource": "./rtl_tcp_source/Release/rtl_tcp_source.dll"
} }

View File

@ -10,8 +10,8 @@
#define CONCAT(a, b) ((std::string(a) + b).c_str()) #define CONCAT(a, b) ((std::string(a) + b).c_str())
MOD_INFO { MOD_INFO {
/* Name: */ "fike_source", /* Name: */ "rtl_tcp_source",
/* Description: */ "File input module for SDR++", /* Description: */ "RTL-TCP input module for SDR++",
/* Author: */ "Ryzerth", /* Author: */ "Ryzerth",
/* Version: */ "0.1.0" /* Version: */ "0.1.0"
}; };

View File

@ -87,7 +87,7 @@ public:
bzero(&serv_addr, sizeof(struct sockaddr_in)); bzero(&serv_addr, sizeof(struct sockaddr_in));
serv_addr.sin_family = AF_INET; 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 = port; 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 // TODO: log error
return false; return false;