#ifndef _SERIALIZATION_H #define _SERIALIZATION_H #ifdef __cplusplus extern "C" { #endif #include /* Struct used to hold the data that will be sent between sockets */ typedef struct { uint16_t pad_x; uint16_t pad_y; uint16_t ball_x; uint16_t ball_y; } Serial_Data; /* Create a Serial_Data struct from float values */ Serial_Data Serial_create_data(float pad_x, float pad_y, float ball_x, float ball_y); /* Serialize a struct into a byte array, that can be sent through a socket */ uint8_t* Serial_serialize(Serial_Data data); /* Deserialize a byte array into a struct, and return the struct */ Serial_Data Serial_deserialize(uint8_t* serialized); #ifdef __cplusplus } #endif #endif