ReduxLib C++ 2025.0.0-beta2
Loading...
Searching...
No Matches
redux::canand::CanandMessage Class Reference

#include <CanandMessage.h>

Public Member Functions

 CanandMessage (uint8_t busDescriptor, uint32_t id, uint64_t timestamp, uint8_t dataLen, uint8_t *dataBuf)
 
uint32_t GetId ()
 
uint8_t GetApiIndex ()
 
uint8_t GetDeviceId ()
 
uint8_t GetApiPage ()
 
uint8_t GetDeviceType ()
 
uint8_t * GetData ()
 
uint8_t GetLength ()
 
units::second_t GetTimestamp ()
 
CANBus GetBus ()
 

Detailed Description

Class that represents a CAN message received from the Redux CanandEventLoop

This class is generally initialized by the event loop from a raw struct packet from the driver that gets read out and parsed. From there, it is then passed into CanandDevice::HandleMessage if it matches the address.

Of particular note are GetData() to get a handle to the packet's data and GetApiIndex() to see what type of packet it is.

Constructor & Destructor Documentation

◆ CanandMessage()

redux::canand::CanandMessage::CanandMessage ( uint8_t  busDescriptor,
uint32_t  id,
uint64_t  timestamp,
uint8_t  dataLen,
uint8_t *  dataBuf 
)
inline

Construct a new CanandMessage from a bunch of parts – not intended to be instantiated directly

Parameters
busDescriptorbus descriptor value
idcan arbitration message id
timestampCAN message timestamp (milliseconds)
dataLendata size (1-8)
dataBufpointer to data buffer

Member Function Documentation

◆ GetApiIndex()

uint8_t redux::canand::CanandMessage::GetApiIndex ( )
inline

Gets the 8-bit CAN API index.

This is the value that generally describes what type of CAN message was sent.

Returns
the CAN API index.

◆ GetApiPage()

uint8_t redux::canand::CanandMessage::GetApiPage ( )
inline

Gets the 2-bit API page.

API page distinguishes between different API index banks.

Returns
the product id.

◆ GetBus()

CANBus redux::canand::CanandMessage::GetBus ( )
inline

Gets an object representing the CAN bus that received the message

Returns
CANBus object

◆ GetData()

uint8_t * redux::canand::CanandMessage::GetData ( )
inline

Gets the CAN message payload (up to 8 bytes).

The length of the array is determined by how many bytes were in the original CAN packet.

Returns
pointer to bytes that is 1-8 bytes long.

◆ GetDeviceId()

uint8_t redux::canand::CanandMessage::GetDeviceId ( )
inline

Gets the 6-bit CAN Device id.

This is the user-adjustible "CAN Id" of the associated CAN device in question.

Returns
the device id.

◆ GetDeviceType()

uint8_t redux::canand::CanandMessage::GetDeviceType ( )
inline

Gets the 5-bit device type code

Product ID/ device type combinations will be unique to a Redux product.

Returns
the device type code.

◆ GetId()

uint32_t redux::canand::CanandMessage::GetId ( )
inline

Gets the full 29-bit CAN message id.

A summary of how the CAN message id works is described in CanandAddress.

Returns
The full 29-bit message id.

◆ GetLength()

uint8_t redux::canand::CanandMessage::GetLength ( )
inline

Gets the length of the CAN message's data in bytes.

Returns
length (1-8)

◆ GetTimestamp()

units::second_t redux::canand::CanandMessage::GetTimestamp ( )
inline

Gets the CAN message timestamp, in seconds. The time base is relative to the FPGA timestamp.

Returns
timestamp in seconds.

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