58 {
60
61
63 for (; data_start !=
data_; --data_start) {
64 if (*data_start == '$') {
65 break;
66 }
67 }
68 if (data_start !=
data_) {
69 AWARN <<
"Forsense message has been truncated: " <<
data_;
70 }
71
72 if (*data_start != '$') {
73 input_str_.append(reinterpret_cast<const char *>(data_start),
75 } else {
76 input_str_.assign(reinterpret_cast<const char *>(data_start),
78 }
79
81 AWARN <<
"Forsense ASCII message is not complete: " << data_start;
82 return false;
83 }
84
85 std::vector<std::string> fields;
86 std::stringstream ss(input_str_);
87 for (std::string field; std::getline(ss, field, ',');) {
88 fields.push_back(field);
89 }
90 if (fields.empty()) {
91 return false;
92 }
93 if (fields[0] == protocol_.
GPYJ) {
94 if (fields.size() < protocol_.
GPYJ_SIZE) {
95 AERROR <<
"GPYJ message format error: " << data_start;
96 return false;
97 }
98 PrepareMessageGPYJ(fields);
99 return true;
100 }
101 return false;
102}
const uint8_t * data_end_