24 #include <wx/wxprec.h>
34 #include "model/comm_driver.h"
36 std::string NavAddr::BusToString(NavAddr::Bus b) {
38 case NavAddr::Bus::N0183:
41 case NavAddr::Bus::N2000:
44 case NavAddr::Bus::Signalk:
47 case NavAddr::Bus::Onenet:
50 case NavAddr::Bus::Plugin:
53 case NavAddr::Bus::TestBus:
56 case NavAddr::Bus::Undef:
63 NavAddr::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;
72 static 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".