simple-socket library 1.2.0
CANFrame.h
Go to the documentation of this file.
1#ifndef NET_CANFrame_h__
2#define NET_CANFrame_h__
3
4#include <cstdint>
5
6namespace NET
7{
8 // TODO This classes are just simple prototypes for now
9 // TODO You must not forget to initialize the CAN structs!
10
12 struct can_id
13 {
14 uint32_t value : 29;
15 uint32_t error_flag : 1;
16 uint32_t rtr_flag : 1;
17 uint32_t ext_format : 1;
18 };
19
21 struct can_frame
22 {
24 uint8_t dlc;
25 uint8_t _pad_[3];
26 uint8_t data[8];
27
29 operator void* () { return this; }
30
32 operator const void* () const { return this; }
33
35 uint8_t& operator[]( unsigned index) { return data[index]; }
36 };
37
40 {
43 };
44
45} // namespace NET
46
47#endif // NET_CANFrame_h__
Definition CANFrame.h:7
Represents any possible CAN id or mask.
Definition CANFrame.h:13
uint32_t rtr_flag
Definition CANFrame.h:16
uint32_t ext_format
Definition CANFrame.h:17
uint32_t value
Definition CANFrame.h:14
uint32_t error_flag
Definition CANFrame.h:15
Structure to represent a CAN 2.0 Frame.
Definition CANFrame.h:22
uint8_t dlc
Definition CANFrame.h:24
uint8_t & operator[](unsigned index)
Access to all data bytes.
Definition CANFrame.h:35
uint8_t _pad_[3]
Definition CANFrame.h:25
uint8_t data[8]
Definition CANFrame.h:26
Structure of id and mask used by filters.
Definition CANFrame.h:40