Autoware.Auto
autoware::drivers::socketcan::CanId Class Reference

#include <socket_can_id.hpp>

Public Types

using IdT = uint32_t
 
using LengthT = uint32_t
 

Public Member Functions

 CanId ()=default
 
 CanId (const IdT raw_id, const LengthT data_length=0U)
 Directly set id, blindly taking whatever bytes are given. More...
 
 CanId (const IdT id, FrameType type, StandardFrame_)
 
 CanId (const IdT id, FrameType type, ExtendedFrame_)
 
CanIdstandard () noexcept
 Sets bit 31 to 0. More...
 
CanIdextended () noexcept
 Sets bit 31 to 1. More...
 
CanIderror_frame () noexcept
 Sets bit 29 to 1, and bit 30 to 0. More...
 
CanIdremote_frame () noexcept
 Sets bit 29 to 0, and bit 30 to 1. More...
 
CanIddata_frame () noexcept
 Clears bits 29 and 30 (sets to 0) More...
 
CanIdframe_type (const FrameType type)
 Sets the type accordingly. More...
 
CanIdidentifier (const IdT id)
 
IdT identifier () const noexcept
 Get just the can_id bits. More...
 
IdT get () const noexcept
 Get the whole id value. More...
 
bool8_t is_extended () const noexcept
 Check if frame is extended. More...
 
FrameType frame_type () const
 
LengthT length () const noexcept
 Get the length of the data; only nonzero on received data. More...
 

Detailed Description

A wrapper around can_id_t to make it a little more C++-y WARNING: I'm assuming the 0th bit is the MSB aka the leftmost bit

Member Typedef Documentation

◆ IdT

◆ LengthT

Constructor & Destructor Documentation

◆ CanId() [1/4]

autoware::drivers::socketcan::CanId::CanId ( )
default

◆ CanId() [2/4]

autoware::drivers::socketcan::CanId::CanId ( const IdT  raw_id,
const LengthT  data_length = 0U 
)
explicit

Directly set id, blindly taking whatever bytes are given.

◆ CanId() [3/4]

autoware::drivers::socketcan::CanId::CanId ( const IdT  id,
FrameType  type,
StandardFrame_   
)

Sets ID

Exceptions
std::domain_errorif id would get truncated

◆ CanId() [4/4]

autoware::drivers::socketcan::CanId::CanId ( const IdT  id,
FrameType  type,
ExtendedFrame_   
)

Sets ID

Exceptions
std::domain_errorif id would get truncated

Member Function Documentation

◆ data_frame()

CanId & autoware::drivers::socketcan::CanId::data_frame ( )
noexcept

Clears bits 29 and 30 (sets to 0)

◆ error_frame()

CanId & autoware::drivers::socketcan::CanId::error_frame ( )
noexcept

Sets bit 29 to 1, and bit 30 to 0.

◆ extended()

CanId & autoware::drivers::socketcan::CanId::extended ( )
noexcept

Sets bit 31 to 1.

◆ frame_type() [1/2]

FrameType autoware::drivers::socketcan::CanId::frame_type ( ) const

Check frame type

Exceptions
std::domain_errorIf bits are in an inconsistent state

◆ frame_type() [2/2]

CanId & autoware::drivers::socketcan::CanId::frame_type ( const FrameType  type)

Sets the type accordingly.

◆ get()

CanId::IdT autoware::drivers::socketcan::CanId::get ( ) const
noexcept

Get the whole id value.

◆ identifier() [1/2]

CanId::IdT autoware::drivers::socketcan::CanId::identifier ( ) const
noexcept

Get just the can_id bits.

◆ identifier() [2/2]

CanId & autoware::drivers::socketcan::CanId::identifier ( const IdT  id)

Sets leading bits

Exceptions
std::domain_errorIf id would get truncated, 11 bits for Standard, 29 bits for Extended

◆ is_extended()

bool8_t autoware::drivers::socketcan::CanId::is_extended ( ) const
noexcept

Check if frame is extended.

◆ length()

CanId::LengthT autoware::drivers::socketcan::CanId::length ( ) const
noexcept

Get the length of the data; only nonzero on received data.

◆ remote_frame()

CanId & autoware::drivers::socketcan::CanId::remote_frame ( )
noexcept

Sets bit 29 to 0, and bit 30 to 1.

◆ standard()

CanId & autoware::drivers::socketcan::CanId::standard ( )
noexcept

Sets bit 31 to 0.


The documentation for this class was generated from the following files: