mirror of
https://github.com/AlexandreRouma/SDRPlusPlus.git
synced 2025-06-25 12:07:49 +02:00
Code clean up + added inter module communication
This commit is contained in:
@ -15,6 +15,7 @@
|
||||
#include <raw_demod.h>
|
||||
#include <cw_demod.h>
|
||||
#include <options.h>
|
||||
#include <radio_interface.h>
|
||||
|
||||
#define CONCAT(a, b) ((std::string(a) + b).c_str())
|
||||
|
||||
@ -63,6 +64,8 @@ public:
|
||||
stream.start();
|
||||
|
||||
gui::menu.registerEntry(name, menuHandler, this, this);
|
||||
|
||||
core::modComManager.registerInterface("radio", name, moduleInterfaceHandler, this);
|
||||
}
|
||||
|
||||
~RadioModule() {
|
||||
@ -155,6 +158,13 @@ private:
|
||||
}
|
||||
}
|
||||
|
||||
static void moduleInterfaceHandler(int code, void* in, void* out, void* ctx) {
|
||||
RadioModule* _this = (RadioModule*)ctx;
|
||||
if (code == RADIO_IFACE_CMD_GET_MODE) {
|
||||
*(int*)out = _this->demodId;
|
||||
}
|
||||
}
|
||||
|
||||
void selectDemod(Demodulator* demod) {
|
||||
if (currentDemod != NULL) { currentDemod->stop(); }
|
||||
currentDemod = demod;
|
||||
|
16
radio/src/radio_interface.h
Normal file
16
radio/src/radio_interface.h
Normal file
@ -0,0 +1,16 @@
|
||||
#pragma once
|
||||
|
||||
enum {
|
||||
RADIO_IFACE_CMD_GET_MODE
|
||||
};
|
||||
|
||||
enum {
|
||||
RADIO_IFACE_MODE_NFM,
|
||||
RADIO_IFACE_MODE_WFM,
|
||||
RADIO_IFACE_MODE_AM,
|
||||
RADIO_IFACE_MODE_DSB,
|
||||
RADIO_IFACE_MODE_USB,
|
||||
RADIO_IFACE_MODE_CW,
|
||||
RADIO_IFACE_MODE_LSB,
|
||||
RADIO_IFACE_MODE_RAW
|
||||
};
|
Reference in New Issue
Block a user