This commit is contained in:
2026-07-24 18:09:37 +08:00
parent 908c8b5a36
commit 8370ff9e79
13 changed files with 1028 additions and 158 deletions
@@ -6,8 +6,15 @@ struct HULC_Status_Message;
std::optional<SSR::CPR::Position> BaseStation::get_pos() {
std::lock_guard g(mtx);
if (!hulc.GPS_has_valid_fix()) {
return std::nullopt;
}
return SSR::CPR::Position{hulc.get_latitude(), hulc.get_longitude()};
}
bool BaseStation::has_valid_position() {
std::lock_guard g(mtx);
return hulc.GPS_has_valid_fix();
}
void BaseStation::set_msg(const SSR::HULC_Status_Message &msg) {
std::lock_guard g(mtx);
hulc = msg;
@@ -34,9 +41,10 @@ Psc::JSON BaseStation::to_Json() {
ret.append({"GPS设备检测到", hulc.GPS_device_detected()});
ret.append({"GPS有效", hulc.GPS_valid()});
ret.append({"GPS有效定位", hulc.GPS_has_valid_fix()});
ret.append({"has_valid_position", hulc.GPS_has_valid_fix()});
ret.append({"GPS高精度时间", hulc.GPS_high_accuracy_time()});
ret.append({"启动以来TX队列溢出", hulc.TX_queue_overflow_since_startup()});
ret.append({"过去一秒TX队列溢出", hulc.TX_queue_overflow_last_second()});
ret.append({"发现过多NMEA数据", hulc.excessive_NMEA_found()});
return ret;
}
}
@@ -8,6 +8,7 @@ public:
std::string to_string();
Psc::JSON to_Json();
std::optional<SSR::CPR::Position> get_pos();
bool has_valid_position();
void set_msg(const SSR::HULC_Status_Message& msg);
std::function<void (const SSR::HULC_Status_Message&)> handle_when_updated = nullptr;
protected:
@@ -53,6 +53,7 @@ protected:
class Data_Source_Data {
public:
Psc::Copyable_Atomic<bool> base_station_show{};
Psc::Copyable_Atomic<bool> base_station_has_valid_position{};
Psc::Copyable_Atomic<bool> aircraft_show{};
std::string color = "#1677ff";
int aircraft_pixel_size{};
+3 -3
View File
@@ -82,7 +82,7 @@ JSON DataBase::get_all_aircraft_json() {
auto vto = Flight_VTO::to_VTO(it.get());
bool have_pos = !it.get()->air_pos_track_list.empty();
if (have_pos) {
json.children.push_back(vto.toJson());
json.children.push_back(vto.to_json());
num++;
}
}
@@ -97,7 +97,7 @@ JSON DataBase::get_aircraft_list_after(time_t timestamp) {
auto vto = Flight_VTO::to_VTO(it.get());
bool have_pos = !it.get()->air_pos_track_list.empty();
if (have_pos && vto.time_stamp > timestamp) {
json.children.push_back(vto.toJson());
json.children.push_back(vto.to_json());
}
}
return json;
@@ -198,7 +198,7 @@ void database_server(Global *g) {
JSON ret;
if (aircraft != nullptr) {
auto vto = Flight_VTO::to_VTO(aircraft.get());
ret = vto.toJson();
ret = vto.to_json();
}
res->setBody(ret.to_json_string());
});