Files
Radio/module/radio/BackEnd/BackEnd.h
T
2026-08-02 00:06:33 +08:00

59 lines
1.4 KiB
C++

#ifndef Back_End_H
#define Back_End_H
#include <QObject>
#include <QTimer>
#include <QKeyEvent>
#include <QThread>
#include <cstdint>
#include <map>
class Back_End : public QObject {
Q_OBJECT
public:
std::map<QString, Qt::Key> function_map;
bool match(QKeyEvent* e, const QString& function);
static Back_End* instance();
int YsGetAfGain();
void YsSetAfGain(int value);
int YsGetRfGain();
void YsSetRfGain(int value);
qint64 YsGetFreq();
void YsSetFreq(quint64 value);
void YsReceiveFreq(quint64 freq);
void play(const QString& fileName);
QString get_screenshot_save_dir_path();
QString get_screenshot_save_file_name();
QString get_audio_file_location();
void stop_mock_thread() {
++mock_generation;
if (mock_timer) {
mock_timer->stop();
mock_timer->disconnect(this);
mock_timer->deleteLater();
mock_timer = nullptr;
}
if (mock_thread) {
mock_thread->quit();
mock_thread->wait();
mock_thread = nullptr;
}
}
Back_End(const Back_End&) = delete;
Back_End& operator=(const Back_End&) = delete;
void call_back_data_func(int channel, void *pData, int i_length);
protected:
Back_End();
~Back_End() override {
stop_mock_thread();
}
QTimer* mock_timer{};
std::uint64_t mock_generation{};
QThread* mock_thread{};
};
#endif