Zephyr Project API 4.0.0
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
settings_handler Struct Reference

Config handlers for subtree implement a set of handler functions. More...

#include <settings.h>

Data Fields

const char * name
 Name of subtree.
 
int cprio
 Priority of commit, lower value is higher priority.
 
int(* h_get )(const char *key, char *val, int val_len_max)
 Get values handler of settings items identified by keyword names.
 
int(* h_set )(const char *key, size_t len, settings_read_cb read_cb, void *cb_arg)
 Set value handler of settings items identified by keyword names.
 
int(* h_commit )(void)
 This handler gets called after settings has been loaded in full.
 
int(* h_export )(int(*export_func)(const char *name, const void *val, size_t val_len))
 This gets called to dump all current settings items.
 
sys_snode_t node
 Linked list node info for module internal usage.
 

Detailed Description

Config handlers for subtree implement a set of handler functions.

These are registered using a call to settings_register.

Field Documentation

◆ cprio

int settings_handler::cprio

Priority of commit, lower value is higher priority.

◆ h_commit

int(* settings_handler::h_commit) (void)

This handler gets called after settings has been loaded in full.

User might use it to apply setting to the application.

Return: 0 on success, non-zero on failure.

◆ h_export

int(* settings_handler::h_export) (int(*export_func)(const char *name, const void *val, size_t val_len))

This gets called to dump all current settings items.

This happens when settings_save tries to save the settings. Parameters:

  • export_func: the pointer to the internal function which appends a single key-value pair to persisted settings. Don't store duplicated value. The name is subtree/key string, val is the string with value.
Remarks
The User might limit a implementations of handler to serving only one keyword at one call - what will impose limit to get/set values using full subtree/key name.

Return: 0 on success, non-zero on failure.

◆ h_get

int(* settings_handler::h_get) (const char *key, char *val, int val_len_max)

Get values handler of settings items identified by keyword names.

Parameters:

  • key[in] the name with skipped part that was used as name in handler registration
  • val[out] buffer to receive value.
  • val_len_max[in] size of that buffer.

Return: length of data read on success, negative on failure.

◆ h_set

int(* settings_handler::h_set) (const char *key, size_t len, settings_read_cb read_cb, void *cb_arg)

Set value handler of settings items identified by keyword names.

Parameters:

  • key[in] the name with skipped part that was used as name in handler registration
  • len[in] the size of the data found in the backend.
  • read_cb[in] function provided to read the data from the backend.
  • cb_arg[in] arguments for the read function provided by the backend.

Return: 0 on success, non-zero on failure.

◆ name

const char* settings_handler::name

Name of subtree.

◆ node

sys_snode_t settings_handler::node

Linked list node info for module internal usage.


The documentation for this struct was generated from the following file: