DataFrame  1.0.0
Public Member Functions | List of all members
DataFrame Class Reference

Class for representing data frame. More...

#include <dataframe.h>

Public Member Functions

 DataFrame (uint8_t *frame, uint8_t size, DataframeType_t type, DataframeCrc_t)
 
void Init (void)
 Initialize packet. More...
 
bool AddUint8 (uint8_t d)
 Add one byte to data frame. More...
 
bool AddUint16 (uint16_t d)
 add 2 Bytes length variable to dataframe More...
 
bool AddUint32 (uint32_t)
 add 4 Bytes long variable to dataframe More...
 
bool AddInt8 (int8_t d)
 add one byte signed variable to data frame More...
 
bool AddInt16 (int16_t)
 add 2 bytes length signed variable to data frame More...
 
bool AddInt32 (int32_t)
 add 4 bytes length signed variable to data frame More...
 
bool AddFloat (float)
 add float value to data frame. Float value is encoded to 4 bytes according IEEE 754 More...
 
uint8_t Commit (void)
 Commit the creation of the packet. More...
 
uint8_t * GetFrame (void)
 Return pointer to data frame. More...
 
DataframeError_t getError (void)
 Return error status from data processing. More...
 

Detailed Description

Class for representing data frame.

Constructor & Destructor Documentation

◆ DataFrame()

DataFrame::DataFrame ( uint8_t *  frame,
uint8_t  size,
DataframeType_t  type,
DataframeCrc_t  useCrc 
)

Constructor.

Parameters
framepointer to existing byte array
sizesize of buffer frame

Member Function Documentation

◆ AddFloat()

bool DataFrame::AddFloat ( float  f)

add float value to data frame. Float value is encoded to 4 bytes according IEEE 754

Parameters
dvariable added to data frame
Returns
true, if it is success

◆ AddInt16()

bool DataFrame::AddInt16 ( int16_t  d)

add 2 bytes length signed variable to data frame

Parameters
dvariable added to data frame
Returns
true, if it is success

◆ AddInt32()

bool DataFrame::AddInt32 ( int32_t  d)

add 4 bytes length signed variable to data frame

Parameters
dvariable added to data frame
Returns
true, if it is success

◆ AddInt8()

bool DataFrame::AddInt8 ( int8_t  d)

add one byte signed variable to data frame

Parameters
dvariable added to data frame
Returns
true, if it is success

◆ AddUint16()

bool DataFrame::AddUint16 ( uint16_t  d)

add 2 Bytes length variable to dataframe

Parameters
dvariable added to data frame
Returns
true, if it is success

◆ AddUint32()

bool DataFrame::AddUint32 ( uint32_t  d)

add 4 Bytes long variable to dataframe

Parameters
dvariable added to data frame
Returns
true, if it is success

◆ AddUint8()

bool DataFrame::AddUint8 ( uint8_t  d)

Add one byte to data frame.

Returns
true, if it is success

◆ Commit()

uint8_t DataFrame::Commit ( void  )

Commit the creation of the packet.

  • add to second position (frame[1]) length of packet
  • compute CRC of packet
    Returns
    real length of packet (including CRC byte)

◆ getError()

DataframeError_t DataFrame::getError ( void  )

Return error status from data processing.

Returns
0 - no error, 1 - internal buffer overflow. The buffer have to be increased in user code.

◆ GetFrame()

uint8_t * DataFrame::GetFrame ( void  )

Return pointer to data frame.

Returns
resulting packet

◆ Init()

void DataFrame::Init ( void  )

Initialize packet.

  • set the header of packet
  • reserver 1st byte to length of frame

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