修复问题
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
#include "Data_Source_Handler.h"
|
||||
#include <string_view>
|
||||
#include <tuple>
|
||||
#include <utility>
|
||||
#include "Data_Source.h"
|
||||
#include "Local_Server/server/Global.h"
|
||||
#include "Local_Server/server/io_coro.h"
|
||||
@@ -145,7 +147,7 @@ size_t Data_Source_Handler::process_mode_acs_data(std::string_view origin_data)
|
||||
}
|
||||
};
|
||||
auto f = [this, source, handle_packet](std::string& packet) {
|
||||
const auto wait = Global::instance()->mode_acs.settings.member<&Mode_ACS_Config_Data::wait_process_msg>().snapshot();
|
||||
const auto wait = Global::instance()->mode_acs.settings.member<&Mode_ACS_Config_Data::wait_process_msg>().read([](const auto& value) { return value; });
|
||||
if (wait) {
|
||||
handle_packet(packet);
|
||||
}
|
||||
@@ -168,29 +170,28 @@ void Data_Source_Handler::handle_mode_s(std::shared_ptr<SSR::Mode_S_Msg>& mode_s
|
||||
mem2hex(t, true, " "), mem2hex(mode_s_msg->packet, true, " "), t, mode_s_msg->packet);
|
||||
Psc::fail_fast(data);
|
||||
}
|
||||
const auto cfg = Global::instance()->mode_acs.settings.snapshot();
|
||||
const auto source_cfg = source->settings.snapshot();
|
||||
bool time_space_filter = cfg.time_space_filter;
|
||||
bool speed_filter = cfg.speed_filter;
|
||||
bool use_system_time = source_cfg.ignore_msg_time;
|
||||
const auto mode_config = Global::instance()->mode_acs.settings.read([](const auto& value) {
|
||||
return std::tuple{value.time_space_filter, value.speed_filter, value.aircraft_change_list_adsb_range_filter, value.aircraft_change_list_adsb_range_factor, value.max_speed_m_s, value.air_pos_timeout, value.surface_pos_timeout};
|
||||
});
|
||||
const auto source_config = source->settings.read([](const auto& value) {
|
||||
return std::tuple{value.ignore_msg_time, value.base_station_has_valid_position, value.lat, value.lon, value.alt};
|
||||
});
|
||||
const auto [time_space_filter, speed_filter, range_filter, range_factor, max_speed_m_s, air_pos_timeout, surface_pos_timeout] = mode_config;
|
||||
const auto [use_system_time, base_station_has_valid_position, lat, lon, alt] = source_config;
|
||||
auto base_station_pos = source->base_station.get_pos();
|
||||
if (!base_station_pos && source_cfg.base_station_has_valid_position)
|
||||
base_station_pos = SSR::Position_3D{source_cfg.lat, source_cfg.lon, source_cfg.alt};
|
||||
auto range_filter = cfg.aircraft_change_list_adsb_range_filter;
|
||||
auto range_factor = cfg.aircraft_change_list_adsb_range_factor;
|
||||
SSR::ADS_B_T::Constraint air_constraint{cfg.max_speed_m_s, cfg.air_pos_timeout, SSR::cpr_cb, time_space_filter,
|
||||
speed_filter, use_system_time, base_station_pos, source_cfg.alt,
|
||||
range_filter, range_factor};
|
||||
SSR::ADS_B_T::Constraint surface_constraint{cfg.max_speed_m_s, cfg.surface_pos_timeout, SSR::cpr_cb, time_space_filter,
|
||||
speed_filter, use_system_time, base_station_pos, source_cfg.alt,
|
||||
range_filter, range_factor};
|
||||
if (!base_station_pos && base_station_has_valid_position)
|
||||
base_station_pos = SSR::Position_3D{lat, lon, alt};
|
||||
SSR::ADS_B_T::Constraint air_constraint{max_speed_m_s, air_pos_timeout, SSR::cpr_cb, time_space_filter,
|
||||
speed_filter, use_system_time, base_station_pos, alt, range_filter, range_factor};
|
||||
SSR::ADS_B_T::Constraint surface_constraint{max_speed_m_s, surface_pos_timeout, SSR::cpr_cb, time_space_filter,
|
||||
speed_filter, use_system_time, base_station_pos, alt, range_filter, range_factor};
|
||||
SSR::parse_mode_s_bin(source.get(), mode_s_msg, base_station_pos, air_constraint, surface_constraint);
|
||||
auto base = source->get_aircraft(mode_s_msg->icao);
|
||||
if (base) {
|
||||
auto derived = std::dynamic_pointer_cast<Aircraft>(base);
|
||||
derived->refresh_external_database_info();
|
||||
}
|
||||
if (Global::instance()->mlat.settings.member<&MLAT_Config_Data::merge>().snapshot()) {
|
||||
if (Global::instance()->mlat.settings.member<&MLAT_Config_Data::merge>().read([](const auto& value) { return value; })) {
|
||||
auto& mh = Global::instance()->mlat_handler;
|
||||
mh.push(mode_s_msg);
|
||||
auto tt = mh.get_all();
|
||||
@@ -288,31 +289,33 @@ void Data_Source_Handler::refresh_data_feed_key_list() {
|
||||
const auto feeds = global->mode_acs.data_feed_config.map.list();
|
||||
const auto relations = global->mode_acs.source_feed_relation_config.map.list();
|
||||
for (const auto& relation : relations) {
|
||||
const auto config = relation->settings.snapshot();
|
||||
if (!config.enable || relation->type != "One_to_One_Relation")
|
||||
continue;
|
||||
const auto source = global->mode_acs.data_source_config.map.get(config.source_key);
|
||||
const auto feed = global->mode_acs.data_feed_config.map.get(config.feed_key);
|
||||
if (source.has_value() && feed.has_value() && source.value()->enabled() && feed.value()->enabled() && !assignment.contains(config.feed_key))
|
||||
assignment.emplace(config.feed_key, config.source_key);
|
||||
relation->settings.read([&](const auto& config) {
|
||||
if (!config.enable || relation->type != "One_to_One_Relation")
|
||||
return;
|
||||
const auto source = global->mode_acs.data_source_config.map.get(config.source_key);
|
||||
const auto feed = global->mode_acs.data_feed_config.map.get(config.feed_key);
|
||||
if (source.has_value() && feed.has_value() && source.value()->enabled() && feed.value()->enabled() && !assignment.contains(config.feed_key))
|
||||
assignment.emplace(config.feed_key, config.source_key);
|
||||
});
|
||||
}
|
||||
for (const auto& relation : relations) {
|
||||
const auto config = relation->settings.snapshot();
|
||||
if (!config.enable || relation->type != "Name_One_To_Many_Relation")
|
||||
continue;
|
||||
const auto source = global->mode_acs.data_source_config.map.get(config.source_key);
|
||||
if (!source.has_value() || !source.value()->enabled())
|
||||
continue;
|
||||
const std::string& prefix = config.feed_name.empty() ? config.source_key : config.feed_name;
|
||||
for (const auto& feed : feeds) {
|
||||
if (!feed->enabled() || assignment.contains(feed->key) || !feed->key.starts_with(prefix))
|
||||
continue;
|
||||
assignment.emplace(feed->key, config.source_key);
|
||||
}
|
||||
relation->settings.read([&](const auto& config) {
|
||||
if (!config.enable || relation->type != "Name_One_To_Many_Relation")
|
||||
return;
|
||||
const auto source = global->mode_acs.data_source_config.map.get(config.source_key);
|
||||
if (!source.has_value() || !source.value()->enabled())
|
||||
return;
|
||||
const std::string& prefix = config.feed_name.empty() ? config.source_key : config.feed_name;
|
||||
for (const auto& feed : feeds) {
|
||||
if (!feed->enabled() || assignment.contains(feed->key) || !feed->key.starts_with(prefix))
|
||||
continue;
|
||||
assignment.emplace(feed->key, config.source_key);
|
||||
}
|
||||
});
|
||||
}
|
||||
bool use_default = false;
|
||||
for (const auto& relation : relations) {
|
||||
if (relation->type == "First_Source_To_All_Feed_Relation" && relation->settings.member<&Source_Feed_Relation_Data::enable>().snapshot()) {
|
||||
if (relation->type == "First_Source_To_All_Feed_Relation" && relation->settings.member<&Source_Feed_Relation_Data::enable>().read([](const auto& value) { return value; })) {
|
||||
use_default = true;
|
||||
break;
|
||||
}
|
||||
@@ -351,12 +354,12 @@ std::optional<std::string> convert_to_send_format(Data_Source_Handler* ds, const
|
||||
auto& type = msg->type;
|
||||
auto fs = dynamic_cast<File_Data_Source*>(msg->source.get());
|
||||
if (fs) {
|
||||
if (fs->specific.member<&File_Data_Source_Data::play_mode>().snapshot() == Play_Mode::analysis) {
|
||||
if (fs->specific.member<&File_Data_Source_Data::play_mode>().read([](const auto& value) { return value; }) == Play_Mode::analysis) {
|
||||
// std::cout << fs->key << " analysis i ==" << i << std::endl;
|
||||
}
|
||||
}
|
||||
// 出口输出的条件
|
||||
const auto feed_format = feed->output_format.snapshot();
|
||||
const auto feed_format = feed->output_format.read([](const auto& value) { return value; });
|
||||
const auto output_format = feed_format.type;
|
||||
const auto use_mode_ac = feed_format.use_mode_ac;
|
||||
const auto use_status = feed_format.use_status;
|
||||
@@ -488,9 +491,9 @@ void Data_Source_Handler::push_to_feed(const std::shared_ptr<SSR::Msg>& msg) {
|
||||
refresh_data_feed_key_list();
|
||||
need_refresh_data_feed_key_list = false;
|
||||
}
|
||||
const auto mode_config = Global::instance()->mode_acs.settings.snapshot();
|
||||
const auto other_size = mode_config.mode_other_max_num;
|
||||
const auto s_size = mode_config.mode_s_max_num;
|
||||
const auto [other_size, s_size] = Global::instance()->mode_acs.settings.read([](const auto& value) {
|
||||
return std::pair{value.mode_other_max_num, value.mode_s_max_num};
|
||||
});
|
||||
std::vector<std::string> list;
|
||||
for (const auto& item : cached_data_feed_key_list) {
|
||||
auto& key = item.key;
|
||||
|
||||
Reference in New Issue
Block a user