Model Railroad System  2.2.1
Public Member Functions | Static Private Attributes | List of all members
lcc::CANHeader Class Reference

CAN Header type. More...

Public Member Functions

 CANHeader (name,...)
 Constructor: create a 29-bit CAN header. More...
 
 getHeader ()
 Generate and return the 29-bit header. More...
 
 setHeader (header)
 Decode a 29-bit CAN header. More...
 

Static Private Attributes

static RESERVED_SHIFT
 Bit 28 is reserved and always 1. More...
 
static OPENLCBFRAME_SHIFT
 Bit 27 is the OpenLCB bit: 1 == OpenLCB, 0 == other CAN. More...
 
static OPENLCBFRAME_MASK
 Bit 27 is the OpenLCB bit: 1 == OpenLCB, 0 == other CAN. More...
 
static VARIABLEFIELD_SHIFT
 Bits 12-26 are the variable field. More...
 
static VARIABLEFIELD_MASK
 Bits 12-26 are the variable field. More...
 
static SRCID_SHIFT
 Bits 0-11 are the source id. More...
 
static SRCID_MASK
 Bits 0-11 are the source id. More...
 

Detailed Description

CAN Header type.

Creates a 29-bit CAN header. The header is generated and decoded ``on the fly'' from/to the supplied options:

Constructor & Destructor Documentation

◆ CANHeader()

lcc::CANHeader::CANHeader ( name  ,
  ... 
)

Constructor: create a 29-bit CAN header.

Creates a CAN header object from the supplied options.

Parameters
nameThe name of the object.
...Options:
  • -openlcbframe Flag to indicate a OpenLCB frame or not. Default yes, type boolean.
  • -variablefield Fifteen bit variable field. Default 0, type 15-bit integer.
  • -srcid Twelve bit source id field. Default 0, type 12-bit integer.

Member Function Documentation

◆ getHeader()

lcc::CANHeader::getHeader ( )

Generate and return the 29-bit header.

Creates a 29-bit header from the supplied options.

Returns
The 29-bit CAN header.

◆ setHeader()

lcc::CANHeader::setHeader ( header  )

Decode a 29-bit CAN header.

The 29-bit CAN header is decoded and the various options set.

Parameters
headerThe 29-bit CAN header.

Member Data Documentation

◆ OPENLCBFRAME_MASK

lcc::CANHeader::OPENLCBFRAME_MASK
staticprivate

Bit 27 is the OpenLCB bit: 1 == OpenLCB, 0 == other CAN.

◆ OPENLCBFRAME_SHIFT

lcc::CANHeader::OPENLCBFRAME_SHIFT
staticprivate

Bit 27 is the OpenLCB bit: 1 == OpenLCB, 0 == other CAN.

◆ RESERVED_SHIFT

lcc::CANHeader::RESERVED_SHIFT
staticprivate

Bit 28 is reserved and always 1.

◆ SRCID_MASK

lcc::CANHeader::SRCID_MASK
staticprivate

Bits 0-11 are the source id.

◆ SRCID_SHIFT

lcc::CANHeader::SRCID_SHIFT
staticprivate

Bits 0-11 are the source id.

◆ VARIABLEFIELD_MASK

lcc::CANHeader::VARIABLEFIELD_MASK
staticprivate

Bits 12-26 are the variable field.

◆ VARIABLEFIELD_SHIFT

lcc::CANHeader::VARIABLEFIELD_SHIFT
staticprivate

Bits 12-26 are the variable field.