mirror of
https://github.com/AlexandreRouma/SDRPlusPlus.git
synced 2025-03-31 12:25:40 +02:00
47 lines
1.2 KiB
C++
47 lines
1.2 KiB
C++
#pragma once
|
|
#include <string>
|
|
#include <vector>
|
|
#include <map>
|
|
#include <dsp/stream.h>
|
|
#include <dsp/types.h>
|
|
#include <utils/event.h>
|
|
|
|
class SourceManager {
|
|
public:
|
|
SourceManager();
|
|
|
|
struct SourceHandler {
|
|
dsp::stream<dsp::complex_t>* stream;
|
|
void (*menuHandler)(void* ctx);
|
|
void (*selectHandler)(void* ctx);
|
|
void (*deselectHandler)(void* ctx);
|
|
void (*startHandler)(void* ctx);
|
|
void (*stopHandler)(void* ctx);
|
|
void (*tuneHandler)(double freq, void* ctx);
|
|
void* ctx;
|
|
};
|
|
|
|
void registerSource(std::string name, SourceHandler* handler);
|
|
void unregisterSource(std::string name);
|
|
void selectSource(std::string name);
|
|
void showSelectedMenu();
|
|
void start();
|
|
void stop();
|
|
void tune(double freq);
|
|
void setTuningOffset(double offset);
|
|
|
|
std::vector<std::string> getSourceNames();
|
|
|
|
Event<std::string> onSourceRegistered;
|
|
Event<std::string> onSourceUnregister;
|
|
Event<std::string> onSourceUnregistered;
|
|
|
|
private:
|
|
std::map<std::string, SourceHandler*> sources;
|
|
std::string selectedName;
|
|
SourceHandler* selectedHandler = NULL;
|
|
double tuneOffset;
|
|
double currentFreq;
|
|
dsp::stream<dsp::complex_t> nullSource;
|
|
|
|
}; |