修完bug
This commit is contained in:
@@ -23,10 +23,17 @@ bool Data_Source::registered() const {
|
||||
}
|
||||
Psc::JSON Data_Source::get_state() {
|
||||
Psc::JSON ret = Psc::JSON::object();
|
||||
ret.append({"state", Psc::to_string(state)});
|
||||
ret.append({"lifecycle", lifecycle_state_json()});
|
||||
ret.append_list(get_custom_state_json().children);
|
||||
ret.append({"ds: read_speed(byte)", read_speed});
|
||||
ret.append({"ds: value_statistics(byte)", value_statistics});
|
||||
ret.append({"input", input_statistics.to_json()});
|
||||
ret.append({"mode_ac", mode_ac_statistic.to_json()});
|
||||
ret.append({"mode_s", mode_s_statistic.to_json()});
|
||||
Psc::JSON aircraft = Psc::JSON::object();
|
||||
aircraft.append({"total", get_aircraft_num()});
|
||||
aircraft.append({"with_position", have_pos_aircraft_num.load()});
|
||||
ret.append({"aircraft", aircraft});
|
||||
ret.append({"base_station", base_station.to_Json()});
|
||||
ret.append({"connected_feeds", get_all_connect_feed_status()});
|
||||
return ret;
|
||||
}
|
||||
Data_Source::Data_Source() {
|
||||
@@ -158,6 +165,7 @@ std::optional<std::string> File_Data_Source::get_raw_line(int& ret_index) {
|
||||
const auto config = specific.read([](const auto& value) { return value; });
|
||||
if (config.play_mode == Play_Mode::loop) {
|
||||
index = 0;
|
||||
++loop_total;
|
||||
}
|
||||
else {
|
||||
if (!have_report_play_back_all_success) {
|
||||
@@ -173,7 +181,9 @@ std::optional<std::string> File_Data_Source::get_raw_line(int& ret_index) {
|
||||
}
|
||||
}
|
||||
ret_index = index + 1;
|
||||
return part_infos[index++];
|
||||
const auto& record = part_infos[index++];
|
||||
raw_read_statistics.update(record.size());
|
||||
return record;
|
||||
}
|
||||
// 1A 33 1A 1A F1 FB 87 73 7E 7F a8001d81a87543b0a80000
|
||||
std::string get_true_from_raw_line(Data_Source* ds, File_Data_Type data_type, int index, std::string_view log_info) {
|
||||
@@ -340,6 +350,8 @@ void File_Data_Source::origin_data_transform_mode_data(std::string& mode_data) {
|
||||
if (config.play_mode != Play_Mode::analysis) {
|
||||
std::optional<std::string> log_info = get_raw_line(ret_index);
|
||||
mode_data = log_info.has_value() ? get_true_from_raw_line(this, config.data_type, ret_index, log_info.value()) : "";
|
||||
if (log_info.has_value() && !log_info->empty() && mode_data.empty())
|
||||
conversion_dropped_statistics.update(log_info->size());
|
||||
}
|
||||
else {
|
||||
int num = 0;
|
||||
@@ -349,6 +361,8 @@ void File_Data_Source::origin_data_transform_mode_data(std::string& mode_data) {
|
||||
num++;
|
||||
auto data = log_info.value();
|
||||
auto cur = get_true_from_raw_line(this, config.data_type, ret_index, data);
|
||||
if (!data.empty() && cur.empty())
|
||||
conversion_dropped_statistics.update(data.size());
|
||||
ret += cur;
|
||||
// 一定要在这个位置,否则会导致遗漏报文
|
||||
if (num == 1000) {
|
||||
@@ -398,7 +412,7 @@ void Dll_Data_Source::origin_data_transform_mode_data(std::string& mode_data) {
|
||||
const auto config = specific.read([](const auto& value) { return value; });
|
||||
auto buf = reinterpret_cast<char*>(buffer.data());
|
||||
auto len = read_func_ptr(buf, config.buffer_size);
|
||||
vs.update(len);
|
||||
read_statistics.update(len);
|
||||
std::string data(buf, len);
|
||||
if (data.empty()) {
|
||||
auto end = std::chrono::steady_clock::now();
|
||||
@@ -416,10 +430,12 @@ asio::awaitable<void> Shared_Memory_Data_Source::_open() {
|
||||
const auto config = specific.read([](const auto& value) { return value; });
|
||||
sm = std::make_unique<Psc::SM_RingBuffer>();
|
||||
sm->init(config.shared_memory_name, config.shared_memory_size);
|
||||
shared_memory_open = true;
|
||||
co_return;
|
||||
}
|
||||
asio::awaitable<void> Shared_Memory_Data_Source::_close() {
|
||||
sm.reset();
|
||||
shared_memory_open = false;
|
||||
co_return;
|
||||
}
|
||||
void Shared_Memory_Data_Source::origin_data_transform_mode_data(std::string& mode_data) {
|
||||
@@ -430,6 +446,7 @@ void Shared_Memory_Data_Source::origin_data_transform_mode_data(std::string& mod
|
||||
bool ok = sm->read((uint8_t*)data.data(), length);
|
||||
if (!ok) {
|
||||
mode_data = "";
|
||||
return;
|
||||
}
|
||||
if (length != size) {
|
||||
data.resize(length);
|
||||
|
||||
Reference in New Issue
Block a user