27 out << m_pgn << m_src_address << m_priority << m_pdu_format;
28 out << m_pdu_spec << m_data_length;
30 if (!m_data.empty()) out.
WriteBuffer(&m_data[0], m_data.size());
32 if (!m_raw_frame.empty())
33 out.
WriteBuffer(&m_raw_frame[0], m_raw_frame.size());
34 out << sensorLabel << timestamp;
59 for (i = 0; i < n; ++i) in >> m_data[i];
62 m_raw_frame.resize(
n);
64 for (i = 0; i <
n; ++i)
67 m_raw_frame[i] = char(aux);
83 o <<
"Priority: " <<
format(
"0x%02X", m_priority)
84 <<
" [Dec: " << int(m_priority) <<
"]" << endl;
85 o <<
"Parameter Group Number (PGN): " <<
format(
"0x%04X", m_pgn)
86 <<
" [Dec: " << int(m_pgn) <<
"]" << endl;
87 o <<
"PDU Format: " <<
format(
"0x%02X", m_pdu_format)
88 <<
" [Dec: " << int(m_pdu_format) <<
"]" << endl;
89 o <<
"PDU Spec: " <<
format(
"0x%02X", m_pdu_spec)
90 <<
" [Dec: " << int(m_pdu_spec) <<
"]" << endl;
91 o <<
"Source address: " <<
format(
"0x%02X", m_src_address)
92 <<
" [Dec: " << int(m_src_address) <<
"]" << endl;
93 o <<
"Data length: " <<
format(
"0x%02X", m_data_length)
94 <<
" [Dec: " << int(m_data_length) <<
"]" << endl;
96 for (
unsigned char k : m_data) o <<
format(
"0x%02X", k) <<
" ";
98 for (
unsigned char k : m_data) o << int(k) <<
" ";
102 for (
char k : m_raw_frame) o << k;
#define IMPLEMENTS_SERIALIZABLE(class_name, base, NameSpace)
To be added to all CSerializable-classes implementation files.
This class stores a message from a CAN BUS with the protocol J1939.
void WriteAs(const TYPE_FROM_ACTUAL &value)
void WriteBuffer(const void *Buffer, size_t Count)
Writes a block of bytes to the stream from Buffer.
#define MRPT_THROW_UNKNOWN_SERIALIZATION_VERSION(__V)
For use in CSerializable implementations.
This namespace contains representation of robot actions and observations.
void serializeTo(mrpt::serialization::CArchive &out) const override
Pure virtual method for writing (serializing) to an abstract archive.
Classes for 2D/3D geometry representation, both of single values and probability density distribution...
Virtual base class for "archives": classes abstracting I/O streams.
Declares a class that represents any robot's observation.
std::string format(const char *fmt,...) MRPT_printf_format_check(1
A std::string version of C sprintf.
void serializeFrom(mrpt::serialization::CArchive &in, uint8_t serial_version) override
Pure virtual method for reading (deserializing) from an abstract archive.
void getDescriptionAsText(std::ostream &o) const override
Build a detailed, multi-line textual description of the observation contents and dump it to the outpu...
unsigned __int32 uint32_t
virtual void getDescriptionAsText(std::ostream &o) const
Build a detailed, multi-line textual description of the observation contents and dump it to the outpu...