Skip to content

Commit

Permalink
Toolbox: add saved struct documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
skotopes committed Mar 25, 2024
1 parent 1a8955a commit 1dea549
Showing 1 changed file with 36 additions and 0 deletions.
36 changes: 36 additions & 0 deletions lib/toolbox/saved_struct.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
/**
* @file saved_struct.h
* @brief SavedStruct - data serialization/de-serialization
*
*/
#pragma once

#include <stdint.h>
Expand All @@ -8,15 +13,46 @@
extern "C" {
#endif

/** Load data from the file in saved structure format
*
* @param[in] path The path to the file
* @param[out] data Pointer to the memory where to load data
* @param[in] size The size of the data
* @param[in] magic The magic to embed into metadata
* @param[in] version The version to embed into metadata
*
* @return true on success, false otherwise
*/
bool saved_struct_load(const char* path, void* data, size_t size, uint8_t magic, uint8_t version);

/** Save data in saved structure format
*
* @param[in] path The path to the file
* @param[in] data Pointer to the memory where data
* @param[in] size The size of the data
* @param[in] magic The magic to embed into metadata
* @param[in] version The version to embed into metadata
*
* @return true on success, false otherwise
*/
bool saved_struct_save(
const char* path,
const void* data,
size_t size,
uint8_t magic,
uint8_t version);

/** Get SavedStructure file metadata
*
* @param[in] path The path to the file
* @param[out] magic Pointer to store magic or NULL if you don't need it
* @param[out] version Pointer to store version or NULL if you don't need
* it
* @param[out] payload_size Pointer to store payload size or NULL if you don't
* need it
*
* @return true on success, false otherwise
*/
bool saved_struct_get_metadata(
const char* path,
uint8_t* magic,
Expand Down

0 comments on commit 1dea549

Please sign in to comment.