+ CASE_SEC("ipv6") {
+ SEC_OPEN_MAP("ipv6");
+ print_ipv6_info(json_gen, buffer, cfg_getstr(sec, "format_up"), cfg_getstr(sec, "format_down"));
+ SEC_CLOSE_MAP;
+ }
+
+ CASE_SEC_TITLE("wireless") {
+ SEC_OPEN_MAP("wireless");
+ print_wireless_info(json_gen, buffer, title, cfg_getstr(sec, "format_up"), cfg_getstr(sec, "format_down"));
+ SEC_CLOSE_MAP;
+ }
+
+ CASE_SEC_TITLE("ethernet") {
+ SEC_OPEN_MAP("ethernet");
+ print_eth_info(json_gen, buffer, title, cfg_getstr(sec, "format_up"), cfg_getstr(sec, "format_down"));
+ SEC_CLOSE_MAP;
+ }
+
+ CASE_SEC_TITLE("battery") {
+ SEC_OPEN_MAP("battery");
+ print_battery_info(json_gen, buffer, atoi(title), cfg_getstr(sec, "path"), cfg_getstr(sec, "format"), cfg_getstr(sec, "format_down"), cfg_getint(sec, "low_threshold"), cfg_getstr(sec, "threshold_type"), cfg_getbool(sec, "last_full_capacity"), cfg_getbool(sec, "integer_battery_capacity"), cfg_getbool(sec, "hide_seconds"));
+ SEC_CLOSE_MAP;
+ }
+
+ CASE_SEC_TITLE("run_watch") {
+ SEC_OPEN_MAP("run_watch");
+ print_run_watch(json_gen, buffer, title, cfg_getstr(sec, "pidfile"), cfg_getstr(sec, "format"));
+ SEC_CLOSE_MAP;
+ }
+
+ CASE_SEC_TITLE("path_exists") {
+ SEC_OPEN_MAP("path_exists");
+ print_path_exists(json_gen, buffer, title, cfg_getstr(sec, "path"), cfg_getstr(sec, "format"));
+ SEC_CLOSE_MAP;
+ }
+
+ CASE_SEC_TITLE("disk") {
+ SEC_OPEN_MAP("disk_info");
+ print_disk_info(json_gen, buffer, title, cfg_getstr(sec, "format"), cfg_getstr(sec, "prefix_type"), cfg_getstr(sec, "threshold_type"), cfg_getfloat(sec, "low_threshold"));
+ SEC_CLOSE_MAP;
+ }
+
+ CASE_SEC("load") {
+ SEC_OPEN_MAP("load");
+ print_load(json_gen, buffer, cfg_getstr(sec, "format"), cfg_getfloat(sec, "max_threshold"));
+ SEC_CLOSE_MAP;
+ }
+
+ CASE_SEC("time") {
+ SEC_OPEN_MAP("time");
+ print_time(json_gen, buffer, cfg_getstr(sec, "format"), NULL, tv.tv_sec);
+ SEC_CLOSE_MAP;
+ }
+
+ CASE_SEC_TITLE("tztime") {
+ SEC_OPEN_MAP("tztime");
+ print_time(json_gen, buffer, cfg_getstr(sec, "format"), cfg_getstr(sec, "timezone"), tv.tv_sec);
+ SEC_CLOSE_MAP;
+ }
+
+ CASE_SEC("ddate") {
+ SEC_OPEN_MAP("ddate");
+ print_ddate(json_gen, buffer, cfg_getstr(sec, "format"), tv.tv_sec);
+ SEC_CLOSE_MAP;
+ }
+
+ CASE_SEC_TITLE("volume") {
+ SEC_OPEN_MAP("volume");
+ print_volume(json_gen, buffer, cfg_getstr(sec, "format"),
+ cfg_getstr(sec, "format_muted"),
+ cfg_getstr(sec, "device"),
+ cfg_getstr(sec, "mixer"),
+ cfg_getint(sec, "mixer_idx"));
+ SEC_CLOSE_MAP;
+ }
+
+ CASE_SEC_TITLE("cpu_temperature") {
+ SEC_OPEN_MAP("cpu_temperature");
+ print_cpu_temperature_info(json_gen, buffer, atoi(title), cfg_getstr(sec, "path"), cfg_getstr(sec, "format"), cfg_getint(sec, "max_threshold"));
+ SEC_CLOSE_MAP;
+ }
+
+ CASE_SEC("cpu_usage") {
+ SEC_OPEN_MAP("cpu_usage");
+ print_cpu_usage(json_gen, buffer, cfg_getstr(sec, "format"));
+ SEC_CLOSE_MAP;
+ }
+ }
+ if (output_format == O_I3BAR) {
+ yajl_gen_array_close(json_gen);
+ const unsigned char *buf;
+#if YAJL_MAJOR >= 2
+ size_t len;
+#else
+ unsigned int len;
+#endif
+ yajl_gen_get_buf(json_gen, &buf, &len);
+ write(STDOUT_FILENO, buf, len);
+ yajl_gen_clear(json_gen);