- rrd_update_file (host, filename, val,
- ds_def_voltage, ds_num_voltage);
-}
-
-static void battery_charge_write (char *host, char *inst, char *val)
-{
- char filename[BUFSIZE];
- int len;
-
- len = snprintf (filename, BUFSIZE, battery_charge_file, inst);
- if ((len >= BUFSIZE) || (len < 0))
- return;
-
- rrd_update_file (host, filename, val,
- ds_def_charge, ds_num_charge);
-}
-
-#if BATTERY_HAVE_READ
-static void battery_submit (char *inst, double current, double voltage, double charge)
-{
- int len;
- char buffer[BUFSIZE];
-
- if (current != INVALID_VALUE)
- {
- len = snprintf (buffer, BUFSIZE, "N:%.3f", current);
-
- if ((len > 0) && (len < BUFSIZE))
- plugin_submit ("battery_current", inst, buffer);
- }
- else
- {
- plugin_submit ("battery_current", inst, "N:U");
- }
-
- if (voltage != INVALID_VALUE)
- {
- len = snprintf (buffer, BUFSIZE, "N:%.3f", voltage);
-
- if ((len > 0) && (len < BUFSIZE))
- plugin_submit ("battery_voltage", inst, buffer);
- }
- else
- {
- plugin_submit ("battery_voltage", inst, "N:U");
- }
-
- if (charge != INVALID_VALUE)
- {
- len = snprintf (buffer, BUFSIZE, "N:%.3f", charge);
-
- if ((len > 0) && (len < BUFSIZE))
- plugin_submit ("battery_charge", inst, buffer);
- }
- else
- {
- plugin_submit ("battery_charge", inst, "N:U");
- }
-}