This patch reworks routines used to store and read the settings data. Provide stream-style encoding and decoding to/from flash, so the the API only requires a pointer to binary data, and the settings implementation takes care of encoding/decoding to/from base64 and writing/reading to/from flash on the fly. This would eliminate the need of a separate base64 value buffer on the application-side, thereby further contributing to the stack footprint reduction. Above changes allows to remove: 256-byte value length limitation. removing enum settings_type usage so all settings data are treated now as a byte array (i.e. what's previously SETTINGS_BYTES) Introduced routine settings_val_read_cb for read and decode the settings data from storage inside h_set handler implementations. h_set settings handler now provide persistent value's context used along with read routine instead of immediately value. Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
32 lines
579 B
C
32 lines
579 B
C
/*
|
|
* Copyright (c) 2018 Nordic Semiconductor ASA
|
|
* Copyright (c) 2015 Runtime Inc
|
|
*
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
*/
|
|
|
|
#ifndef __SETTINGS_FCB_H_
|
|
#define __SETTINGS_FCB_H_
|
|
|
|
#include <fcb.h>
|
|
#include "settings/settings.h"
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
struct settings_fcb {
|
|
struct settings_store cf_store;
|
|
struct fcb cf_fcb;
|
|
};
|
|
|
|
extern int settings_fcb_src(struct settings_fcb *cf);
|
|
extern int settings_fcb_dst(struct settings_fcb *cf);
|
|
void settings_mount_fcb_backend(struct settings_fcb *cf);
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
|
|
#endif /* __SETTINGS_FCB_H_ */
|