cisst-saw
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Types | Public Member Functions | Protected Attributes | Friends | List of all members
osaCANBusFrame Class Reference

CAN frame implementation. More...

#include <osaCANBusFrame.h>

Inheritance diagram for osaCANBusFrame:
mtsCANBusFrame

Public Types

typedef unsigned short ID
 The id of a CAN frame. More...
 
typedef unsigned short Mask
 
typedef unsigned char Data
 The data type. More...
 
typedef Data DataField [8]
 The field of data. More...
 
typedef unsigned char DataLength
 The data length type. More...
 

Public Member Functions

 osaCANBusFrame ()
 Default constructor. More...
 
 osaCANBusFrame (ID canid, DataField data, DataLength nbytes)
 Overloaded constructor. More...
 
 osaCANBusFrame (ID canid, const vctDynamicVector< Data > &data)
 
ID GetID () const
 Return the identifier of the frame. More...
 
DataLength GetLength () const
 Return the length in bytes of the data. More...
 
DataGetData ()
 Return a pointer to the data. More...
 
const DataGetData () const
 Return a const pointer to the data. More...
 

Protected Attributes

ID id
 The ID of the node origin. More...
 
DataField data
 The message (8 bytes) More...
 
DataLength nbytes
 The lenght of the message in bytes. More...
 

Friends

std::ostream & operator<< (std::ostream &os, const osaCANBusFrame &frame)
 Output the can frame. More...
 

Detailed Description

CAN frame implementation.

This defines a basic CAN frame. It does not support the extended frame format. The frame is composed of an identifier, 8 bytes of data and a data length. A CAN frame contain an 11 bits identifier, 0-8 bytes of data and a data length code (0-8). This class does not support the extended frame format.

Member Typedef Documentation

typedef unsigned char osaCANBusFrame::Data

The data type.

typedef Data osaCANBusFrame::DataField[8]

The field of data.

typedef unsigned char osaCANBusFrame::DataLength

The data length type.

typedef unsigned short osaCANBusFrame::ID

The id of a CAN frame.

A CAN ID has 11 bits so we use 16 bits to represent a CAN id of which only the 11 LSB are used.

typedef unsigned short osaCANBusFrame::Mask

Constructor & Destructor Documentation

osaCANBusFrame::osaCANBusFrame ( )

Default constructor.

Set the IDs to "0" the message length to "0" and all the message bytes to "0"

osaCANBusFrame::osaCANBusFrame ( ID  canid,
DataField  data,
DataLength  nbytes 
)

Overloaded constructor.

Set the id of the CAN frame and the message

osaCANBusFrame::osaCANBusFrame ( ID  canid,
const vctDynamicVector< Data > &  data 
)

Member Function Documentation

Data* osaCANBusFrame::GetData ( void  )
inline

Return a pointer to the data.

const Data* osaCANBusFrame::GetData ( void  ) const
inline

Return a const pointer to the data.

ID osaCANBusFrame::GetID ( ) const
inline

Return the identifier of the frame.

DataLength osaCANBusFrame::GetLength ( ) const
inline

Return the length in bytes of the data.

Friends And Related Function Documentation

std::ostream& operator<< ( std::ostream &  os,
const osaCANBusFrame frame 
)
friend

Output the can frame.

Prints out the frame's identifier, data length and data

Parameters
os[in]An ouptput stream
cf[in]A CAN frame

Member Data Documentation

DataField osaCANBusFrame::data
protected

The message (8 bytes)

ID osaCANBusFrame::id
protected

The ID of the node origin.

DataLength osaCANBusFrame::nbytes
protected

The lenght of the message in bytes.


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