37#include "comm_driver.h"
39std::string NavAddr::BusToString(NavAddr::Bus b) {
41 case NavAddr::Bus::N0183:
44 case NavAddr::Bus::N2000:
47 case NavAddr::Bus::Signalk:
50 case NavAddr::Bus::Onenet:
53 case NavAddr::Bus::TestBus:
56 case NavAddr::Bus::Undef:
63NavAddr::Bus NavAddr::StringToBus(
const std::string& s) {
64 if (s ==
"nmea0183")
return NavAddr::Bus::N0183;
65 if (s ==
"nmea2000")
return NavAddr::Bus::N2000;
66 if (s ==
"SignalK")
return NavAddr::Bus::Signalk;
67 if (s ==
"Onenet")
return NavAddr::Bus::Onenet;
68 if (s ==
"TestBus")
return NavAddr::Bus::TestBus;
69 return NavAddr::Bus::Undef;
72static std::string CharToString(
unsigned char c) {
75 ss << setfill(
'0') << hex << setw(2) << (c & 0x00ff);
81 std::for_each(payload.begin(), payload.end(),
82 [&s](
unsigned char c) { s.append(CharToString(c)); });
84 return NavMsg::to_string() +
" " + PGN.to_string() +
" " + s;
std::string to_string() const
Print "bus key id payload".