7 #ifndef LINUX_LIBV2_SOURCE_CAN_LIB_CAN_H_ 8 #define LINUX_LIBV2_SOURCE_CAN_LIB_CAN_H_ 12 #include <linux/can.h> 15 #define CAN_API extern "C" CAN_API int check_can(const char *dev)
查询can-lib库中是否注册了can设备
CAN_API int can_open(const char *dev)
打开can设备
CAN_API int can_close(int fd)
关闭can设备
CAN_API int can_read_data(int fd, struct can_frame *data, unsigned int timeout_ms)
用于向can设备中读取数据
CAN_API int can_write_data(int fd, struct can_frame data)
用于向can设备中写入数据
CAN_API int init_can(const char *dev, int bitrate, int mode)
初始化can设备