90 lines
2.0 KiB
C++
90 lines
2.0 KiB
C++
#ifndef PLANTSUNCAT_DLL_GLOBAL_H
|
|
#define PLANTSUNCAT_DLL_GLOBAL_H
|
|
#include "main.h"
|
|
#include <chrono>
|
|
#include <csignal>
|
|
#include <cstring>
|
|
#include <fstream>
|
|
#include <functional>
|
|
#include <iostream>
|
|
#include <random>
|
|
#include <sstream>
|
|
#include <stack>
|
|
#include <string>
|
|
#include <thread>
|
|
#include <vector>
|
|
|
|
#include "../Local_Server/DSP/global.h"
|
|
#include "Core/Base/JSON.h"
|
|
#include "Core/Base/ThreadManager.h"
|
|
#include "Core/Base/global_include.h"
|
|
#include "Core/Shared_Memory/Shared_Memory.h"
|
|
#include "Core/spdlog/export.h"
|
|
#include "Core/system/export.h"
|
|
|
|
namespace Psc {
|
|
class SM_RingBuffer;
|
|
}
|
|
using namespace Psc;
|
|
|
|
struct Memory_Buffer {
|
|
std::vector<std::string *> get_all() {
|
|
std::lock_guard lock(m);
|
|
std::swap(cache, data_list);
|
|
return data_list;
|
|
}
|
|
void push(void *pdata, uint64_t length) {
|
|
auto buf = pool.get();
|
|
buf->resize(length);
|
|
std::memcpy(buf->data(), pdata, length);
|
|
{
|
|
std::lock_guard lock(m);
|
|
cache.push_back(buf);
|
|
}
|
|
}
|
|
String_Pool pool = String_Pool(2112, 8 * 1024);
|
|
|
|
protected:
|
|
std::vector<std::string *> data;
|
|
std::vector<std::string *> cache;
|
|
std::vector<std::string *> data_list;
|
|
Psc::Spin_Lock m;
|
|
};
|
|
|
|
struct BB : Base_DSP {
|
|
BB() {}
|
|
};
|
|
#define freq 0.1
|
|
|
|
struct Dll_Global : BB, public Singleton<Dll_Global> {
|
|
SM_RingBuffer *rb{};
|
|
SM_RingBuffer *json_func_call{};
|
|
SM_RingBuffer *mode_acs{};
|
|
// Pure_Share_Memory psm = Pure_Share_Memory("fft_data", 65536);
|
|
std::uint8_t *psm;
|
|
|
|
Memory_Buffer iq_memory_buffer;
|
|
Detach_Thread_Manager dtm;
|
|
adsb_set_iq_cbk_t set_iq_cbk;
|
|
adsb_set_less_30Mhz_ddc_param_t set_less_30Mhz_ddc_param;
|
|
adsb_set_less_30Mhz_fft_param_t set_less_30Mhz_fft_param;
|
|
static std::string get_config_path();
|
|
void init_when_exe();
|
|
void init_when_dll();
|
|
Dll_Global();
|
|
~Dll_Global();
|
|
|
|
void save();
|
|
void handle_json_call();
|
|
iq_cbk_t recv_cbk{};
|
|
void *puser{};
|
|
void give_call_back(std::uint8_t *data, size_t len);
|
|
|
|
void handle_2112(void *data);
|
|
void handle_2112_pure(void *data);
|
|
|
|
void handle_2112_test(void *data);
|
|
};
|
|
|
|
#endif
|