Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

subsys: settings: Idea for a very simple settings system #8378

Closed
Laczen opened this issue Jun 14, 2018 · 0 comments

Comments

Projects
None yet
2 participants
@Laczen
Copy link
Collaborator

commented Jun 14, 2018

The way the settings system is extended for bt-mesh storage inspired me to a very simple settings system that could be easily used by multiple subsystems and also the user application:

Instead of using names to identify storage items id are used. Each subsystem that requires settings storage registers its own set, commit and export handles for a range of id's that it will use. The method for this is similar to BT_SETTINGS_DEFINE as defined in settings.h (bluetooth/host/settings.h). The settings module itself just calls the required handle based upon the id of the setting (similar to the set, commit and export routines in bluetooth/host/settings.c). The subsystem that requires settings can then further divide the range into smaller ranges (like is done in bluetooth/host/mesh/settings.c) but this is invisible to the settings module.

At start the settings module can read through the file with settings and determine based upon the id which (subsystem) set routine it has to call. The storage of an id-value is also very easy to do in fcb, nffs and also nvs. For nffs it might be required to encode the data, but for fcb and nvs it is not required. For fcb the entry could contain the id at the end, for nvs the id is already available.

The advantages would be:

  1. Very simple settings subsystem,
  2. Reduction of flash storage requirements (a id takes up a lot less space than a name),
  3. Easy to expand to other filesystems .

@nashif nashif added the RFC label Jun 14, 2018

@Laczen Laczen closed this Jul 11, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.