57 {
59
62 if (message.empty()) {
63 return false;
64 }
65
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);
70 }
71 if (fields.empty()) {
72 return false;
73 }
74 auto valid_fields = [&]() -> bool {
75 for (size_t i = 1; i < fields.size(); ++i) {
76 if (fields[i].empty()) {
77 fields[i] = "0";
78 } else if (fields[i].find_first_not_of("0123456789.- ") !=
79 std::string::npos ||
80 fields[i].find_first_of("0123456789") == std::string::npos) {
81 AERROR <<
"BroadGnss ASCII message field error: " << fields[i]
82 << ", input str: " << message;
83 return false;
84 }
85 }
86 return true;
87 };
91 AERROR <<
"BroadGnss GIAVP message format error: " << message;
92 return false;
93 }
94 if (!valid_fields()) {
95 return false;
96 }
97 PrepareMessageGIAVP(fields);
98 return true;
101 AERROR <<
"BroadGnss GPINS message format error:" << message;
102 return false;
103 }
104 if (!valid_fields()) {
105 return false;
106 }
107 PrepareMessageGPINS(fields);
108 return true;
111 AERROR <<
"BroadGnss BESTPOSA message format error: " << message;
112 return false;
113 }
114 PrepareMessageBESTPOSA(fields);
115 return true;
118 AERROR <<
"BroadGnss HEADINGA message format error: " << message;
119 return false;
120 }
121 PrepareMessageHEADINGA(fields);
122 return true;
123 }
124 return false;
125}
const std::string & GetMessage()
void Add(const uint8_t *data_start, const uint8_t *data_end, const uint8_t channel=0)
BroadGnssMessage broadgnss_message_
const uint8_t * data_end_
constexpr uint32_t GIAVP_MESSAGE_SIZE
constexpr uint32_t BESTPOSA_MESSAGE_SIZE
constexpr char GPINS_MESSAGE_ID[]
constexpr uint32_t HEADINGA_MESSAGE_SIZE
constexpr char BESTPOSA_MESSAGE_ID[]
constexpr uint32_t GPINS_MESSAGE_SIZE
constexpr char GIAVP_MESSAGE_ID[]
constexpr char HEADINGA_MESSAGE_ID[]