DataStructures 1.6.16
A small compiled C library of data structures used in the NHP wrist center-out and other tasks.
Loading...
Searching...
No Matches
Message Formatting

Message handler functions for serializing and desiarilizing byte messages. More...

Functions

void packTargetData (const RenderedCircleData *target, uint8_t targetIndex, char *buffer)
 Packs target data into a string buffer for transmission.
 
void unpackTargetData (RenderedCircleData **targets, const char *buffer)
 Unpacks target data from a received message and updates the targets array.
 
void packCursorData (const RenderedCircleData *cursor, char *buffer)
 Packs cursor data into a string buffer for transmission.
 
void unpackCursorData (RenderedCircleData *cursor, const char *buffer)
 Unpacks cursor data from a received message and updates the cursor position.
 
void packStateData (const StateData *stateData, char *buffer)
 Packs StateData struct into a byte buffer.
 
void unpackStateData (StateData *stateData, const char *buffer)
 Unpacks byte buffer into StateData struct.
 

Detailed Description

Message handler functions for serializing and desiarilizing byte messages.

Function Documentation

◆ packCursorData()

void packCursorData ( const RenderedCircleData * cursor,
char * buffer )

Packs cursor data into a string buffer for transmission.

This function packs the x and y coordinates of the cursor into a comma-separated string.

Parameters
cursorPointer to the RenderedCircleData structure representing the cursor data.
bufferPointer to the buffer where the packed data will be stored.

◆ packStateData()

void packStateData ( const StateData * stateData,
char * buffer )

Packs StateData struct into a byte buffer.

Parameters
stateDataPointer to the StateData struct to pack.
bufferPointer to the byte buffer where packed data will be stored.

◆ packTargetData()

void packTargetData ( const RenderedCircleData * target,
uint8_t targetIndex,
char * buffer )

Packs target data into a string buffer for transmission.

This function packs messages in the format "x,y,radius,render,targetIndex".

Parameters
targetPointer to the RenderedCircleData structure representing the target data.
targetIndexIndex of the target.
bufferPointer to the buffer where the packed data will be stored.

◆ unpackCursorData()

void unpackCursorData ( RenderedCircleData * cursor,
const char * buffer )

Unpacks cursor data from a received message and updates the cursor position.

This function assumes that the received message is in the format "x,y".

Parameters
cursorPointer to the RenderedCircleData structure representing the cursor.
bufferPointer to the buffer containing the received message.

◆ unpackStateData()

void unpackStateData ( StateData * stateData,
const char * buffer )

Unpacks byte buffer into StateData struct.

Parameters
stateDataPointer to the StateData struct to populate.
bufferPointer to the byte buffer containing packed data.

◆ unpackTargetData()

void unpackTargetData ( RenderedCircleData ** targets,
const char * buffer )

Unpacks target data from a received message and updates the targets array.

This function assumes that the received message is in the format "x,y,radius,render,targetIndex".

Parameters
targetsArray of pointers to RenderedCircleData structures representing the targets.
bufferPointer to the buffer containing the received message.