Autoware.Auto
autoware::drivers::socketcan Namespace Reference

Classes

class  CanId
 
struct  ExtendedFrame_
 Tag for extended frame. More...
 
class  SocketCanReceiver
 Simple RAII wrapper around a raw CAN receiver. More...
 
class  SocketCanSender
 Simple RAII wrapper around a raw CAN sender. More...
 
class  SocketCanTimeout
 Special error for timeout. More...
 
struct  StandardFrame_
 Tag for standard frame. More...
 

Enumerations

enum  FrameType : uint32_t { FrameType::DATA, FrameType::ERROR, FrameType::REMOTE }
 

Functions

int32_t bind_can_socket (const std::string &interface)
 
struct timeval to_timeval (const std::chrono::nanoseconds timeout) noexcept
 Convert std::chrono duration to timeval (with microsecond resolution) More...
 
fd_set single_set (int32_t file_descriptor) noexcept
 Create a fd_set for use with select() that only contains the specified file descriptor. More...
 

Variables

constexpr std::size_t MAX_DATA_LENGTH = 8U
 
constexpr StandardFrame_ StandardFrame
 
constexpr ExtendedFrame_ ExtendedFrame
 
constexpr CanId::IdT EXTENDED_MASK = CAN_EFF_FLAG
 
constexpr CanId::IdT REMOTE_MASK = CAN_RTR_FLAG
 
constexpr CanId::IdT ERROR_MASK = CAN_ERR_FLAG
 
constexpr CanId::IdT EXTENDED_ID_MASK = CAN_EFF_MASK
 
constexpr CanId::IdT STANDARD_ID_MASK = CAN_SFF_MASK
 

Enumeration Type Documentation

◆ FrameType

Enumerator
DATA 
ERROR 
REMOTE 

Function Documentation

◆ bind_can_socket()

int32_t autoware::drivers::socketcan::bind_can_socket ( const std::string &  interface)

Bind a non-blocking CAN_RAW socket to the given interface

Parameters
[in]interfaceThe name of the interface to bind, must be smaller than IFNAMSIZ
Returns
The file descriptor bound to the given interface
Exceptions
std::runtime_errorIf one of socket(), fnctl(), ioctl(), bind() failed
std::domain_errorIf the provided interface name is too long

◆ single_set()

fd_set autoware::drivers::socketcan::single_set ( int32_t  file_descriptor)
noexcept

Create a fd_set for use with select() that only contains the specified file descriptor.

◆ to_timeval()

struct timeval autoware::drivers::socketcan::to_timeval ( const std::chrono::nanoseconds  timeout)
noexcept

Convert std::chrono duration to timeval (with microsecond resolution)

Variable Documentation

◆ ERROR_MASK

constexpr CanId::IdT autoware::drivers::socketcan::ERROR_MASK = CAN_ERR_FLAG
constexpr

◆ EXTENDED_ID_MASK

constexpr CanId::IdT autoware::drivers::socketcan::EXTENDED_ID_MASK = CAN_EFF_MASK
constexpr

◆ EXTENDED_MASK

constexpr CanId::IdT autoware::drivers::socketcan::EXTENDED_MASK = CAN_EFF_FLAG
constexpr

◆ ExtendedFrame

constexpr ExtendedFrame_ autoware::drivers::socketcan::ExtendedFrame
constexpr

◆ MAX_DATA_LENGTH

constexpr std::size_t autoware::drivers::socketcan::MAX_DATA_LENGTH = 8U
constexpr

◆ REMOTE_MASK

constexpr CanId::IdT autoware::drivers::socketcan::REMOTE_MASK = CAN_RTR_FLAG
constexpr

◆ STANDARD_ID_MASK

constexpr CanId::IdT autoware::drivers::socketcan::STANDARD_ID_MASK = CAN_SFF_MASK
constexpr

◆ StandardFrame

constexpr StandardFrame_ autoware::drivers::socketcan::StandardFrame
constexpr