Dataflow Runtime API  4.0.1.0
Public Member Functions | List of all members
imt::base::lib::remoting::DataFrame Class Reference

Representation of a package of data that gets transmitted e.g. More...

#include <Imt.Base.Lib.Remoting/DataFrame.h>

Public Member Functions

 DataFrame ()
 Constructor. More...
 
virtual ~DataFrame ()
 Destructor. More...
 
void init (DataFrame const &source)
 Initiae DataFrame with another DataFrame. More...
 
size_t getSize () const
 Returns the current size of the data frame. More...
 
size_t getCapacity () const
 Returns the maximum capacity of this data frame. More...
 
void clear ()
 Clears the content of this DataFrame. More...
 
uint8_t const * getData () const
 Returns a pointer to the first character of the frame. More...
 
bool append (uint8_t const ch)
 Appends a character at the end of this data frame. More...
 
bool setData (uint8_t const *const pData, uint32_t const dataSize)
 Sets data. More...
 
bool removeCharacter (uint8_t &ch)
 Removes a character from the end of this data frame. More...
 
bool appendCRC16 (uint16_t const initialCrcValue=0xFFFFU)
 Calculates and appends a 2 byte crc. More...
 
bool checkCRC16 (uint16_t const initialCrcValue=0xFFFFU) const
 Checks if the crc 16 is valid. More...
 
bool removeCRC16 ()
 Checks and removes a 2 byte crc. More...
 

Detailed Description

Representation of a package of data that gets transmitted e.g.

over a serial connection.

Constructor & Destructor Documentation

◆ DataFrame()

imt::base::lib::remoting::DataFrame::DataFrame ( )
explicit

Constructor.

◆ ~DataFrame()

virtual imt::base::lib::remoting::DataFrame::~DataFrame ( )
virtual

Destructor.

Member Function Documentation

◆ append()

bool imt::base::lib::remoting::DataFrame::append ( uint8_t const  ch)

Appends a character at the end of this data frame.

Parameters
chThe character to add
Returns
True if the character could be added.

◆ appendCRC16()

bool imt::base::lib::remoting::DataFrame::appendCRC16 ( uint16_t const  initialCrcValue = 0xFFFFU)

Calculates and appends a 2 byte crc.

Parameters
initialCrcValueseed value for the CRC16 calculation
Returns
True if the CRC could be calculated and appended.

◆ checkCRC16()

bool imt::base::lib::remoting::DataFrame::checkCRC16 ( uint16_t const  initialCrcValue = 0xFFFFU) const

Checks if the crc 16 is valid.

Parameters
initialCrcValueseed value for the CRC16 calculation
Returns
True if the check succeeded, false otherwise

◆ clear()

void imt::base::lib::remoting::DataFrame::clear ( )

Clears the content of this DataFrame.

◆ getCapacity()

size_t imt::base::lib::remoting::DataFrame::getCapacity ( ) const

Returns the maximum capacity of this data frame.

Returns
maximum capacity of this data frame

◆ getData()

uint8_t const* imt::base::lib::remoting::DataFrame::getData ( ) const

Returns a pointer to the first character of the frame.

Returns
pointer to the first character of the frame

◆ getSize()

size_t imt::base::lib::remoting::DataFrame::getSize ( ) const
inline

Returns the current size of the data frame.

Returns
current size of the data frame

◆ init()

void imt::base::lib::remoting::DataFrame::init ( DataFrame const &  source)

Initiae DataFrame with another DataFrame.

Parameters
sourceThe DataFrame to initiate this

◆ removeCharacter()

bool imt::base::lib::remoting::DataFrame::removeCharacter ( uint8_t ch)

Removes a character from the end of this data frame.

Parameters
chThe character to remove
Returns
false if buffer was empty.

◆ removeCRC16()

bool imt::base::lib::remoting::DataFrame::removeCRC16 ( )

Checks and removes a 2 byte crc.

Returns
False if size of data frame is too small

◆ setData()

bool imt::base::lib::remoting::DataFrame::setData ( uint8_t const *const  pData,
uint32_t const  dataSize 
)

Sets data.

Parameters
pDataPointer to the data buffer to be set
dataSizeSize of the data buffer
Returns
True if the capacity was sufficient and the data could be written.

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