提取出 Data_Source_Handler

This commit is contained in:
2026-06-23 14:01:23 +08:00
parent 8ca05115ec
commit afd4bf8e69
8 changed files with 380 additions and 389 deletions
-30
View File
@@ -210,37 +210,7 @@ void handle_buffer_head_tail(std::string& buffer, const std::string& data, const
}
}
}
void DataBase::handle_HULC(const std::string& packet) {
std::uint8_t len = SSR::get_len(packet);
std::uint8_t id = SSR::get_id(packet);
auto msg = mem2hex(packet);
if (len != packet.size() - 4) {
SSR::mode_s_logger->debug("HULC/error_length", {},
"需要: " + std::to_string(len) + " 当前: " + std::to_string(packet.size()) + " hex: " +
mem2hex(packet));
return;
}
if (id == 1) {
// 状态消息
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) {
}
auto g = Global::instance();
base_station.set_msg(status_msg);
Log_Type type({}, {{"msg", msg}});
SSR::mode_s_logger->debug("HULC/status", type, status_msg.toJson().to_json_string());
if (gps_ok) {
}
} else if (id == 24) {
SSR::mode_s_logger->debug("HULC/reply", {}, msg);
} else {
SSR::mode_s_logger->debug("HULC/unknown_id", {}, msg);
}
}
void read_ais_serial_data(std::atomic<bool>& running) {
// static int t = config.ais.read_serial_milliseconds;