IoT::CAN

class CANFrame

File Information

Library: IoT/CAN
Package: CANFrame
Header: IoT/CAN/CANFrame.h

Description

A CAN frame.

Member Summary

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

Types

DLC

typedef Poco::UInt8 DLC;

Flags

typedef Poco::UInt8 Flags;

ID

typedef Poco::UInt32 ID;

Payload

typedef Poco::Array < char, 8 > Payload;

Enumerations

Anonymous

MAX_PAYLOAD_SIZE = 8

Flag

CAN_FLAG_NONE = 0

No flags set

CAN_FLAG_IDE = 1

CAN Identifier Extension bit (signalling 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 Payload & payload
);

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

CANFrame

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

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 * payload
);

Changes the frame's data to the given.

assign

void assign(
    ID id,
    Flags flags,
    DLC dlc,
    const Payload & payload
);

Changes the frame's data to the given.

dlc inline

DLC dlc() const;

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

dlc

void dlc(
    DLC len
);

Sets the Data Length Code.

flags inline

Flags flags() const;

Returns the flags of the frame.

flags

void flags(
    Flags f
);

Sets the flags.

id inline

ID id() const;

Returns the ID of the frame.

id

void id(
    ID n
);

Sets the ID of the frame.

operator =

CANFrame & operator = (
    const CANFrame & frame
);

Copies data and flags over from another CANFrame.

payload inline

const Payload & payload() const;

Returns a pointer to the internal buffer containing the data.

payload

Payload & payload();

Returns a pointer to the internal buffer containing the data.

payload

void payload(
    const Payload & p
);

Sets the payload.

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