Lely core libraries  1.9.2
socket.h
Go to the documentation of this file.
1 
22 #ifndef LELY_CAN_SOCKET_H_
23 #define LELY_CAN_SOCKET_H_
24 
25 #include <lely/can/msg.h>
26 
27 // The SocketCAN CAN frame struct from <linux/can.h>
28 struct can_frame;
29 
30 #ifndef LELY_NO_CANFD
31 // The SocketCAN CAN FD frame struct from <linux/can.h>
32 struct canfd_frame;
33 #endif
34 
35 #ifdef __cplusplus
36 extern "C" {
37 #endif
38 
54 int can_frame_is_error(const struct can_frame *frame, enum can_state *pstate,
55  enum can_error *perror);
56 
65 int can_frame2can_msg(const struct can_frame *src, struct can_msg *dst);
66 
75 int can_msg2can_frame(const struct can_msg *src, struct can_frame *dst);
76 
77 #ifndef LELY_NO_CANFD
78 
87 int canfd_frame2can_msg(const struct canfd_frame *src, struct can_msg *dst);
88 
97 int can_msg2canfd_frame(const struct can_msg *src, struct canfd_frame *dst);
98 
99 #endif // !LELY_NO_CANFD
100 
101 #ifdef __cplusplus
102 }
103 #endif
104 
105 #endif // !LELY_CAN_SOCKET_H_
A CAN or CAN FD format frame.
Definition: msg.h:88
int canfd_frame2can_msg(const struct canfd_frame *src, struct can_msg *dst)
Converts a SocketCAN CAN FD frame to a can_msg frame.
int can_msg2can_frame(const struct can_msg *src, struct can_frame *dst)
Converts a can_msg frame to a SocketCAN CAN frame.
Definition: socket.c:144
can_state
The states of a CAN node, depending on the TX/RX error count.
Definition: can.h:27
int can_frame2can_msg(const struct can_frame *src, struct can_msg *dst)
Converts a SocketCAN CAN frame to a can_msg frame.
Definition: socket.c:116
int can_frame_is_error(const struct can_frame *frame, enum can_state *pstate, enum can_error *perror)
Checks if a SocketCAN CAN frame is an error frame and parses the bus state and error flags if it is...
Definition: socket.c:43
int can_msg2canfd_frame(const struct can_msg *src, struct canfd_frame *dst)
Converts a can_msg frame to a SocketCAN CAN FD frame.
This header file is part of the CAN library; it contains the CAN frame declarations.
can_error
The error flags of a CAN bus, which are not mutually exclusive.
Definition: can.h:37