David Smart / CANMessage
Embed: (wiki syntax)

« Back to documentation index

CANmsg Class Reference

CANmsg Class Reference

A super CAN message object, which has additional capabilities. More...

#include <CANMessage.h>

Public Member Functions

 CANmsg ()
 Constructor for a CANmsg object, which is a superclass of CANMessage.
 CANmsg (CANCHANNEL_T ch, CANDIR_T dir, CANMessage msg)
 Constructor for a CANmsg object, which is a superclass of CANMessage.
 CANmsg (char *p)
 Constructor for a CANmsg object, which is a superclass of CANMessage.
 ~CANmsg ()
 Destructor for the CANmsg object.
bool ParseCANMessage (char *p)
 Parse a text string into the CANmsg object, which is a superclass of CANMessage.
void FormatCANMessage (char *buffer, int buflen)
 Formats this CAN message into a text buffer - which should be at least 70.
void SetTimestamp ()
 Overrides the timestamp in this message with the current time.
uint64_t GetTimestamp ()
 Gets the timestamp of this message.

Data Fields

CANDIR_T dir
 direction of this CAN message - rcv or xmt
CANCHANNEL_T ch
 channel number of this CAN message

Detailed Description

A super CAN message object, which has additional capabilities.

This object is derived from CANMessage, however it adds a timestamp and other useful methods.

Definition at line 50 of file CANMessage.h.


Constructor & Destructor Documentation

CANmsg (  )

Constructor for a CANmsg object, which is a superclass of CANMessage.

The CANmsg object included additional information, including direction, channel number, timestamp, and the ability to format into ASCII

Definition at line 31 of file CANMessage.cpp.

CANmsg ( CANCHANNEL_T  ch,
CANDIR_T  dir,
CANMessage  msg 
)

Constructor for a CANmsg object, which is a superclass of CANMessage.

The CANmsg object included additional information, including direction, channel number, timestamp, and the ability to format into ASCII.

Parameters:
chis the channel number (CH1, CH2)
diris the direction (xmt, rcv)
msgis a CANMessage object from which to construct this object

Definition at line 39 of file CANMessage.cpp.

CANmsg ( char *  p )

Constructor for a CANmsg object, which is a superclass of CANMessage.

The CANmsg object included additional information, including direction, channel number, timestamp, and the ability to format into ASCII. This constructor creates a message from an ascii buffer with the standard message format in it.

    /// t xtd 02 1CF00400 08 11 22 33 44 55 66 77 88 0   0 1234.567890
    /// If the first letter is not 't' or 'r', transmit is assumed
    ///   xtd 02 1CF00400 08 11 22 33 44 55 66 77 88 0   0 1234.567890
    /// 
Parameters:
pis a pointer to a text string of the message contents, in the same format as what would be output with the FormatCANMessage method.

Definition at line 60 of file CANMessage.cpp.

~CANmsg (  )

Destructor for the CANmsg object.

Definition at line 68 of file CANMessage.cpp.


Member Function Documentation

void FormatCANMessage ( char *  buffer,
int  buflen 
)

Formats this CAN message into a text buffer - which should be at least 70.

    /// t xtd 02 1CF00400 08 11 22 33 44 55 66 77 88 0   0 1234.567890
    /// 
Parameters:
bufferis a pointer to the buffer to fill
buflenis the size of the buffer (minimum 70 recommended)
Returns:
nothing

Definition at line 114 of file CANMessage.cpp.

uint64_t GetTimestamp (  )

Gets the timestamp of this message.

Returns:
time in microseconds

Definition at line 139 of file CANMessage.h.

bool ParseCANMessage ( char *  p )

Parse a text string into the CANmsg object, which is a superclass of CANMessage.

The CANmsg object included additional information, including direction, channel number, timestamp, and the ability to format into ASCII. This constructor creates a message from an ascii buffer with the standard message format in it.

    /// t xtd 02 1CF00400 08 11 22 33 44 55 66 77 88 0   0 1234.567890
    /// If the first letter is not 't' or 'r', transmit is assumed
    ///   xtd 02 1CF00400 08 11 22 33 44 55 66 77 88 0   0 1234.567890
    /// 
Parameters:
pis a pointer to a text string of the message contents, in the same format as what would be output with the FormatCANMessage method.
Returns:
true

Definition at line 71 of file CANMessage.cpp.

void SetTimestamp (  )

Overrides the timestamp in this message with the current time.

Definition at line 108 of file CANMessage.cpp.


Field Documentation

channel number of this CAN message

Definition at line 145 of file CANMessage.h.

direction of this CAN message - rcv or xmt

Definition at line 139 of file CANMessage.h.