linux 编译
This commit is contained in:
@@ -3,9 +3,11 @@
|
||||
#include "Local_Server/server/Global.h"
|
||||
#include <string_view>
|
||||
using namespace Psc;
|
||||
|
||||
std::shared_ptr<Data_Source> ds(Data_Source_Handler *dsh) {
|
||||
return dynamic_cast<Data_Source*>(dsh)->that();
|
||||
return dynamic_cast<Data_Source *>(dsh)->that();
|
||||
}
|
||||
|
||||
std::shared_ptr<SSR::Msg> Data_Source_Handler::create_msg(std::string_view packet) {
|
||||
auto source = ds(this);
|
||||
if (packet[0] != 0x1a) {
|
||||
@@ -13,7 +15,7 @@ std::shared_ptr<SSR::Msg> Data_Source_Handler::create_msg(std::string_view packe
|
||||
return nullptr;
|
||||
}
|
||||
std::string error_len = source->key + " " + LOG_POS_SIMPLE +
|
||||
std::string(" ") + "mode_s_error_length";
|
||||
std::string(" ") + "mode_s_error_length";
|
||||
if (packet.size() < 2) return nullptr;
|
||||
auto mt = packet[1];
|
||||
if (mt == SSR::Msg::AC) {
|
||||
@@ -90,10 +92,17 @@ std::shared_ptr<SSR::Msg> Data_Source_Handler::create_msg(std::string_view packe
|
||||
rotating_log("unknown_type", mem2hex(std::string(packet)));
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
size_t Data_Source_Handler::process_mode_acs_data(std::string_view origin_data) {
|
||||
// 先读取原始数据 注意多复制了一遍
|
||||
std::string mode_data(origin_data);
|
||||
origin_data_transform_mode_data(mode_data);
|
||||
static Value_Growth_Multi_T mt;
|
||||
auto t = key;
|
||||
if (mt.test(key, mode_data.size())) {
|
||||
std::cout << VAR_STR_2(key, mode_data.size()) << " 数据增长过快,可能内存积压" << std::endl;
|
||||
}
|
||||
|
||||
size_t ret = 0;
|
||||
if (mode_data.empty()) {
|
||||
return ret;
|
||||
@@ -111,10 +120,14 @@ size_t Data_Source_Handler::process_mode_acs_data(std::string_view origin_data)
|
||||
}
|
||||
if (mode_s_console) {
|
||||
std::cout << source->key + " read:[mode_s_serial]:" << mem2hex(mode_data)
|
||||
<< std::endl;
|
||||
<< std::endl;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
SSR::Binary_Format_handle_buffer(
|
||||
source->buffer, mode_data, [this, source, &ret](std::string& packet) {
|
||||
source->buffer, mode_data, [this, source, &ret](std::string &packet) {
|
||||
ret++;
|
||||
auto msg = create_msg(packet);
|
||||
if (!msg) return;
|
||||
@@ -123,24 +136,23 @@ size_t Data_Source_Handler::process_mode_acs_data(std::string_view origin_data)
|
||||
bool mode_s = mt == SSR::Msg::S7 || mt == SSR::Msg::S14;
|
||||
if (mt == SSR::Msg::HULC_Status) {
|
||||
source->handle_HULC(packet);
|
||||
}
|
||||
else if (mt == SSR::Msg::Radarcape_status) {
|
||||
} else if (mt == SSR::Msg::Radarcape_status) {
|
||||
auto radarcape_msg = SSR::create_Radarcape_STATUS_Message(packet);
|
||||
std::cout << radarcape_msg.toJson().to_json_string() << std::endl;
|
||||
SSR::mode_s_logger->debug("Radarcape_status/radarcape", {},
|
||||
radarcape_msg.toJson().to_json_string());
|
||||
}
|
||||
else if (mode_s) {
|
||||
} else if (mode_s) {
|
||||
// 拓展点
|
||||
handle_mode_s(std::dynamic_pointer_cast<SSR::Mode_S_Msg>(msg));
|
||||
}
|
||||
});
|
||||
return ret;
|
||||
}
|
||||
|
||||
void Data_Source_Handler::handle_mode_s(std::shared_ptr<SSR::Mode_S_Msg> mode_s_msg) {
|
||||
auto source = ds(this);
|
||||
std::string t = mode_s_msg->mlat_timestamp.to_memory() +
|
||||
mode_s_msg->signal_level + Psc::hex2mem(mode_s_msg->msg_hex);
|
||||
mode_s_msg->signal_level + Psc::hex2mem(mode_s_msg->msg_hex);
|
||||
auto p = mode_s_msg->packet.substr(2);
|
||||
if (t != p) {
|
||||
std::cout << mem2hex(t, true, " ") << std::endl;
|
||||
@@ -148,7 +160,7 @@ void Data_Source_Handler::handle_mode_s(std::shared_ptr<SSR::Mode_S_Msg> mode_s_
|
||||
std::cout << VAR_STR_2(t, mode_s_msg->packet) << std::endl;
|
||||
}
|
||||
source->push_to_feed(mode_s_msg);
|
||||
auto& cfg = Global::instance()->mode_acs;
|
||||
auto &cfg = Global::instance()->mode_acs;
|
||||
SSR::parse_mode_s_bin(source.get(), mode_s_msg,
|
||||
source->base_station.get_pos(), cfg.max_speed_m_s,
|
||||
cfg.air_pos_timeout, cfg.surface_pos_timeout);
|
||||
@@ -158,13 +170,13 @@ void Data_Source_Handler::handle_mode_s(std::shared_ptr<SSR::Mode_S_Msg> mode_s_
|
||||
derived->refresh_external_database_info();
|
||||
}
|
||||
if (Global::instance()->mlat.merge) {
|
||||
auto& mh = Global::instance()->mlat_handler;
|
||||
auto &mh = Global::instance()->mlat_handler;
|
||||
mh.push(mode_s_msg);
|
||||
auto tt = mh.get_all();
|
||||
if (!tt.empty()) {
|
||||
pure_log("@/logs/mlat.log",
|
||||
"receive[" + std::to_string(tt.size()) + "]:\n");
|
||||
for (Mlat_MSG& t : tt) {
|
||||
for (Mlat_MSG &t: tt) {
|
||||
std::ostringstream oss;
|
||||
oss << std::fixed << std::setprecision(10);
|
||||
oss << "===================================================\n";
|
||||
@@ -189,14 +201,14 @@ void Data_Source_Handler::handle_mode_s(std::shared_ptr<SSR::Mode_S_Msg> mode_s_
|
||||
SSR::CPR::WGS84_LBH_to_XYZ(pos.lon, pos.lat, source->alt, x, y,
|
||||
z);
|
||||
oss << "\tpos:[" << pos.lon << "," << pos.lat << ","
|
||||
<< source->alt << "]" << std::endl;
|
||||
<< source->alt << "]" << std::endl;
|
||||
oss << "\tXYZ:[" << x << "," << y << "," << z << "]"
|
||||
<< std::endl;
|
||||
<< std::endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
for (int i = 0; i < t.size(); i++) {
|
||||
auto& msg = t.list[i];
|
||||
auto &msg = t.list[i];
|
||||
oss << "\t\tds:" << msg->source->get_key();
|
||||
oss << "\ttime:" << msg->mlat_timestamp.to_string() << std::endl;
|
||||
}
|
||||
@@ -219,6 +231,7 @@ void Data_Source_Handler::handle_mode_s(std::shared_ptr<SSR::Mode_S_Msg> mode_s_
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Data_Source_Handler::handle_HULC(std::string_view packet) {
|
||||
std::uint8_t len = SSR::get_len(packet);
|
||||
std::uint8_t id = SSR::get_id(packet);
|
||||
@@ -234,41 +247,41 @@ void Data_Source_Handler::handle_HULC(std::string_view packet) {
|
||||
// 状态消息
|
||||
auto status_msg = SSR::create_HULC_Status_Message(packet);
|
||||
bool gps_ok = status_msg.GPS_device_detected() && status_msg.GPS_valid() &&
|
||||
status_msg.GPS_has_valid_fix();
|
||||
if (gps_ok) {}
|
||||
status_msg.GPS_has_valid_fix();
|
||||
if (gps_ok) {
|
||||
}
|
||||
auto g = Global::instance();
|
||||
base_station.set_msg(status_msg);
|
||||
Log_Type type({}, {{"msg", std::string(msg)}});
|
||||
SSR::mode_s_logger->debug("HULC/status", type,
|
||||
status_msg.toJson().to_json_string());
|
||||
if (gps_ok) {}
|
||||
}
|
||||
else if (id == 24) {
|
||||
if (gps_ok) {
|
||||
}
|
||||
} else if (id == 24) {
|
||||
SSR::mode_s_logger->debug("HULC/reply", {}, msg);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
SSR::mode_s_logger->debug("HULC/unknown_id", {}, msg);
|
||||
}
|
||||
}
|
||||
|
||||
void Data_Source_Handler::refresh_data_feed_key_list() {
|
||||
// std::cout << key << " refresh_data_feed_key_list" << std::endl;
|
||||
std::vector<std::string> tmp;
|
||||
for (auto& relation :
|
||||
for (auto &relation:
|
||||
Global::instance()->mode_acs.source_feed_relation_config.map.list()) {
|
||||
if (!relation->enable) continue;
|
||||
if (relation->type == "One_to_One_Relation") {
|
||||
auto t = dynamic_cast<One_to_One_Relation*>(relation.get());
|
||||
auto t = dynamic_cast<One_to_One_Relation *>(relation.get());
|
||||
// std::cout << VAR_STR_2(t->source_key, this->key) << "
|
||||
// refresh_data_feed_key_list" << std::endl;
|
||||
if (t->source_key == this->key) {
|
||||
tmp.push_back(t->feed_key);
|
||||
}
|
||||
}
|
||||
else if (relation->type == "First_Source_To_All_Feed_Relation") {
|
||||
} else if (relation->type == "First_Source_To_All_Feed_Relation") {
|
||||
auto t =
|
||||
dynamic_cast<First_Source_To_All_Feed_Relation*>(relation.get());
|
||||
dynamic_cast<First_Source_To_All_Feed_Relation *>(relation.get());
|
||||
std::shared_ptr<Data_Source> first = nullptr;
|
||||
for (const auto& ds :
|
||||
for (const auto &ds:
|
||||
Global::instance()->mode_acs.data_source_config.map.list()) {
|
||||
if (ds->enable) {
|
||||
first = ds;
|
||||
@@ -276,7 +289,7 @@ void Data_Source_Handler::refresh_data_feed_key_list() {
|
||||
}
|
||||
}
|
||||
if (first->key == key) {
|
||||
for (const auto& df :
|
||||
for (const auto &df:
|
||||
Global::instance()->mode_acs.data_feed_config.map.list()) {
|
||||
if (df->enable) {
|
||||
tmp.push_back(df->key);
|
||||
@@ -291,7 +304,7 @@ void Data_Source_Handler::refresh_data_feed_key_list() {
|
||||
{
|
||||
std::vector<Cached_Source_Info> tmp_info;
|
||||
// 创建 tmp_info 向量,将 tmp 的内容转化为 Cached_Source_Info 对象
|
||||
for (const auto& key : tmp) {
|
||||
for (const auto &key: tmp) {
|
||||
tmp_info.push_back({key});
|
||||
}
|
||||
{
|
||||
@@ -301,21 +314,20 @@ void Data_Source_Handler::refresh_data_feed_key_list() {
|
||||
auto it = cached_data_feed_key_list.begin();
|
||||
while (it != cached_data_feed_key_list.end()) {
|
||||
if (std::find_if(tmp_info.begin(), tmp_info.end(),
|
||||
[&](const Cached_Source_Info& info) {
|
||||
[&](const Cached_Source_Info &info) {
|
||||
return info.key == it->key;
|
||||
}) == tmp_info.end()) {
|
||||
// 如果当前元素在 tmp 中找不到,删除它
|
||||
it = cached_data_feed_key_list.erase(it);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
++it;
|
||||
}
|
||||
}
|
||||
// 2. 创建 tmp 中有但 cached_data_feed_key_list 没有的元素
|
||||
for (const auto& tmp_item : tmp_info) {
|
||||
for (const auto &tmp_item: tmp_info) {
|
||||
auto found = std::find_if(cached_data_feed_key_list.begin(),
|
||||
cached_data_feed_key_list.end(),
|
||||
[&](const Cached_Source_Info& cached_item) {
|
||||
[&](const Cached_Source_Info &cached_item) {
|
||||
return cached_item.key == tmp_item.key;
|
||||
});
|
||||
if (found == cached_data_feed_key_list.end()) {
|
||||
@@ -327,71 +339,66 @@ void Data_Source_Handler::refresh_data_feed_key_list() {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
std::optional<std::string> convert_to_send_format(Data_Source_Handler *ds,
|
||||
const std::shared_ptr<Data_Feed>& feed,
|
||||
const std::shared_ptr<SSR::Msg>& msg) {
|
||||
auto& type = msg->type;
|
||||
auto fs = dynamic_cast<File_Data_Source*>(msg->source.get());
|
||||
const std::shared_ptr<Data_Feed> &feed,
|
||||
const std::shared_ptr<SSR::Msg> &msg) {
|
||||
auto &type = msg->type;
|
||||
auto fs = dynamic_cast<File_Data_Source *>(msg->source.get());
|
||||
if (fs) {
|
||||
if (fs->play_mode == Play_Mode::analysis) {
|
||||
// std::cout << fs->key << " analysis i ==" << i << std::endl;
|
||||
}
|
||||
}
|
||||
// 出口输出的条件
|
||||
auto& output_format = feed->output_format.type;
|
||||
auto& use_mode_ac = feed->output_format.use_mode_ac;
|
||||
auto& use_status = feed->output_format.use_status;
|
||||
auto& mode_s_output_type = feed->output_format.mode_s_output_type;
|
||||
auto &output_format = feed->output_format.type;
|
||||
auto &use_mode_ac = feed->output_format.use_mode_ac;
|
||||
auto &use_status = feed->output_format.use_status;
|
||||
auto &mode_s_output_type = feed->output_format.mode_s_output_type;
|
||||
// 计算出是否输出消息
|
||||
std::optional<std::string> send_msg = std::nullopt;
|
||||
if (type == SSR::Msg::HULC_Status) {
|
||||
if (!use_status) return std::nullopt;
|
||||
auto data = static_cast<SSR::Msg*>(msg.get());
|
||||
auto data = static_cast<SSR::Msg *>(msg.get());
|
||||
if (output_format == Output_Data_Format::BIN ||
|
||||
output_format == Output_Data_Format::BIN_ID) {
|
||||
output_format == Output_Data_Format::BIN_ID) {
|
||||
send_msg = SSR::packet_to_escape_format(data->packet);
|
||||
}
|
||||
}
|
||||
else if (type == SSR::Msg::Radarcape_status) {
|
||||
auto data = static_cast<SSR::Msg*>(msg.get());
|
||||
} else if (type == SSR::Msg::Radarcape_status) {
|
||||
auto data = static_cast<SSR::Msg *>(msg.get());
|
||||
if (output_format == Output_Data_Format::BIN ||
|
||||
output_format == Output_Data_Format::BIN_ID) {
|
||||
output_format == Output_Data_Format::BIN_ID) {
|
||||
send_msg = SSR::packet_to_escape_format(data->packet);
|
||||
}
|
||||
}
|
||||
else if (type == SSR::Msg::AC) {
|
||||
} else if (type == SSR::Msg::AC) {
|
||||
if (!use_mode_ac) return std::nullopt;
|
||||
auto data = static_cast<SSR::Mode_AC_Msg*>(msg.get());
|
||||
std::string& msg_hex = data->msg_hex;
|
||||
auto data = static_cast<SSR::Mode_AC_Msg *>(msg.get());
|
||||
std::string &msg_hex = data->msg_hex;
|
||||
char signal_level = data->signal_level;
|
||||
SSR::MLAT_timestamp& mlat_timestamp = data->mlat_timestamp;
|
||||
SSR::MLAT_timestamp &mlat_timestamp = data->mlat_timestamp;
|
||||
if (output_format == Output_Data_Format::BIN) {
|
||||
// send_msg = create_Binary_Format_memory(msg_hex, signal_level,
|
||||
// &mlat_timestamp);
|
||||
send_msg = SSR::packet_to_escape_format(msg->packet);
|
||||
}
|
||||
else if (output_format == Output_Data_Format::BIN_ID) {
|
||||
} else if (output_format == Output_Data_Format::BIN_ID) {
|
||||
// std::uint32_t id;
|
||||
// {
|
||||
// id = Global::instance()->mlat_server.id;
|
||||
// }
|
||||
// auto bin_id_packet = mode_s_msg_packet_to_server_packet(id,
|
||||
// data->packet); send_msg = packet_to_escape_format(bin_id_packet);
|
||||
}
|
||||
else if (output_format == Output_Data_Format::AVR) {
|
||||
} else if (output_format == Output_Data_Format::AVR) {
|
||||
send_msg = SSR::create_AVR_format(msg_hex);
|
||||
}
|
||||
else if (output_format == Output_Data_Format::AVR_MLAT) {
|
||||
} else if (output_format == Output_Data_Format::AVR_MLAT) {
|
||||
send_msg = create_MLAT_AVR_format(msg_hex, &mlat_timestamp);
|
||||
}
|
||||
}
|
||||
else if (type == SSR::Msg::S7 || type == SSR::Msg::S14) {
|
||||
auto s_msg = static_cast<SSR::Mode_S_Msg*>(msg.get());
|
||||
std::string& icao = s_msg->icao;
|
||||
SSR::Downlink_Format& df = s_msg->df;
|
||||
std::string& msg_hex = s_msg->msg_hex;
|
||||
auto& signal_level = s_msg->signal_level;
|
||||
SSR::MLAT_timestamp& mlat_timestamp = s_msg->mlat_timestamp;
|
||||
} else if (type == SSR::Msg::S7 || type == SSR::Msg::S14) {
|
||||
auto s_msg = static_cast<SSR::Mode_S_Msg *>(msg.get());
|
||||
std::string &icao = s_msg->icao;
|
||||
SSR::Downlink_Format &df = s_msg->df;
|
||||
std::string &msg_hex = s_msg->msg_hex;
|
||||
auto &signal_level = s_msg->signal_level;
|
||||
SSR::MLAT_timestamp &mlat_timestamp = s_msg->mlat_timestamp;
|
||||
auto aircraft = ds->get_aircraft(s_msg->icao);
|
||||
if (output_format == Output_Data_Format::SBS) {
|
||||
bool sbs_out_put = false;
|
||||
@@ -405,8 +412,7 @@ std::optional<std::string> convert_to_send_format(Data_Source_Handler *ds,
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
if (feed->sbs_flm.test(s_msg->icao)) {
|
||||
sbs_out_put = true;
|
||||
}
|
||||
@@ -427,9 +433,9 @@ std::optional<std::string> convert_to_send_format(Data_Source_Handler *ds,
|
||||
return send_msg;
|
||||
}
|
||||
bool DF_11_17_18 =
|
||||
df == SSR::Downlink_Format::All_Call_Reply_11 ||
|
||||
df == SSR::Downlink_Format::Extended_Squitter_17 ||
|
||||
df == SSR::Downlink_Format::Extended_Squitter_Non_Transponder_18;
|
||||
df == SSR::Downlink_Format::All_Call_Reply_11 ||
|
||||
df == SSR::Downlink_Format::Extended_Squitter_17 ||
|
||||
df == SSR::Downlink_Format::Extended_Squitter_Non_Transponder_18;
|
||||
if (mode_s_output_type == Mode_S_Output_Type::DF_11_17_18 && !DF_11_17_18) return std::nullopt;
|
||||
if (mode_s_output_type == Mode_S_Output_Type::NO_POS_Mode_S) {
|
||||
if (aircraft && aircraft->pos().has_value()) {
|
||||
@@ -440,48 +446,45 @@ std::optional<std::string> convert_to_send_format(Data_Source_Handler *ds,
|
||||
send_msg = SSR::packet_to_escape_format(s_msg->packet);
|
||||
// send_msg = create_Binary_Format_memory(msg_hex, signal_level,
|
||||
// &mlat_timestamp);
|
||||
}
|
||||
else if (output_format == Output_Data_Format::BIN_ID) {
|
||||
} else if (output_format == Output_Data_Format::BIN_ID) {
|
||||
// std::uint32_t id;
|
||||
// {
|
||||
// id = Global::instance()->mlat_server.id;
|
||||
// }
|
||||
// auto bin_id_packet = mode_s_msg_packet_to_server_packet(id,
|
||||
// data->packet); send_msg = packet_to_escape_format(bin_id_packet);
|
||||
}
|
||||
else if (output_format == Output_Data_Format::AVR) {
|
||||
} else if (output_format == Output_Data_Format::AVR) {
|
||||
send_msg = SSR::create_AVR_format(msg_hex);
|
||||
}
|
||||
else if (output_format == Output_Data_Format::AVR_MLAT) {
|
||||
} else if (output_format == Output_Data_Format::AVR_MLAT) {
|
||||
send_msg = create_MLAT_AVR_format(msg_hex, &mlat_timestamp);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
std::cerr << "Unknown output format " << VAR_STR_1(output_format)
|
||||
<< std::endl;
|
||||
<< std::endl;
|
||||
return std::nullopt;
|
||||
}
|
||||
}
|
||||
return send_msg;
|
||||
}
|
||||
void Data_Source_Handler::push_to_feed(const std::shared_ptr<SSR::Msg>& msg) {
|
||||
|
||||
void Data_Source_Handler::push_to_feed(const std::shared_ptr<SSR::Msg> &msg) {
|
||||
if (need_refresh_data_feed_key_list) {
|
||||
refresh_data_feed_key_list();
|
||||
need_refresh_data_feed_key_list = false;
|
||||
}
|
||||
auto& other_size = Global::instance()->mode_acs.mode_other_max_num;
|
||||
auto& s_size = Global::instance()->mode_acs.mode_other_max_num;
|
||||
auto &other_size = Global::instance()->mode_acs.mode_other_max_num;
|
||||
auto &s_size = Global::instance()->mode_acs.mode_other_max_num;
|
||||
std::vector<std::string> list;
|
||||
for (const auto& item : cached_data_feed_key_list) {
|
||||
auto& key = item.key;
|
||||
for (const auto &item: cached_data_feed_key_list) {
|
||||
auto &key = item.key;
|
||||
auto opt_feed = Global::instance()->mode_acs.data_feed_config.map.get(key);
|
||||
if (!opt_feed.has_value()) {
|
||||
std::cout << "wrong data feed: " << key << std::endl;
|
||||
break;
|
||||
}
|
||||
std::shared_ptr<Data_Feed>& feed = opt_feed.value();
|
||||
std::shared_ptr<Data_Feed> &feed = opt_feed.value();
|
||||
if (!feed->enable) continue;
|
||||
if (msg->type == SSR::Mode_Msg::T::S7 ||
|
||||
msg->type == SSR::Mode_Msg::T::S14) {
|
||||
msg->type == SSR::Mode_Msg::T::S14) {
|
||||
// static Frequency_Limit fl;
|
||||
// if (!fl.test()) {
|
||||
// std::ostringstream oss;
|
||||
@@ -491,16 +494,13 @@ void Data_Source_Handler::push_to_feed(const std::shared_ptr<SSR::Msg>& msg) {
|
||||
// }
|
||||
if (feed->msg_buffer.mode_s_msg_num > s_size) {
|
||||
continue;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
++feed->msg_buffer.mode_s_msg_num;
|
||||
}
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
if (feed->msg_buffer.mode_other_msg_num > other_size) {
|
||||
continue;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
++feed->msg_buffer.mode_other_msg_num;
|
||||
}
|
||||
}
|
||||
@@ -510,6 +510,7 @@ void Data_Source_Handler::push_to_feed(const std::shared_ptr<SSR::Msg>& msg) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Psc::JSON Data_Source_Handler::get_all_connect_feed_status() {
|
||||
Psc::JSON ret = Psc::JSON::object();
|
||||
std::vector<Cached_Source_Info> list;
|
||||
@@ -517,11 +518,11 @@ Psc::JSON Data_Source_Handler::get_all_connect_feed_status() {
|
||||
std::lock_guard g(cdf_mtx);
|
||||
list = cached_data_feed_key_list;
|
||||
}
|
||||
for (auto& i : list) {
|
||||
for (auto &i: list) {
|
||||
Psc::JSON cur = Psc::JSON::object();
|
||||
auto odf = Global::instance()->mode_acs.data_feed_config.map.get(i.key);
|
||||
if (odf.has_value()) {
|
||||
const auto& df = odf.value();
|
||||
const auto &df = odf.value();
|
||||
i.mode_s_cache_num.update(df->msg_buffer.mode_s_msg_num);
|
||||
i.mode_other_cache_num.update(df->msg_buffer.mode_other_msg_num);
|
||||
cur.append({"mode_s_msg_num", i.mode_s_cache_num.to_json()});
|
||||
@@ -531,6 +532,7 @@ Psc::JSON Data_Source_Handler::get_all_connect_feed_status() {
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
Psc::JSON Data_Source_Handler::get_all_connect_feed() {
|
||||
Psc::JSON ret = Psc::JSON::array();
|
||||
std::vector<Cached_Source_Info> list;
|
||||
@@ -538,7 +540,7 @@ Psc::JSON Data_Source_Handler::get_all_connect_feed() {
|
||||
std::lock_guard g(cdf_mtx);
|
||||
list = cached_data_feed_key_list;
|
||||
}
|
||||
for (auto& i : list) {
|
||||
for (auto &i: list) {
|
||||
Psc::JSON cur = Psc::JSON::object();
|
||||
cur.append({"key", i.key});
|
||||
ret.append(cur);
|
||||
|
||||
Reference in New Issue
Block a user