diff --git a/module/Local_Server/Data_Source/Base_Station.cpp b/module/Local_Server/Data_Source/Base_Station.cpp index 881380f..442f6c4 100644 --- a/module/Local_Server/Data_Source/Base_Station.cpp +++ b/module/Local_Server/Data_Source/Base_Station.cpp @@ -1,33 +1,47 @@ #include "Base_Station.h" -#include "../../../third_party/CPP_Core/src/Psc_Cpp_Core/socket/Socket.h" -namespace SSR { -struct HULC_Status_Message; + +namespace SSR +{ + struct HULC_Status_Message; } -double Base_Station::theoretical_detection_range_meters(double base_height_meters, double target_height_meters) { + +double Base_Station::theoretical_detection_range_meters(double base_height_meters, double target_height_meters) +{ return static_cast(SSR::CPR::radio_line_of_sight_range_meters(base_height_meters, target_height_meters)); } -std::optional Base_Station::get_pos() { + +std::optional Base_Station::get_pos() +{ std::lock_guard g(mtx); - if (!hulc.GPS_has_valid_fix()) { + if (!hulc.GPS_has_valid_fix()) + { return std::nullopt; } return SSR::Position_3D{hulc.get_latitude(), hulc.get_longitude(), static_cast(hulc.Alt)}; } -bool Base_Station::has_valid_position() { + +bool Base_Station::has_valid_position() +{ std::lock_guard g(mtx); return hulc.GPS_has_valid_fix(); } -void Base_Station::set_msg(const SSR::HULC_Status_Message& msg) { + +void Base_Station::set_msg(const SSR::HULC_Status_Message& msg) +{ std::lock_guard g(mtx); hulc = msg; if (handle_when_updated) handle_when_updated(msg); } -std::string Base_Station::to_string() { + +std::string Base_Station::to_string() +{ std::lock_guard g(mtx); return "BaseStation:[" + std::to_string(hulc.get_latitude()) + ", " + std::to_string(hulc.get_longitude()) + "]"; } -Psc::JSON Base_Station::to_Json() { + +Psc::JSON Base_Station::to_Json() +{ std::lock_guard g(mtx); auto ret = Psc::JSON::object(); ret.append({"序列号", hulc.SerNum});