std::string to_string(const sentence & s) { std::string result; result.reserve(sentence::max_length); result += s.get_start_token(); result += s.talker(); result += s.tag(); for (auto const & data : s.get_data()) { result += ","; result += data; } result += s.get_end_token(); char buf[8]; snprintf(buf, sizeof(buf), "%02X", checksum(result.begin() + 1, result.end() - 1)); return result + buf; }
/// Returns the ID of the manufacturer of the specified sentence. /// /// @param[in] s Sentence to get the manufacturer ID from. /// @return The manufacturers ID. manufacturer_id get_manufacturer_id(const sentence & s) { return get_manufacturer_id(s.tag()); }