2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
23#ifndef LIBSOCKCANPP_INCLUDE_CANMESSAGE_HPP
24#define LIBSOCKCANPP_INCLUDE_CANMESSAGE_HPP
34#include <system_error>
44 using std::error_code;
45 using std::generic_category;
47 using std::system_error;
50
51
57 if (frameData.size() > CANXL_MAX_DLEN) {
58 throw system_error(error_code(0xbadd1c, generic_category()),
"Payload too big!");
61 struct canxl_frame rawFrame{};
63 std::copy(frameData.begin(), frameData.end(), rawFrame.data);
65 rawFrame.len = frameData.size();
66 rawFrame.prio =
static_cast<uint16_t>(priorityField);
67 rawFrame.af =
static_cast<uint32_t>(acceptanceField);
68 rawFrame.flags |= CANXL_XLF;
Represents a CAN message that was received.
CanMessage(const CanId &priorityField, const CanId &acceptanceField, const string &frameData)
CanMessage(const struct canxl_frame frame)
struct can_frame _rawFrame
Represents a CAN ID in a simple and easy-to-use manner.