param_export: add optional filter method

This commit is contained in:
Beat Küng
2020-10-12 15:22:26 +02:00
parent f927cacd9c
commit f6e8ddfaa0
6 changed files with 29 additions and 13 deletions
@@ -76,7 +76,7 @@ struct param_wbuf_s {
};
static int
param_export_internal(bool only_unsaved)
param_export_internal(bool only_unsaved, param_filter_func filter)
{
struct param_wbuf_s *s = nullptr;
struct bson_encoder_s encoder;
@@ -105,6 +105,10 @@ param_export_internal(bool only_unsaved)
continue;
}
if (filter && !filter(s->param)) {
continue;
}
s->unsaved = false;
/* append the appropriate BSON type object */
@@ -345,9 +349,9 @@ out:
return result;
}
int flash_param_save(bool only_unsaved)
int flash_param_save(bool only_unsaved, param_filter_func filter)
{
return param_export_internal(only_unsaved);
return param_export_internal(only_unsaved, filter);
}
int flash_param_load()