Lely core libraries  2.2.5
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/err.h>
26 #include <lely/can/msg.h>
27 
28 // The SocketCAN CAN frame struct from <linux/can.h>
29 struct can_frame;
30 
31 #ifndef LELY_NO_CANFD
32 // The SocketCAN CAN FD frame struct from <linux/can.h>
33 struct canfd_frame;
34 #endif
35 
36 #ifdef __cplusplus
37 extern "C" {
38 #endif
39 
55 int can_frame_is_error(const struct can_frame *frame, enum can_state *pstate,
56  enum can_error *perror);
57 
66 int can_frame2can_msg(const struct can_frame *src, struct can_msg *dst);
67 
76 int can_msg2can_frame(const struct can_msg *src, struct can_frame *dst);
77 
78 #ifndef LELY_NO_CANFD
79 
88 int canfd_frame2can_msg(const struct canfd_frame *src, struct can_msg *dst);
89 
98 int can_msg2canfd_frame(const struct can_msg *src, struct canfd_frame *dst);
99 
100 #endif // !LELY_NO_CANFD
101 
102 #ifdef __cplusplus
103 }
104 #endif
105 
106 #endif // !LELY_CAN_SOCKET_H_
This header file is part of the CAN library; it contains CAN bus error definitions.
can_error
The error flags of a CAN bus, which are not mutually exclusive.
Definition: err.h:42
can_state
The states of a CAN node, depending on the TX/RX error count.
Definition: err.h:28
This header file is part of the CAN library; it contains the CAN frame declarations.
int can_msg2canfd_frame(const struct can_msg *src, struct canfd_frame *dst)
Converts a can_msg frame to a SocketCAN CAN FD frame.
Definition: can_msg.h:141
int can_frame2can_msg(const struct can_frame *src, struct can_msg *dst)
Converts a SocketCAN CAN frame to a can_msg frame.
Definition: can_msg.h:51
int canfd_frame2can_msg(const struct canfd_frame *src, struct can_msg *dst)
Converts a SocketCAN CAN FD frame to a can_msg frame.
Definition: can_msg.h:112
int can_msg2can_frame(const struct can_msg *src, struct can_frame *dst)
Converts a can_msg frame to a SocketCAN CAN frame.
Definition: can_msg.h:80
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
A CAN or CAN FD format frame.
Definition: msg.h:87