Lely core libraries  2.2.5
socket.h File Reference
#include <lely/can/err.h>
#include <lely/can/msg.h>
Include dependency graph for socket.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

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. More...
 
int can_frame2can_msg (const struct can_frame *src, struct can_msg *dst)
 Converts a SocketCAN CAN frame to a can_msg frame. More...
 
int can_msg2can_frame (const struct can_msg *src, struct can_frame *dst)
 Converts a can_msg frame to a SocketCAN CAN frame. More...
 
int canfd_frame2can_msg (const struct canfd_frame *src, struct can_msg *dst)
 Converts a SocketCAN CAN FD frame to a can_msg frame. More...
 
int can_msg2canfd_frame (const struct can_msg *src, struct canfd_frame *dst)
 Converts a can_msg frame to a SocketCAN CAN FD frame. More...
 

Detailed Description

This header file is part of the CAN library; it contains the SocketCAN interface declarations.

Author
J. S. Seldenthuis jseld.nosp@m.enth.nosp@m.uis@l.nosp@m.ely..nosp@m.com

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Definition in file socket.h.

Function Documentation

◆ can_frame_is_error()

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.

Parameters
framea pointer to a SocketCAN CAN frame.
pstatethe address at which to store the updated CAN node state (can be NULL). The value is only updated if the error frame indicates a state change.
perrorthe address at which to store the updated CAN bus errors (can be NULL). Any new error flags indicated by by the error frame are set in *perror, but existing flags are not cleared.
Returns
1 if the CAN frame is an error frame, 0 if not, and -1 on error. In the latter case, the error number can be obtained with get_errc().

Definition at line 43 of file socket.c.

◆ can_frame2can_msg()

static int can_frame2can_msg ( const struct can_frame *  src,
struct can_msg dst 
)
inline

Converts a SocketCAN CAN frame to a can_msg frame.

Returns
0 on success, or -1 on error. In the latter case, the error number can be obtained with get_errc().
See also
can_msg2can_frame()

Definition at line 51 of file can_msg.h.

◆ can_msg2can_frame()

static int can_msg2can_frame ( const struct can_msg src,
struct can_frame *  dst 
)
inline

Converts a can_msg frame to a SocketCAN CAN frame.

Returns
0 on success, or -1 on error. In the latter case, the error number can be obtained with get_errc().
See also
can_frame2can_msg()

Definition at line 80 of file can_msg.h.

◆ canfd_frame2can_msg()

static int canfd_frame2can_msg ( const struct canfd_frame *  src,
struct can_msg dst 
)
inline

Converts a SocketCAN CAN FD frame to a can_msg frame.

Returns
0 on success, or -1 on error. In the latter case, the error number can be obtained with get_errc().
See also
can_msg2canfd_frame()

Definition at line 112 of file can_msg.h.

◆ can_msg2canfd_frame()

static int can_msg2canfd_frame ( const struct can_msg src,
struct canfd_frame *  dst 
)
inline

Converts a can_msg frame to a SocketCAN CAN FD frame.

Returns
0 on success, or -1 on error. In the latter case, the error number can be obtained with get_errc().
See also
canfd_frame2can_msg()

Definition at line 141 of file can_msg.h.