@@ -211,14 +211,29 @@ void from_json(nlohmann::json const& j, homescreenConfig& o) {
211211 }
212212}
213213
214+ void to_json (nlohmann::json& j, screensaverConfig const & o) {
215+ j = nlohmann::json{ { " enabled" , o.getEnabled () },
216+ { " timeout_millis" , o.getTimeoutMillis () } };
217+ }
218+
219+ void from_json (nlohmann::json const & j, screensaverConfig& o) {
220+ if (j.contains (" enabled" ) && j[" enabled" ].is_boolean ()) {
221+ o.setEnabled (j[" enabled" ]);
222+ }
223+ if (j.contains (" timeout_millis" )) {
224+ o.setTimeoutMillis (j[" timeout_millis" ]);
225+ }
226+ }
227+
214228void to_json (nlohmann::json& j, Settings const & o) {
215229 j = nlohmann::json{ { " ftp" , nlohmann::json (o.ftp ) },
216230 { " mount" , nlohmann::json (o.mount ) },
217231#ifdef NXDK
218232 { " network" , nlohmann::json (o.net ) },
219233#endif
220234 { " logging" , nlohmann::json (o.logging ) },
221- { " homescreenConfig" , nlohmann::json (o.homescreen ) } };
235+ { " homescreen" , nlohmann::json (o.homescreen ) },
236+ { " screensaver" , nlohmann::json (o.screensaver ) } };
222237}
223238
224239void from_json (nlohmann::json const & j, Settings& o) {
@@ -242,6 +257,9 @@ void from_json(nlohmann::json const& j, Settings& o) {
242257 if (j.contains (" homescreen" )) {
243258 o.homescreen = j[" homescreen" ].get <homescreenConfig>();
244259 }
260+ if (j.contains (" screensaver" )) {
261+ o.screensaver = j[" screensaver" ].get <screensaverConfig>();
262+ }
245263}
246264
247265Config::Config () {
0 commit comments