Flipper Zero Firmware
Loading...
Searching...
No Matches
saved_struct.h File Reference

SavedStruct - data serialization/de-serialization. More...

#include <stdint.h>
#include <stdbool.h>
#include <stddef.h>

Go to the source code of this file.

Functions

bool saved_struct_load (const char *path, void *data, size_t size, uint8_t magic, uint8_t version)
 Load data from the file in saved structure format.
 
bool saved_struct_save (const char *path, const void *data, size_t size, uint8_t magic, uint8_t version)
 Save data in saved structure format.
 
bool saved_struct_get_metadata (const char *path, uint8_t *magic, uint8_t *version, size_t *payload_size)
 Get SavedStructure file metadata.
 

Detailed Description

SavedStruct - data serialization/de-serialization.

Function Documentation

◆ saved_struct_get_metadata()

bool saved_struct_get_metadata ( const char * path,
uint8_t * magic,
uint8_t * version,
size_t * payload_size )

Get SavedStructure file metadata.

Parameters
[in]pathThe path to the file
[out]magicPointer to store magic or NULL if you don't need it
[out]versionPointer to store version or NULL if you don't need it
[out]payload_sizePointer to store payload size or NULL if you don't need it
Returns
true on success, false otherwise

◆ saved_struct_load()

bool saved_struct_load ( const char * path,
void * data,
size_t size,
uint8_t magic,
uint8_t version )

Load data from the file in saved structure format.

Parameters
[in]pathThe path to the file
[out]dataPointer to the memory where to load data
[in]sizeThe size of the data
[in]magicThe magic to embed into metadata
[in]versionThe version to embed into metadata
Returns
true on success, false otherwise

◆ saved_struct_save()

bool saved_struct_save ( const char * path,
const void * data,
size_t size,
uint8_t magic,
uint8_t version )

Save data in saved structure format.

Parameters
[in]pathThe path to the file
[in]dataPointer to the memory where data
[in]sizeThe size of the data
[in]magicThe magic to embed into metadata
[in]versionThe version to embed into metadata
Returns
true on success, false otherwise