IoT::CANopen

class CANFrame

File Information

Library: IoT/CANopen
Package: CANcore
Header: IoT/CANopen/CANFrame.h

Description

This class stores a complete CAN frame, which can either be in CAN base frame or a CAN extended frame format.

Member Summary

Member Functions: assign, data, dlc, flags, id, operator =, swap

Types

DLC

typedef Poco::UInt8 DLC;

CAN Data Length Code (0 - 8).

Flags

typedef Poco::UInt8 Flags;

CAN frame flags - IDE, RTR, SRR and error frame indicator.

ID

typedef Poco::UInt32 ID;

The 11 bit (base frame) or 29 bit (extended frame) CAN identifier.

Enumerations

Flag

CAN_FLAG_NONE = 0

No flags set.

CAN_FLAG_IDE = 1

CAN Identifier Extension bit (signaling extended frame format).

CAN_FLAG_RTR = 2

CAN Remote Transmission Request bit.

CAN_FLAG_SRR = 4

CAN Substitute Remote Request bit (extended frame only, currently unused).

CAN_FLAG_ERR = 8

Error frame indicator.

Constructors

CANFrame

CANFrame();

Creates and empty CANFrame.

CANFrame

CANFrame(
    const CANFrame & frame
);

Creates a CANFrame by copying another one.

CANFrame

CANFrame(
    ID id,
    Flags flags,
    DLC dlc,
    const char * data
);

Creates a CANFrame with the given data. Maximum data length is 8 bytes.

Destructor

~CANFrame

~CANFrame();

Destroys the CANFrame.

Member Functions

assign

void assign(
    const CANFrame & frame
);

Copies data and flags over from another CANFrame.

assign

void assign(
    ID id,
    Flags flags,
    DLC dlc,
    const char * data
);

Changes the frame's data to the given.

data inline

const char * data() const;

Returns a pointer to the internal buffer containing the data.

dlc inline

DLC dlc() const;

Returns the length of the data (Data Length Code).

flags inline

Flags flags() const;

Returns the flags of the frame.

id inline

ID id() const;

Returns the ID of the frame.

operator =

CANFrame & operator = (
    const CANFrame & frame
);

Copies data and flags over from another CANFrame.

swap

void swap(
    CANFrame & frame
);

Swaps the contents of the frame with those of another.

Securely control IoT edge devices from anywhere   Connect a Device