@@ -101,6 +101,39 @@ void wcli_scshot(char *args, Stream *response)
101101 }
102102}
103103
104+ /* *
105+ * @brief list of user preference key. This depends of EasyPreferences manifest.
106+ * @author @Hpsaturn. Method migrated from CanAirIO project
107+ */
108+ void wcli_klist (char *args, Stream *response) {
109+ Pair<String, String> operands = wcli.parseCommand (args);
110+ String opt = operands.first ();
111+ response->printf (" \n %11s \t %s \t %s \r\n " , " KEYNAME" , " DEFINED" , " VALUE" );
112+ response->printf (" \n %11s \t %s \t %s \r\n " , " =======" , " =======" , " =====" );
113+
114+ for (int i = PKEYS::KUSER+1 ; i < PKEYS::KCOUNT; i++) {
115+ String key = cfg.getKey ((CONFKEYS)i);
116+ bool isDefined = cfg.isKey (key);
117+ String defined = isDefined ? " custom " : " default" ;
118+ String value = " " ;
119+ if (isDefined) value = cfg.getValue (key);
120+ response->printf (" %11s \t %s \t %s \r\n " , key, defined .c_str (), value.c_str ());
121+ }
122+ }
123+
124+ /* *
125+ * @brief set an user preference key. This depends of EasyPreferences manifest.
126+ * @author @Hpsaturn. Method migrated from CanAirIO project
127+ */
128+ void wcli_kset (char *args, Stream *response) {
129+ Pair<String, String> operands = wcli.parseCommand (args);
130+ String key = operands.first ();
131+ String v = operands.second ();
132+ if (cfg.saveAuto (key,v)){
133+ response->printf (" saved key %s\t : %s\r\n " , key, v);
134+ }
135+ }
136+
104137void wcli_waypoint (char *args, Stream *response)
105138{
106139 Pair<String, String> operands = wcli.parseCommand (args);
@@ -280,7 +313,6 @@ void wcli_settings(char *args, Stream *response)
280313 }
281314}
282315
283-
284316void wcli_webfile (char *args, Stream *response)
285317{
286318 Pair<String, String> operands = wcli.parseCommand (args);
@@ -327,6 +359,8 @@ void initShell(){
327359 wcli.add (" waypoint" , &wcli_waypoint, " \t waypoint utilities" );
328360 wcli.add (" settings" , &wcli_settings, " \t device settings" );
329361 wcli.add (" webfile" , &wcli_webfile, " \t enable/disable Web file server" );
362+ wcli.add (" klist" , &wcli_klist, " \t\t list of user extra preferences" );
363+ wcli.add (" kset" , &wcli_kset, " \t\t set an user extra preference" );
330364 wcli.begin (" IceNav" );
331365}
332366
0 commit comments