43 void PrepareMessageCommon(
const std::vector<std::string> &fields);
44 void PrepareMessageGIAVP(
const std::vector<std::string> &fields);
45 void PrepareMessageGPINS(
const std::vector<std::string> &fields);
46 void PrepareMessageBESTPOSA(
const std::vector<std::string> &fields);
47 void PrepareMessageHEADINGA(
const std::vector<std::string> &fields);
49 std::string input_str_;
62 if (message.empty()) {
66 std::stringstream ss(message.substr(0, message.rfind(
'*')));
67 std::vector<std::string> fields;
68 for (std::string field; std::getline(ss, field,
',');) {
69 fields.push_back(field);
74 auto valid_fields = [&]() ->
bool {
75 for (
size_t i = 1; i < fields.size(); ++i) {
76 if (fields[i].empty()) {
78 }
else if (fields[i].find_first_not_of(
"0123456789.- ") !=
80 fields[i].find_first_of(
"0123456789") == std::string::npos) {
81 AERROR <<
"BroadGnss ASCII message field error: " << fields[i]
82 <<
", input str: " << message;
91 AERROR <<
"BroadGnss GIAVP message format error: " << message;
94 if (!valid_fields()) {
97 PrepareMessageGIAVP(fields);
101 AERROR <<
"BroadGnss GPINS message format error:" << message;
104 if (!valid_fields()) {
107 PrepareMessageGPINS(fields);
111 AERROR <<
"BroadGnss BESTPOSA message format error: " << message;
114 PrepareMessageBESTPOSA(fields);
118 AERROR <<
"BroadGnss HEADINGA message format error: " << message;
121 PrepareMessageHEADINGA(fields);
127void BroadGnssTextParser::PrepareMessageCommon(
128 const std::vector<std::string> &fields) {
143void BroadGnssTextParser::PrepareMessageGIAVP(
144 const std::vector<std::string> &fields) {
145 PrepareMessageCommon(fields);
146 int solution_type = std::stoi(fields[15]);
147 int solution_status = 0;
148 if (solution_type >= 4) {
160void BroadGnssTextParser::PrepareMessageGPINS(
161 const std::vector<std::string> &fields) {
162 PrepareMessageCommon(fields);
172void BroadGnssTextParser::PrepareMessageBESTPOSA(
173 const std::vector<std::string> &fields) {
185void BroadGnssTextParser::PrepareMessageHEADINGA(
186 const std::vector<std::string> &fields) {
const std::string & GetMessage()
void Add(const uint8_t *data_start, const uint8_t *data_end, const uint8_t channel=0)
void PrepareMessageStatus(const uint8_t &solution_status, const uint8_t &solution_type)
BroadGnssMessage broadgnss_message_
BroadGnssTextParser(const config::Config &config)
bool PrepareMessage(const uint8_t &channel) override
const uint8_t * data_end_
static Parser * CreateBroadGnssText(const config::Config &config)
constexpr uint32_t GIAVP_MESSAGE_SIZE
constexpr uint32_t BESTPOSA_MESSAGE_SIZE
constexpr char GPINS_MESSAGE_ID[]
constexpr double DEG_TO_RAD
constexpr uint32_t HEADINGA_MESSAGE_SIZE
constexpr char BESTPOSA_MESSAGE_ID[]
constexpr uint32_t GPINS_MESSAGE_SIZE
constexpr int SECONDS_PER_WEEK
constexpr char GIAVP_MESSAGE_ID[]
constexpr char HEADINGA_MESSAGE_ID[]