Zephyr API Documentation  3.7.0
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
settings_handler_static Struct Reference

Config handlers without the node element, used for static handlers. More...

#include <settings.h>

Data Fields

const char * name
 Name of subtree.
 
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.
 

Detailed Description

Config handlers without the node element, used for static handlers.

These are registered using a call to SETTINGS_STATIC_HANDLER_DEFINE().

Field Documentation

◆ h_commit

int(* settings_handler_static::h_commit) (void)

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

User might use it to apply setting to the application.

◆ h_export

int(* settings_handler_static::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_static::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_static::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_static::name

Name of subtree.


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