重新设置代码格式
This commit is contained in:
+185
-200
@@ -5,262 +5,247 @@
|
||||
|
||||
Dll_Global *dg = new Dll_Global();
|
||||
|
||||
std::string Dll_Global::get_config_path() { return get_exe_dir() + "/" + "data_progress_config.json"; }
|
||||
std::string Dll_Global::get_config_path() {
|
||||
return get_exe_dir() + "/" + "data_progress_config.json";
|
||||
}
|
||||
|
||||
void Dll_Global::init_when_exe() {
|
||||
rb = new SM_RingBuffer;
|
||||
rb->init("rb", 2112 * 1000);
|
||||
json_func_call = new SM_RingBuffer;
|
||||
json_func_call->init("json_func_call2", 1000);
|
||||
mode_acs = new SM_RingBuffer;
|
||||
mode_acs->init("mode_acs", 2112 * 1000);
|
||||
rb = new SM_RingBuffer;
|
||||
rb->init("rb", 2112 * 1000);
|
||||
json_func_call = new SM_RingBuffer;
|
||||
json_func_call->init("json_func_call2", 1000);
|
||||
mode_acs = new SM_RingBuffer;
|
||||
mode_acs->init("mode_acs", 2112 * 1000);
|
||||
|
||||
|
||||
void* lib;
|
||||
{
|
||||
auto r = try_load_library(Psc::get_abs_path(library_path));
|
||||
if (!r) {
|
||||
Psc::fail_fast();
|
||||
}
|
||||
lib = r.value();
|
||||
void *lib;
|
||||
{
|
||||
auto r = try_load_library(Psc::get_abs_path(library_path));
|
||||
if (!r) {
|
||||
Psc::fail_fast();
|
||||
}
|
||||
lib = r.value();
|
||||
}
|
||||
|
||||
{
|
||||
auto r = Psc::try_load_function(lib, "adsb_set_iq_cbk");
|
||||
if (!r) {
|
||||
Psc::fail_fast();
|
||||
}
|
||||
set_iq_cbk = (adsb_set_iq_cbk_t)r.value();
|
||||
{
|
||||
auto r = Psc::try_load_function(lib, "adsb_set_iq_cbk");
|
||||
if (!r) {
|
||||
Psc::fail_fast();
|
||||
}
|
||||
{
|
||||
auto r = Psc::try_load_function(lib, "adsb_set_less_30Mhz_ddc_param");
|
||||
if (!r) {
|
||||
Psc::fail_fast();
|
||||
}
|
||||
set_less_30Mhz_ddc_param = (adsb_set_less_30Mhz_ddc_param_t)r.value();
|
||||
set_iq_cbk = (adsb_set_iq_cbk_t)r.value();
|
||||
}
|
||||
{
|
||||
auto r = Psc::try_load_function(lib, "adsb_set_less_30Mhz_ddc_param");
|
||||
if (!r) {
|
||||
Psc::fail_fast();
|
||||
}
|
||||
{
|
||||
auto r = Psc::try_load_function(lib, "adsb_set_less_30Mhz_fft_param");
|
||||
if (!r) {
|
||||
Psc::fail_fast();
|
||||
}
|
||||
set_less_30Mhz_fft_param = (adsb_set_less_30Mhz_fft_param_t)r.value();
|
||||
set_less_30Mhz_ddc_param = (adsb_set_less_30Mhz_ddc_param_t)r.value();
|
||||
}
|
||||
{
|
||||
auto r = Psc::try_load_function(lib, "adsb_set_less_30Mhz_fft_param");
|
||||
if (!r) {
|
||||
Psc::fail_fast();
|
||||
}
|
||||
set_less_30Mhz_fft_param = (adsb_set_less_30Mhz_fft_param_t)r.value();
|
||||
}
|
||||
|
||||
std::cout << "set_less_30Mhz_ddc_param "
|
||||
<< VAR_STR_3(center_freq, sample_rate, band_width) << std::endl;
|
||||
set_less_30Mhz_ddc_param(center_freq, sample_rate, band_width, 1);
|
||||
std::cout << "set_less_30Mhz_fft_param "
|
||||
<< VAR_STR_3(center_freq, sample_rate, band_width) << std::endl;
|
||||
set_less_30Mhz_fft_param(fft_win_type, fft_point_number, fft_period_ms, 1);
|
||||
std::cout << "set_iq_cbk " << std::endl;
|
||||
set_iq_cbk(
|
||||
[](void *phandle, void *pdata, uint64_t length) {
|
||||
if (length != 2112) {
|
||||
std::cout << LOG_POS << " IQ回调传入的长度不对!" << std::endl;
|
||||
return;
|
||||
}
|
||||
auto dg = (Dll_Global *)phandle;
|
||||
//
|
||||
dg->handle_2112(pdata);
|
||||
|
||||
// auto sk = (UHD_Struct_KFFT *) pdata;
|
||||
// std::cout << (int)sk->DataType << std::endl;
|
||||
|
||||
std::cout << "set_less_30Mhz_ddc_param " << VAR_STR_3(center_freq, sample_rate, band_width) << std::endl;
|
||||
set_less_30Mhz_ddc_param(center_freq, sample_rate, band_width, 1);
|
||||
std::cout << "set_less_30Mhz_fft_param " << VAR_STR_3(center_freq, sample_rate, band_width) << std::endl;
|
||||
set_less_30Mhz_fft_param(fft_win_type, fft_point_number, fft_period_ms, 1);
|
||||
std::cout << "set_iq_cbk " << std::endl;
|
||||
set_iq_cbk(
|
||||
[](void *phandle, void *pdata, uint64_t length) {
|
||||
if (length != 2112) {
|
||||
std::cout << LOG_POS << " IQ回调传入的长度不对!" << std::endl;
|
||||
return;
|
||||
}
|
||||
auto dg = (Dll_Global *) phandle;
|
||||
//
|
||||
dg->handle_2112(pdata);
|
||||
|
||||
// auto sk = (UHD_Struct_KFFT *) pdata;
|
||||
// std::cout << (int)sk->DataType << std::endl;
|
||||
|
||||
//dg->iq_memory_buffer.push(pdata, length); // length 永远等于2112
|
||||
},
|
||||
this);
|
||||
// dg->iq_memory_buffer.push(pdata, length); // length 永远等于2112
|
||||
},
|
||||
this);
|
||||
}
|
||||
void Dll_Global::init_when_dll() {
|
||||
|
||||
Detach_Thread_Manager &manager = dtm;
|
||||
Detach_Thread_Manager &manager = dtm;
|
||||
|
||||
manager.test_and_start_thread("Dll_Global", [&](std::atomic<bool>& run) {
|
||||
std::mt19937 rng(std::random_device{}()); // 随机数引擎
|
||||
std::uniform_int_distribution<uint16_t> dist(0 * 256, 70 * 256);
|
||||
constexpr int size = 64 + 1024 * sizeof(uint16_t);
|
||||
uint8_t buf[size];
|
||||
manager.test_and_start_thread("Dll_Global", [&](std::atomic<bool> &run) {
|
||||
std::mt19937 rng(std::random_device{}()); // 随机数引擎
|
||||
std::uniform_int_distribution<uint16_t> dist(0 * 256, 70 * 256);
|
||||
constexpr int size = 64 + 1024 * sizeof(uint16_t);
|
||||
uint8_t buf[size];
|
||||
|
||||
while (run) {
|
||||
int fn = fft_point_number / 1024;
|
||||
auto sk = (UHD_Struct_KFFT *) buf;
|
||||
while (run) {
|
||||
int fn = fft_point_number / 1024;
|
||||
auto sk = (UHD_Struct_KFFT *)buf;
|
||||
|
||||
uint16_t *fft = (uint16_t *)(buf + 64);
|
||||
for (int fi = 0; fi < fn; fi++) {
|
||||
sk->DataType = kd_fft;
|
||||
sk->Param.FFT.SubFrame = fi;
|
||||
for (int i = 0; i < 1024; ++i) {
|
||||
fft[i] = dist(rng);
|
||||
}
|
||||
give_call_back(buf, size);
|
||||
}
|
||||
|
||||
uint16_t *fft = (uint16_t *) (buf + 64);
|
||||
for (int fi = 0; fi < fn; fi++) {
|
||||
sk->DataType = kd_fft;
|
||||
sk->Param.FFT.SubFrame = fi;
|
||||
for (int i = 0; i < 1024; ++i) {
|
||||
fft[i] = dist(rng);
|
||||
}
|
||||
give_call_back(buf, size);
|
||||
}
|
||||
uint64_t sleep_ms = fft_period_ms;
|
||||
uint64_t num = sample_rate / sleep_ms;
|
||||
uint64_t times = num / 2048;
|
||||
if (times < 1) {
|
||||
times = 1;
|
||||
}
|
||||
|
||||
sk->DataType = zd_ddc;
|
||||
uint16_t *iq = (uint16_t *)(buf + 64);
|
||||
for (int i = 0; i < 1024; ++i) {
|
||||
auto random = dist(rng);
|
||||
iq[i] = random;
|
||||
}
|
||||
|
||||
|
||||
uint64_t sleep_ms = fft_period_ms;
|
||||
uint64_t num = sample_rate / sleep_ms;
|
||||
uint64_t times = num / 2048;
|
||||
if (times < 1) {
|
||||
times = 1;
|
||||
}
|
||||
|
||||
sk->DataType = zd_ddc;
|
||||
uint16_t *iq = (uint16_t *) (buf + 64);
|
||||
for (int i = 0; i < 1024; ++i) {
|
||||
auto random = dist(rng);
|
||||
iq[i] = random;
|
||||
}
|
||||
|
||||
sk->UsefullLen = 2048;
|
||||
for (int i = 0; i < times; ++i) {
|
||||
give_call_back(buf, size);
|
||||
}
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(fft_period_ms));
|
||||
}
|
||||
});
|
||||
|
||||
sk->UsefullLen = 2048;
|
||||
for (int i = 0; i < times; ++i) {
|
||||
give_call_back(buf, size);
|
||||
}
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(fft_period_ms));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
Dll_Global::Dll_Global() {
|
||||
auto config = try_parse_json_file(get_config_path());
|
||||
if (!config.has_value()) {
|
||||
std::cout << "Dll_Global 配置文件加载失败!" << std::endl;
|
||||
Psc::fail_fast();
|
||||
}
|
||||
load(&config.value());
|
||||
psm = new std::uint8_t[65536 * 2];
|
||||
}
|
||||
|
||||
Dll_Global::~Dll_Global() {
|
||||
|
||||
|
||||
delete psm;
|
||||
|
||||
|
||||
|
||||
auto config = try_parse_json_file(get_config_path());
|
||||
if (!config.has_value()) {
|
||||
std::cout << "Dll_Global 配置文件加载失败!" << std::endl;
|
||||
Psc::fail_fast();
|
||||
}
|
||||
load(&config.value());
|
||||
psm = new std::uint8_t[65536 * 2];
|
||||
}
|
||||
|
||||
Dll_Global::~Dll_Global() { delete psm; }
|
||||
|
||||
void adsb_close() {
|
||||
std::cout << " adsb_close()" << std::endl;
|
||||
Dll_Global::instance()->dtm.stop_all_thread();
|
||||
|
||||
std::cout << " adsb_close()" << std::endl;
|
||||
Dll_Global::instance()->dtm.stop_all_thread();
|
||||
}
|
||||
|
||||
|
||||
|
||||
void Dll_Global::save() {
|
||||
std::ofstream config_file;
|
||||
config_file.open(get_config_path());
|
||||
std::string json = to_json().to_json_string();
|
||||
config_file.write(json.c_str(), static_cast<long long>(json.size()));
|
||||
config_file.close();
|
||||
std::ofstream config_file;
|
||||
config_file.open(get_config_path());
|
||||
std::string json = to_json().to_json_string();
|
||||
config_file.write(json.c_str(), static_cast<long long>(json.size()));
|
||||
config_file.close();
|
||||
}
|
||||
|
||||
void Dll_Global::give_call_back(std::uint8_t *data, size_t len) {
|
||||
recv_cbk(puser, data, len);
|
||||
auto sk = (UHD_Struct_KFFT *) data;
|
||||
if (sk->DataType == kd_fft) {
|
||||
auto idx_max = fft_point_number/1024;
|
||||
auto idx = sk->Param.FFT.SubFrame;
|
||||
if (idx >= idx_max) {
|
||||
std::cout << "give_call_back idx 越界" << idx << " >= " << idx_max << std::endl;
|
||||
}
|
||||
recv_cbk(puser, data, len);
|
||||
auto sk = (UHD_Struct_KFFT *)data;
|
||||
if (sk->DataType == kd_fft) {
|
||||
auto idx_max = fft_point_number / 1024;
|
||||
auto idx = sk->Param.FFT.SubFrame;
|
||||
if (idx >= idx_max) {
|
||||
std::cout << "give_call_back idx 越界" << idx << " >= " << idx_max
|
||||
<< std::endl;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
void Dll_Global::handle_2112_test(void *data) {
|
||||
// 记录开始时间
|
||||
auto start = std::chrono::high_resolution_clock::now();
|
||||
// 记录开始时间
|
||||
auto start = std::chrono::high_resolution_clock::now();
|
||||
|
||||
// 调用目标函数
|
||||
handle_2112_pure(data);
|
||||
// 调用目标函数
|
||||
handle_2112_pure(data);
|
||||
|
||||
// 记录结束时间
|
||||
auto end = std::chrono::high_resolution_clock::now();
|
||||
// 记录结束时间
|
||||
auto end = std::chrono::high_resolution_clock::now();
|
||||
|
||||
// 计算持续时间(微秒)
|
||||
auto duration = std::chrono::duration_cast<std::chrono::microseconds>(end - start);
|
||||
// 计算持续时间(微秒)
|
||||
auto duration =
|
||||
std::chrono::duration_cast<std::chrono::microseconds>(end - start);
|
||||
|
||||
// 输出每次调用的时间
|
||||
std::cout << "Average time per call: "
|
||||
<< duration.count() << " microseconds" << std::endl;
|
||||
// 输出每次调用的时间
|
||||
std::cout << "Average time per call: " << duration.count() << " microseconds"
|
||||
<< std::endl;
|
||||
}
|
||||
|
||||
void Dll_Global::handle_2112(void *data) {
|
||||
handle_2112_pure(data);
|
||||
// static Frequency_Limit fl(freq);
|
||||
// if (fl.test()) {
|
||||
// handle_2112_test(data);
|
||||
// } else {
|
||||
// handle_2112_pure(data);
|
||||
// }
|
||||
handle_2112_pure(data);
|
||||
// static Frequency_Limit fl(freq);
|
||||
// if (fl.test()) {
|
||||
// handle_2112_test(data);
|
||||
// } else {
|
||||
// handle_2112_pure(data);
|
||||
// }
|
||||
}
|
||||
|
||||
void Dll_Global::handle_2112_pure(void *data) {
|
||||
auto d = (UHD_Struct_KFFT *) (data);
|
||||
auto pdata = (std::uint8_t*)data + 64;
|
||||
auto idx_max = fft_point_number/1024;
|
||||
auto type = d->DataType;
|
||||
if (type == kd_fft) {
|
||||
auto idx = d->Param.FFT.SubFrame;
|
||||
if (idx >= idx_max) {
|
||||
std::cout << "idx 越界" << idx << " >= " << idx_max << std::endl;
|
||||
} else {
|
||||
memcpy( psm + idx * 2048, pdata, 2048);
|
||||
}
|
||||
}
|
||||
#if WIN32
|
||||
else if (type == kd_ddc || type == zd_ddc) {
|
||||
dg->rb->write((uint8_t *) data, 2112);
|
||||
auto d = (UHD_Struct_KFFT *)(data);
|
||||
auto pdata = (std::uint8_t *)data + 64;
|
||||
auto idx_max = fft_point_number / 1024;
|
||||
auto type = d->DataType;
|
||||
if (type == kd_fft) {
|
||||
auto idx = d->Param.FFT.SubFrame;
|
||||
if (idx >= idx_max) {
|
||||
std::cout << "idx 越界" << idx << " >= " << idx_max << std::endl;
|
||||
} else {
|
||||
Psc::fail_fast();
|
||||
memcpy(psm + idx * 2048, pdata, 2048);
|
||||
}
|
||||
}
|
||||
#if WIN32
|
||||
else if (type == kd_ddc || type == zd_ddc) {
|
||||
dg->rb->write((uint8_t *)data, 2112);
|
||||
} else {
|
||||
Psc::fail_fast();
|
||||
}
|
||||
#else
|
||||
else {
|
||||
dg->rb->write((uint8_t *) data, 2112);
|
||||
}
|
||||
else {
|
||||
dg->rb->write((uint8_t *)data, 2112);
|
||||
}
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
|
||||
void Dll_Global::handle_json_call() {
|
||||
size_t length = 0;
|
||||
uint8_t json_func_data[1000];
|
||||
json_func_call->read(json_func_data, length);
|
||||
size_t length = 0;
|
||||
uint8_t json_func_data[1000];
|
||||
json_func_call->read(json_func_data, length);
|
||||
|
||||
std::string json((const char *)json_func_data, length);
|
||||
if (!json.empty()) {
|
||||
auto func_call = Psc::parse_json(json);
|
||||
auto method = func_call.get_string("method");
|
||||
std::cout << func_call.to_json_string() << std::endl;
|
||||
|
||||
std::string json((const char *) json_func_data, length);
|
||||
if (!json.empty()) {
|
||||
auto func_call = Psc::parse_json(json);
|
||||
auto method = func_call.get_string("method");
|
||||
std::cout << func_call.to_json_string() << std::endl;
|
||||
|
||||
if (method == "adsb_set_less_30Mhz_ddc_param") {
|
||||
center_freq = func_call.get_number<double>("center_freq");
|
||||
sample_rate = func_call.get_number<double>("sample_rate");
|
||||
band_width = func_call.get_number<double>("band_width");
|
||||
auto sw = func_call.get_number<int>("sw");
|
||||
save();
|
||||
set_less_30Mhz_ddc_param(center_freq, sample_rate, band_width, sw);
|
||||
}
|
||||
|
||||
if (method == "adsb_set_less_30Mhz_fft_param") {
|
||||
fft_win_type = (UHD_FFTWin) func_call.get_number<int>("fft_win_type");
|
||||
fft_point_number = func_call.get_number<int>("fft_point_number");
|
||||
fft_period_ms = func_call.get_number<int>("fft_period_ms");
|
||||
auto sw = func_call.get_number<int>("sw");
|
||||
save();
|
||||
set_less_30Mhz_fft_param(fft_win_type, fft_point_number, fft_period_ms, sw);
|
||||
}
|
||||
|
||||
if (method == "restart_device") {
|
||||
std::cout << "关闭进程, 然后会被守护进程拉起来" << std::endl;
|
||||
stop_program = true;
|
||||
}
|
||||
if (method == "adsb_set_less_30Mhz_ddc_param") {
|
||||
center_freq = func_call.get_number<double>("center_freq");
|
||||
sample_rate = func_call.get_number<double>("sample_rate");
|
||||
band_width = func_call.get_number<double>("band_width");
|
||||
auto sw = func_call.get_number<int>("sw");
|
||||
save();
|
||||
set_less_30Mhz_ddc_param(center_freq, sample_rate, band_width, sw);
|
||||
}
|
||||
|
||||
if (method == "adsb_set_less_30Mhz_fft_param") {
|
||||
fft_win_type = (UHD_FFTWin)func_call.get_number<int>("fft_win_type");
|
||||
fft_point_number = func_call.get_number<int>("fft_point_number");
|
||||
fft_period_ms = func_call.get_number<int>("fft_period_ms");
|
||||
auto sw = func_call.get_number<int>("sw");
|
||||
save();
|
||||
set_less_30Mhz_fft_param(fft_win_type, fft_point_number, fft_period_ms,
|
||||
sw);
|
||||
}
|
||||
|
||||
if (method == "restart_device") {
|
||||
std::cout << "关闭进程, 然后会被守护进程拉起来" << std::endl;
|
||||
stop_program = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
void set_error_cbk(error_cbk_t cbk) {}
|
||||
|
||||
@@ -14,81 +14,76 @@
|
||||
#include <thread>
|
||||
#include <vector>
|
||||
|
||||
#include "Core/Base/global_include.h"
|
||||
#include "Core/Shared_Memory/Shared_Memory.h"
|
||||
#include "Core/system/export.h"
|
||||
#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;
|
||||
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);
|
||||
}
|
||||
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);
|
||||
}
|
||||
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;
|
||||
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() {
|
||||
|
||||
}
|
||||
BB() {}
|
||||
};
|
||||
#define freq 0.1
|
||||
#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;
|
||||
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();
|
||||
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 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(void *data);
|
||||
void handle_2112_pure(void *data);
|
||||
|
||||
void handle_2112_test(void* data);
|
||||
void handle_2112_test(void *data);
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,98 +1,109 @@
|
||||
#ifndef _DEVICE_UHD_C_H_
|
||||
#define _DEVICE_UHD_C_H_
|
||||
|
||||
|
||||
#include "device_uhd_struct.h"
|
||||
// #include "device_uhd_cpp.h"
|
||||
#include <stdint.h>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
typedef void (*rx_data_cbk_t)(int channel, void *pdata, int length);
|
||||
|
||||
extern "C"
|
||||
{
|
||||
int32_t ex_declare init9002(void **phandle);
|
||||
int32_t ex_declare free9002(void **phandle);
|
||||
int32_t ex_declare isDevOpened(void *phandle, int32_t *result);
|
||||
// int32_t ex_declare findDevices(void *phandle, uhd::device_addrs_t *addrs);
|
||||
// int32_t ex_declare openDevice(void *phandle,uhd::device_addr_t addr);
|
||||
int32_t ex_declare closeDevice(void *phandle);
|
||||
int32_t ex_declare findDevInfos(void *phandle, char infos[1000]);
|
||||
int32_t ex_declare findDevInfos2(void *phandle, char infos[1000]);
|
||||
int32_t ex_declare getDevTree(void *phandle, char tree_infos[1000]);
|
||||
int32_t ex_declare setDevClockSource(void *phandle, char sourceStr[1000]);
|
||||
int32_t ex_declare getDevClockSource(void *phandle, char sourceStr[1000]);
|
||||
int32_t ex_declare setDevInClock(void *phandle, double clockFreq);
|
||||
int32_t ex_declare getDevInClockRange(void *phandle, double *min, double *max);
|
||||
int32_t ex_declare getDevInClock(void *phandle, double *val);
|
||||
int32_t ex_declare getDevRXChCount(void *phandle, size_t *val);
|
||||
int32_t ex_declare getDevTXChCount(void *phandle, size_t *val);
|
||||
int32_t ex_declare setDevParam(void *phandle, char chStr[50], UHD_ParamType paramType, double paramValue);
|
||||
int32_t ex_declare getDevParam(void *phandle, char chStr[50], UHD_ParamType paramType,double *paramValue);
|
||||
int32_t ex_declare getDevParamMin(void *phandle, double *val);
|
||||
int32_t ex_declare getDevParamMax(void *phandle, double *val);
|
||||
int32_t ex_declare setAllAntenna(void *phandle, int32_t *result);
|
||||
int32_t ex_declare setDevDDCParam_Any(void *phandle, char chStr[50], unsigned int jcqOffset, unsigned int jcqData);
|
||||
int32_t ex_declare getDevDDCParam_Any(void *phandle, char chStr[50], unsigned int jcqOffset, unsigned int *jcqData);
|
||||
int32_t ex_declare setDevDataSwitch(void *phandle, char chStr[50], UHD_ParamType dataType, unsigned char ZDCh, int bSwitch);
|
||||
int32_t ex_declare getDevDataSwitch(void *phandle, char chStr[50], UHD_ParamType dataType, unsigned char ZDCh, int *bSwitch);
|
||||
int32_t ex_declare setDevZDParam(void *phandle, char chStr[50], unsigned char ZDCh, long long centerfreq, int bw, int sample);
|
||||
int32_t ex_declare getDevZDParam(void *phandle, char chStr[50], unsigned char ZDCh, long long *centerfreq, int *bw, int *sample);
|
||||
int32_t ex_declare getDevZDCenterRange(void *phandle, char chStr[50], long long &min, long long &max);
|
||||
int32_t ex_declare getDevZDBandWidthRange(void *phandle, char chStr[50], int &min, int &max);
|
||||
int32_t ex_declare getDevZDSampleFreqRange(void *phandle, char chStr[50], int arr[13], int *valid_len);
|
||||
int32_t ex_declare setDevFFTParam(void *phandle, UHD_FFTWin fftWin, UHD_FFTLen fftLen, int fftPeriod_ms);
|
||||
int32_t ex_declare getDevFFTParam(void *phandle, UHD_FFTWin *fftWin, UHD_FFTLen *fftLen, int *fftPeriod_ms);
|
||||
int32_t ex_declare getDevRecvSpeed(void *phandle, int channel, double *val);
|
||||
int32_t ex_declare isDevRecving(void *phandle,int channel, int32_t *result);
|
||||
int32_t ex_declare startDevRecv(void *phandle, int channel, rx_data_cbk_t rx_cbk);
|
||||
int32_t ex_declare stopDevRecv(void *phandle, int channel);
|
||||
int32_t ex_declare getDevSendSpeed(void *phandle, int channel, double *val);
|
||||
int32_t ex_declare isDevSending(void *phandle, int channel, int32_t *rusult);
|
||||
int32_t ex_declare startDevSend(void *phandle, int channel, unsigned long long send_cf, unsigned long long data_sf, char *filename, int bwhile);
|
||||
int32_t ex_declare stopDevSend(void *phandle, int channel);
|
||||
int32_t ex_declare getGPSInfo(void *phandle, char gps_info[50]);
|
||||
int32_t ex_declare setLedEnable(void *phandle, int led_num, int bEnable);
|
||||
int32_t ex_declare getLedEnable(void *phandle,int led_num, int *bEnable);
|
||||
extern "C" {
|
||||
int32_t ex_declare init9002(void **phandle);
|
||||
int32_t ex_declare free9002(void **phandle);
|
||||
int32_t ex_declare isDevOpened(void *phandle, int32_t *result);
|
||||
// int32_t ex_declare findDevices(void *phandle, uhd::device_addrs_t *addrs);
|
||||
// int32_t ex_declare openDevice(void *phandle,uhd::device_addr_t addr);
|
||||
int32_t ex_declare closeDevice(void *phandle);
|
||||
int32_t ex_declare findDevInfos(void *phandle, char infos[1000]);
|
||||
int32_t ex_declare findDevInfos2(void *phandle, char infos[1000]);
|
||||
int32_t ex_declare getDevTree(void *phandle, char tree_infos[1000]);
|
||||
int32_t ex_declare setDevClockSource(void *phandle, char sourceStr[1000]);
|
||||
int32_t ex_declare getDevClockSource(void *phandle, char sourceStr[1000]);
|
||||
int32_t ex_declare setDevInClock(void *phandle, double clockFreq);
|
||||
int32_t ex_declare getDevInClockRange(void *phandle, double *min, double *max);
|
||||
int32_t ex_declare getDevInClock(void *phandle, double *val);
|
||||
int32_t ex_declare getDevRXChCount(void *phandle, size_t *val);
|
||||
int32_t ex_declare getDevTXChCount(void *phandle, size_t *val);
|
||||
int32_t ex_declare setDevParam(void *phandle, char chStr[50],
|
||||
UHD_ParamType paramType, double paramValue);
|
||||
int32_t ex_declare getDevParam(void *phandle, char chStr[50],
|
||||
UHD_ParamType paramType, double *paramValue);
|
||||
int32_t ex_declare getDevParamMin(void *phandle, double *val);
|
||||
int32_t ex_declare getDevParamMax(void *phandle, double *val);
|
||||
int32_t ex_declare setAllAntenna(void *phandle, int32_t *result);
|
||||
int32_t ex_declare setDevDDCParam_Any(void *phandle, char chStr[50],
|
||||
unsigned int jcqOffset,
|
||||
unsigned int jcqData);
|
||||
int32_t ex_declare getDevDDCParam_Any(void *phandle, char chStr[50],
|
||||
unsigned int jcqOffset,
|
||||
unsigned int *jcqData);
|
||||
int32_t ex_declare setDevDataSwitch(void *phandle, char chStr[50],
|
||||
UHD_ParamType dataType, unsigned char ZDCh,
|
||||
int bSwitch);
|
||||
int32_t ex_declare getDevDataSwitch(void *phandle, char chStr[50],
|
||||
UHD_ParamType dataType, unsigned char ZDCh,
|
||||
int *bSwitch);
|
||||
int32_t ex_declare setDevZDParam(void *phandle, char chStr[50],
|
||||
unsigned char ZDCh, long long centerfreq,
|
||||
int bw, int sample);
|
||||
int32_t ex_declare getDevZDParam(void *phandle, char chStr[50],
|
||||
unsigned char ZDCh, long long *centerfreq,
|
||||
int *bw, int *sample);
|
||||
int32_t ex_declare getDevZDCenterRange(void *phandle, char chStr[50],
|
||||
long long &min, long long &max);
|
||||
int32_t ex_declare getDevZDBandWidthRange(void *phandle, char chStr[50],
|
||||
int &min, int &max);
|
||||
int32_t ex_declare getDevZDSampleFreqRange(void *phandle, char chStr[50],
|
||||
int arr[13], int *valid_len);
|
||||
int32_t ex_declare setDevFFTParam(void *phandle, UHD_FFTWin fftWin,
|
||||
UHD_FFTLen fftLen, int fftPeriod_ms);
|
||||
int32_t ex_declare getDevFFTParam(void *phandle, UHD_FFTWin *fftWin,
|
||||
UHD_FFTLen *fftLen, int *fftPeriod_ms);
|
||||
int32_t ex_declare getDevRecvSpeed(void *phandle, int channel, double *val);
|
||||
int32_t ex_declare isDevRecving(void *phandle, int channel, int32_t *result);
|
||||
int32_t ex_declare startDevRecv(void *phandle, int channel,
|
||||
rx_data_cbk_t rx_cbk);
|
||||
int32_t ex_declare stopDevRecv(void *phandle, int channel);
|
||||
int32_t ex_declare getDevSendSpeed(void *phandle, int channel, double *val);
|
||||
int32_t ex_declare isDevSending(void *phandle, int channel, int32_t *rusult);
|
||||
int32_t ex_declare startDevSend(void *phandle, int channel,
|
||||
unsigned long long send_cf,
|
||||
unsigned long long data_sf, char *filename,
|
||||
int bwhile);
|
||||
int32_t ex_declare stopDevSend(void *phandle, int channel);
|
||||
int32_t ex_declare getGPSInfo(void *phandle, char gps_info[50]);
|
||||
int32_t ex_declare setLedEnable(void *phandle, int led_num, int bEnable);
|
||||
int32_t ex_declare getLedEnable(void *phandle, int led_num, int *bEnable);
|
||||
|
||||
typedef void (*adsb_msg_cbk_t)(void *pusr, char *pmsg, int msglen);
|
||||
|
||||
|
||||
|
||||
typedef void(*adsb_msg_cbk_t)(void *pusr,char *pmsg,int msglen);
|
||||
int32_t ex_declare init_adsb9002(void **phandle, adsb_msg_cbk_t cbk,
|
||||
void *pusr);
|
||||
int32_t ex_declare free_adsb9002(void **phandle);
|
||||
|
||||
int32_t ex_declare init_adsb9002(void **phandle,adsb_msg_cbk_t cbk,void *pusr);
|
||||
int32_t ex_declare free_adsb9002(void **phandle);
|
||||
|
||||
|
||||
|
||||
// 新接口 :时间 20251107 ,
|
||||
//TODO: 1 增加 dma 回调函数 iq 的(ddc,ffc)
|
||||
// 新接口 :时间 20251107 ,
|
||||
// TODO: 1 增加 dma 回调函数 iq 的(ddc,ffc)
|
||||
}
|
||||
|
||||
#include <string>
|
||||
#include "device_uhd_c.h"
|
||||
#include <string>
|
||||
#include <mutex>
|
||||
#include <string>
|
||||
|
||||
extern "C" {
|
||||
|
||||
extern "C"
|
||||
{
|
||||
ex_declare void adsb_close();
|
||||
|
||||
typedef void (*iq_cbk_t)(void *phandle, void *pdata, uint64_t length);
|
||||
|
||||
ex_declare void adsb_close();
|
||||
|
||||
typedef void (*iq_cbk_t)(void* phandle, void* pdata, uint64_t length);
|
||||
|
||||
typedef int (*adsb_set_less_30Mhz_ddc_param_t)(uint64_t cf_hz, uint64_t sf_hz, uint64_t bw_hz, int8_t sw);
|
||||
typedef int (*adsb_set_less_30Mhz_fft_param_t)(uint64_t fftWin, uint64_t fftLen, int fftPeriod_ms, int8_t sw);
|
||||
ex_declare int adsb_set_iq_cbk(iq_cbk_t recv_cbk, void* pusr);
|
||||
ex_declare int adsb_set_less_30Mhz_ddc_param(uint64_t cf_hz, uint64_t sf_hz, uint64_t bw_hz, int8_t sw);
|
||||
ex_declare int adsb_set_less_30Mhz_fft_param(uint64_t fftWin, uint64_t fftLen, int fftPeriod_ms, int8_t sw);
|
||||
|
||||
typedef int (*adsb_set_less_30Mhz_ddc_param_t)(uint64_t cf_hz, uint64_t sf_hz,
|
||||
uint64_t bw_hz, int8_t sw);
|
||||
typedef int (*adsb_set_less_30Mhz_fft_param_t)(uint64_t fftWin, uint64_t fftLen,
|
||||
int fftPeriod_ms, int8_t sw);
|
||||
ex_declare int adsb_set_iq_cbk(iq_cbk_t recv_cbk, void *pusr);
|
||||
ex_declare int adsb_set_less_30Mhz_ddc_param(uint64_t cf_hz, uint64_t sf_hz,
|
||||
uint64_t bw_hz, int8_t sw);
|
||||
ex_declare int adsb_set_less_30Mhz_fft_param(uint64_t fftWin, uint64_t fftLen,
|
||||
int fftPeriod_ms, int8_t sw);
|
||||
}
|
||||
|
||||
|
||||
#endif //_DEVICE_UHD_C_H_
|
||||
@@ -1,168 +1,150 @@
|
||||
#ifndef device_uhd_struct_h
|
||||
#define device_uhd_struct_h
|
||||
|
||||
#include <vector>
|
||||
#include <memory>
|
||||
#include <iostream>
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
|
||||
|
||||
#define ZDSamSum 200000000//8路窄带采样率之和
|
||||
#define ZDChMax 8 //每路大通道下窄带通道总数
|
||||
enum UHD_ParamType : int
|
||||
{
|
||||
CenterFreq = 0,
|
||||
BandWidth = 1,
|
||||
SampleFreq = 2,
|
||||
Gain = 3,
|
||||
PowerRef = 4,
|
||||
KDDCSwitch = 5,
|
||||
KFFTSwitch = 6,
|
||||
ZDDCSwitch = 7,
|
||||
ZDDCParam = 8,
|
||||
KFFTParam = 9,
|
||||
ClockSource = 10,
|
||||
SnapshotSwitch = 11,
|
||||
Snapshot_tm_s = 12,
|
||||
#define ZDSamSum 200000000 // 8路窄带采样率之和
|
||||
#define ZDChMax 8 // 每路大通道下窄带通道总数
|
||||
enum UHD_ParamType : int {
|
||||
CenterFreq = 0,
|
||||
BandWidth = 1,
|
||||
SampleFreq = 2,
|
||||
Gain = 3,
|
||||
PowerRef = 4,
|
||||
KDDCSwitch = 5,
|
||||
KFFTSwitch = 6,
|
||||
ZDDCSwitch = 7,
|
||||
ZDDCParam = 8,
|
||||
KFFTParam = 9,
|
||||
ClockSource = 10,
|
||||
SnapshotSwitch = 11,
|
||||
Snapshot_tm_s = 12,
|
||||
};
|
||||
enum UHD_FFTWin : unsigned char
|
||||
{
|
||||
jxc =0,// 矩形窗 = 0,
|
||||
hnc = 1,// 汉宁窗 = 1,
|
||||
hmc = 2, // 海明窗 = 2,
|
||||
blkmc = 3,// 布莱克曼窗 = 3,
|
||||
enum UHD_FFTWin : unsigned char {
|
||||
jxc = 0, // 矩形窗 = 0,
|
||||
hnc = 1, // 汉宁窗 = 1,
|
||||
hmc = 2, // 海明窗 = 2,
|
||||
blkmc = 3, // 布莱克曼窗 = 3,
|
||||
};
|
||||
enum UHD_FFTLen : unsigned int
|
||||
{
|
||||
_1024 = 1024,
|
||||
_2048 = 2048,
|
||||
_4096 = 4096,
|
||||
_8192 = 8192,
|
||||
_16384 = 16384,
|
||||
_32768 = 32768,
|
||||
enum UHD_FFTLen : unsigned int {
|
||||
_1024 = 1024,
|
||||
_2048 = 2048,
|
||||
_4096 = 4096,
|
||||
_8192 = 8192,
|
||||
_16384 = 16384,
|
||||
_32768 = 32768,
|
||||
};
|
||||
#pragma pack(push)
|
||||
#pragma pack(1)
|
||||
struct UHD_ZDParam
|
||||
{
|
||||
unsigned char KCH = 0;//宽带通道号
|
||||
unsigned short ZCH = 0;//窄带通道号
|
||||
long long CenterFreq = 0; // 中频
|
||||
int BandWidth = 0; //带宽
|
||||
int SampleFreq = 0; // 采样率
|
||||
int ExtraPer = 1024;//抽取率 4-4096,2的指数
|
||||
bool bSwitch_ZDDC = false;
|
||||
|
||||
struct UHD_ZDParam {
|
||||
unsigned char KCH = 0; // 宽带通道号
|
||||
unsigned short ZCH = 0; // 窄带通道号
|
||||
long long CenterFreq = 0; // 中频
|
||||
int BandWidth = 0; // 带宽
|
||||
int SampleFreq = 0; // 采样率
|
||||
int ExtraPer = 1024; // 抽取率 4-4096,2的指数
|
||||
bool bSwitch_ZDDC = false;
|
||||
};
|
||||
struct UHD_KDParam
|
||||
{
|
||||
unsigned char KCH = 0;//宽带通道号
|
||||
long long CenterFreq = 10000000;
|
||||
struct UHD_KDParam {
|
||||
unsigned char KCH = 0; // 宽带通道号
|
||||
long long CenterFreq = 10000000;
|
||||
|
||||
int BandWidth = 160000000;
|
||||
int SampleFreq = 200000000;
|
||||
int BandWidth = 160000000;
|
||||
int SampleFreq = 200000000;
|
||||
|
||||
bool bSwitch_6GCH = false;
|
||||
bool bSwitch_6GCH = false;
|
||||
|
||||
bool bSwitch_KDDC = false;
|
||||
bool bSwitch_KFFT = false;
|
||||
double gain = 0;
|
||||
UHD_ZDParam ZDParam[ZDChMax];
|
||||
int ExtraPer;
|
||||
bool Snapshot_Switch=false;
|
||||
int Snapshot_tm_s = 0;
|
||||
|
||||
unsigned long long old_sf;
|
||||
unsigned long long old_cf;
|
||||
unsigned long long old_bw;
|
||||
bool bSwitch_KDDC = false;
|
||||
bool bSwitch_KFFT = false;
|
||||
double gain = 0;
|
||||
UHD_ZDParam ZDParam[ZDChMax];
|
||||
int ExtraPer;
|
||||
bool Snapshot_Switch = false;
|
||||
int Snapshot_tm_s = 0;
|
||||
|
||||
unsigned long long old_sf;
|
||||
unsigned long long old_cf;
|
||||
unsigned long long old_bw;
|
||||
};
|
||||
#pragma region 枚举/结构体
|
||||
|
||||
/** @brief TODO: 时码类型枚举
|
||||
* @enum LibWZ57_Enum_TimeType
|
||||
*/
|
||||
enum Enum_TimeType : uint8_t
|
||||
{
|
||||
Enum_TimeType_Invlid = 0, /**< 无效的*/
|
||||
Enum_TimeType_IRIG_B = 1, /**< IRIG-B*/
|
||||
Enum_TimeType_RMC = 2, /**< RMC*/
|
||||
Enum_TimeType_ABSCNTTM = 3, /**< 绝对计数时间*/
|
||||
Enum_TimeType_REFCNTTM = 4, /**< 相对计数时间*/
|
||||
enum Enum_TimeType : uint8_t {
|
||||
Enum_TimeType_Invlid = 0, /**< 无效的*/
|
||||
Enum_TimeType_IRIG_B = 1, /**< IRIG-B*/
|
||||
Enum_TimeType_RMC = 2, /**< RMC*/
|
||||
Enum_TimeType_ABSCNTTM = 3, /**< 绝对计数时间*/
|
||||
Enum_TimeType_REFCNTTM = 4, /**< 相对计数时间*/
|
||||
};
|
||||
typedef struct struct_DateTime
|
||||
{
|
||||
typedef struct struct_DateTime {
|
||||
|
||||
Enum_TimeType TimeType; /**< 10 时码类型*/
|
||||
Enum_TimeType TimeType; /**< 10 时码类型*/
|
||||
|
||||
/** @brief 10个字节的时码信息
|
||||
* @details
|
||||
* 根据 @ref LibWZ57_Enum_TimeType TimeType,对应不同的 联合体
|
||||
*/
|
||||
union TimeInfo
|
||||
{
|
||||
///@brief IRIG-B
|
||||
///@struct IRIGB_Head
|
||||
struct IRIGB_Head
|
||||
{
|
||||
uint8_t Year; /**< 年 字节1*/
|
||||
uint16_t Day; /**< 日 字节2*/
|
||||
uint8_t Hour; /**< 时 字节1*/
|
||||
uint8_t Minute; /**< 分 字节1*/
|
||||
uint8_t Second; /**< 秒 字节1*/
|
||||
uint32_t NanoSec; /**< 纳 字节4*/
|
||||
} IRIGB_Head;
|
||||
/** @brief 10个字节的时码信息
|
||||
* @details
|
||||
* 根据 @ref LibWZ57_Enum_TimeType TimeType,对应不同的 联合体
|
||||
*/
|
||||
union TimeInfo {
|
||||
///@brief IRIG-B
|
||||
///@struct IRIGB_Head
|
||||
struct IRIGB_Head {
|
||||
uint8_t Year; /**< 年 字节1*/
|
||||
uint16_t Day; /**< 日 字节2*/
|
||||
uint8_t Hour; /**< 时 字节1*/
|
||||
uint8_t Minute; /**< 分 字节1*/
|
||||
uint8_t Second; /**< 秒 字节1*/
|
||||
uint32_t NanoSec; /**< 纳 字节4*/
|
||||
} IRIGB_Head;
|
||||
|
||||
///@brief RMC
|
||||
///@struct RMC_Head
|
||||
struct RMC_Head
|
||||
{
|
||||
uint8_t Year; /**< 年 字节1*/
|
||||
uint8_t Month; /**< 月 字节1*/
|
||||
uint8_t Day; /**< 日 字节1*/
|
||||
uint8_t Hour; /**< 时 字节1*/
|
||||
uint8_t Minute; /**< 分 字节1*/
|
||||
uint8_t Second; /**< 秒 字节1*/
|
||||
uint32_t NanoSec; /**< 纳 字节4*/
|
||||
} RMC_Head;
|
||||
///@brief RMC
|
||||
///@struct RMC_Head
|
||||
struct RMC_Head {
|
||||
uint8_t Year; /**< 年 字节1*/
|
||||
uint8_t Month; /**< 月 字节1*/
|
||||
uint8_t Day; /**< 日 字节1*/
|
||||
uint8_t Hour; /**< 时 字节1*/
|
||||
uint8_t Minute; /**< 分 字节1*/
|
||||
uint8_t Second; /**< 秒 字节1*/
|
||||
uint32_t NanoSec; /**< 纳 字节4*/
|
||||
} RMC_Head;
|
||||
|
||||
///@brief 绝对计数时间
|
||||
///@struct ABSCNTTM_Head
|
||||
struct ABSCNTTM_Head
|
||||
{
|
||||
///@brief 秒 字节6; 基准秒计数时间+相对秒计数时间 单位:秒
|
||||
uint8_t Second[6];
|
||||
///@brief 纳秒 字节4;
|
||||
uint32_t NanoSec;
|
||||
} ABSCNTTM_Head;
|
||||
///@brief 绝对计数时间
|
||||
///@struct ABSCNTTM_Head
|
||||
struct ABSCNTTM_Head {
|
||||
///@brief 秒 字节6; 基准秒计数时间+相对秒计数时间 单位:秒
|
||||
uint8_t Second[6];
|
||||
///@brief 纳秒 字节4;
|
||||
uint32_t NanoSec;
|
||||
} ABSCNTTM_Head;
|
||||
|
||||
///@brief 相对计数时间
|
||||
///@struct REFCNTTM_Head
|
||||
struct REFCNTTM_Head
|
||||
{
|
||||
///@brief 秒 字节6; 相对秒计数时间单位:秒
|
||||
uint8_t Second[6];
|
||||
///@brief 纳秒 字节4;
|
||||
uint32_t NanoSec;
|
||||
} REFCNTTM_Head;
|
||||
} TimeInfo;
|
||||
///@brief 相对计数时间
|
||||
///@struct REFCNTTM_Head
|
||||
struct REFCNTTM_Head {
|
||||
///@brief 秒 字节6; 相对秒计数时间单位:秒
|
||||
uint8_t Second[6];
|
||||
///@brief 纳秒 字节4;
|
||||
uint32_t NanoSec;
|
||||
} REFCNTTM_Head;
|
||||
} TimeInfo;
|
||||
|
||||
} struct_DataTime;
|
||||
|
||||
|
||||
|
||||
#pragma region 枚举
|
||||
/*****************************
|
||||
*数据类型
|
||||
*****************************/
|
||||
enum UHD_Enum_DataType : unsigned char
|
||||
{
|
||||
zd_ddc = 1,
|
||||
kd_ddc = 2,
|
||||
kd_fft = 3,
|
||||
GPS_Info = 16,
|
||||
// 窄带DDC = 0x01,
|
||||
// 宽带DDC = 0x02,
|
||||
// 宽带FFT = 0x03,
|
||||
*数据类型
|
||||
*****************************/
|
||||
enum UHD_Enum_DataType : unsigned char {
|
||||
zd_ddc = 1,
|
||||
kd_ddc = 2,
|
||||
kd_fft = 3,
|
||||
GPS_Info = 16,
|
||||
// 窄带DDC = 0x01,
|
||||
// 宽带DDC = 0x02,
|
||||
// 宽带FFT = 0x03,
|
||||
};
|
||||
#pragma endregion
|
||||
#pragma region 结构体
|
||||
@@ -170,87 +152,84 @@ enum UHD_Enum_DataType : unsigned char
|
||||
/// <summary>
|
||||
/// 宽带FFT头
|
||||
/// </summary>
|
||||
typedef struct
|
||||
{
|
||||
/// <summary>
|
||||
/// 帧标识 6 0x2828F628F6F6 固定值
|
||||
/// </summary>
|
||||
unsigned int Head;
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
unsigned short Head2;
|
||||
/// <summary>
|
||||
/// 协议版本 1 0x80
|
||||
/// </summary>
|
||||
unsigned char DealVersion;
|
||||
/// <summary>
|
||||
/// 帧头长度 1 64
|
||||
/// </summary>
|
||||
unsigned char FrameHeadLen;
|
||||
/// <summary>
|
||||
/// 数据长度 2 2048
|
||||
/// </summary>
|
||||
unsigned short DataLen;
|
||||
/// <summary>
|
||||
/// 有效数据长度 2 2048
|
||||
/// </summary>
|
||||
unsigned short UsefullLen;
|
||||
/// <summary>
|
||||
/// 数据类型 1
|
||||
/// </summary>
|
||||
UHD_Enum_DataType DataType;
|
||||
unsigned char Other1;
|
||||
/// <summary>
|
||||
/// 通道号
|
||||
/// </summary>
|
||||
unsigned char Channel;
|
||||
unsigned char Other2;
|
||||
unsigned short ZDChannel;
|
||||
/// <summary>
|
||||
/// 帧计数 2 0 ~ 65535 循环递增
|
||||
/// </summary>
|
||||
unsigned short FrameIndex;
|
||||
/// <summary>
|
||||
/// 帧起止标识 1 0x0
|
||||
/// </summary>
|
||||
unsigned char FrameBeginFlag;
|
||||
struct_DateTime DateTm;
|
||||
/// <summary>
|
||||
/// 采样率 4 单位Hz
|
||||
/// </summary>
|
||||
unsigned int SampleFreq_Hz;
|
||||
/// <summary>
|
||||
/// 带宽 4 单位Hz
|
||||
/// </summary>
|
||||
unsigned int BandWidth_Hz;
|
||||
/// <summary>
|
||||
/// 中心频点 4 单位Hz,低位
|
||||
/// </summary>
|
||||
unsigned int CenterFreq_Hz_Low;
|
||||
/// <summary>
|
||||
/// 中心频点 2 单位Hz,高位
|
||||
/// </summary>
|
||||
unsigned short CenterFreq_Hz_High;
|
||||
union
|
||||
{
|
||||
unsigned char other5[18];
|
||||
struct
|
||||
{
|
||||
unsigned char other4[6];
|
||||
/// <summary>
|
||||
/// FFT长度 65536
|
||||
/// </summary>
|
||||
int FFTPoint;
|
||||
unsigned char other5[2];
|
||||
float other6;
|
||||
/// <summary>
|
||||
/// 段内帧号
|
||||
/// </summary>
|
||||
unsigned short SubFrame;
|
||||
} FFT;
|
||||
} Param;
|
||||
//数据 2048 共1024个数据,1个数据2字节。
|
||||
typedef struct {
|
||||
/// <summary>
|
||||
/// 帧标识 6 0x2828F628F6F6 固定值
|
||||
/// </summary>
|
||||
unsigned int Head;
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
unsigned short Head2;
|
||||
/// <summary>
|
||||
/// 协议版本 1 0x80
|
||||
/// </summary>
|
||||
unsigned char DealVersion;
|
||||
/// <summary>
|
||||
/// 帧头长度 1 64
|
||||
/// </summary>
|
||||
unsigned char FrameHeadLen;
|
||||
/// <summary>
|
||||
/// 数据长度 2 2048
|
||||
/// </summary>
|
||||
unsigned short DataLen;
|
||||
/// <summary>
|
||||
/// 有效数据长度 2 2048
|
||||
/// </summary>
|
||||
unsigned short UsefullLen;
|
||||
/// <summary>
|
||||
/// 数据类型 1
|
||||
/// </summary>
|
||||
UHD_Enum_DataType DataType;
|
||||
unsigned char Other1;
|
||||
/// <summary>
|
||||
/// 通道号
|
||||
/// </summary>
|
||||
unsigned char Channel;
|
||||
unsigned char Other2;
|
||||
unsigned short ZDChannel;
|
||||
/// <summary>
|
||||
/// 帧计数 2 0 ~ 65535 循环递增
|
||||
/// </summary>
|
||||
unsigned short FrameIndex;
|
||||
/// <summary>
|
||||
/// 帧起止标识 1 0x0
|
||||
/// </summary>
|
||||
unsigned char FrameBeginFlag;
|
||||
struct_DateTime DateTm;
|
||||
/// <summary>
|
||||
/// 采样率 4 单位Hz
|
||||
/// </summary>
|
||||
unsigned int SampleFreq_Hz;
|
||||
/// <summary>
|
||||
/// 带宽 4 单位Hz
|
||||
/// </summary>
|
||||
unsigned int BandWidth_Hz;
|
||||
/// <summary>
|
||||
/// 中心频点 4 单位Hz,低位
|
||||
/// </summary>
|
||||
unsigned int CenterFreq_Hz_Low;
|
||||
/// <summary>
|
||||
/// 中心频点 2 单位Hz,高位
|
||||
/// </summary>
|
||||
unsigned short CenterFreq_Hz_High;
|
||||
union {
|
||||
unsigned char other5[18];
|
||||
struct {
|
||||
unsigned char other4[6];
|
||||
/// <summary>
|
||||
/// FFT长度 65536
|
||||
/// </summary>
|
||||
int FFTPoint;
|
||||
unsigned char other5[2];
|
||||
float other6;
|
||||
/// <summary>
|
||||
/// 段内帧号
|
||||
/// </summary>
|
||||
unsigned short SubFrame;
|
||||
} FFT;
|
||||
} Param;
|
||||
// 数据 2048 共1024个数据,1个数据2字节。
|
||||
} UHD_Struct_KFFT, UHD_Struct_KDDC, UHD_Struct_ZDDC;
|
||||
#pragma endregion
|
||||
#pragma endregion
|
||||
|
||||
@@ -2,18 +2,18 @@
|
||||
#define __ERROR_CALLBACK_H__
|
||||
|
||||
extern "C" {
|
||||
typedef void (*error_cbk_t)(const char *file_name ,const char *func_name,const char *err_msg);
|
||||
extern error_cbk_t g_error_callback;
|
||||
typedef void (*error_cbk_t)(const char *file_name, const char *func_name,
|
||||
const char *err_msg);
|
||||
extern error_cbk_t g_error_callback;
|
||||
|
||||
ex_declare void error_callback_call( const char *file_name ,const char *func_name,const char *err_msg);
|
||||
ex_declare const char *extract_filename_in_cbk(const char *full_path);
|
||||
ex_declare void error_callback_call(const char *file_name,
|
||||
const char *func_name, const char *err_msg);
|
||||
ex_declare const char *extract_filename_in_cbk(const char *full_path);
|
||||
|
||||
ex_declare void set_error_cbk(error_cbk_t cbk);
|
||||
#define MACROS_ERROR_CBK_CALL(msg) error_callback_call(__FILE__, __func__, msg)
|
||||
|
||||
ex_declare void set_error_cbk(error_cbk_t cbk);
|
||||
#define MACROS_ERROR_CBK_CALL(msg) error_callback_call(__FILE__,__func__,msg)
|
||||
|
||||
|
||||
typedef int (*set_error_cbk_t)(error_cbk_t cbk);
|
||||
typedef int (*set_error_cbk_t)(error_cbk_t cbk);
|
||||
}
|
||||
|
||||
#endif // __ERROR_CALLBACK_H__
|
||||
|
||||
Reference in New Issue
Block a user