There is a lot of functions in the system that handles read/write operations on buffers. Very often it is required to pass the buffer size and address to the function and also request about number of bytes that has been read/written. It has to be implemented in each module separately. The idea of the task is to prepare a simple module that helps in such operations. The module should be implemented as part of the Library Space in files oc_datapackage.h and oc_datapackage.c.
Example of usage
voidWriteData(constvoid*Buffer,oC_MemorySize_t*Size){oC_DataPackage_tdataPackage;// We give here pointer to the dataPackage,// pointer to the buffer with data,// size of the buffer,// number of bytes of data in the buffer// And flag set to true if the buffer is for reading onlyoC_DataPackage_Initialize(&dataPackage,Buffer,*Size,*Size,true);// We read data from the buffer as long as it is no empty and we can send the bytewhile(!oC_DataPackage_IsEmpty(&dataPackage)&&SendByte(oC_DataPackage_GetDataU8(&dataPackage)));// At the end we can set the number of sent data in the `Size` function parameter*Size-=oC_DataPackage_GetLeftSize(&dataPackage);}