summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: a802557)
raw | patch | inline | side by side (parent: a802557)
author | octo <octo> | |
Mon, 20 Mar 2006 17:08:24 +0000 (17:08 +0000) | ||
committer | octo <octo> | |
Mon, 20 Mar 2006 17:08:24 +0000 (17:08 +0000) |
src/wireless.c | patch | blob | history |
diff --git a/src/wireless.c b/src/wireless.c
index be366c48bc7a845f50e504b0e4d0ea233309ebcb..d41195e711cd2b8c7f6367c9d8169cc14f55fa5f 100644 (file)
--- a/src/wireless.c
+++ b/src/wireless.c
#include "common.h"
#include "plugin.h"
-#include <math.h>
-
#define MODULE_NAME "wireless"
#define BUFSIZE 1024
static char *ds_def[] =
{
"DS:quality:GAUGE:25:0:U",
- "DS:power:GAUGE:25:0:U",
- "DS:noise:GAUGE:25:0:U",
+ "DS:power:GAUGE:25:U:0",
+ "DS:noise:GAUGE:25:U:0",
NULL
};
static int ds_num = 3;
}
#if WIRELESS_HAVE_READ
+#if 0
static double wireless_dbm_to_watt (double dbm)
{
double watt;
return (watt);
}
+#endif
static void wireless_submit (char *device,
double quality, double power, double noise)
power = atof (fields[3]);
noise = atof (fields[4]);
+ /* Fill in invalid values when conversion failed.. */
if (quality == 0.0)
- quality = -1.0;
+ quality = -1.0; /* quality >= 0 */
- if (power >= 0.0)
- power = -1.0;
- else
- power = wireless_dbm_to_watt (power);
+ if (power == 0.0)
+ power = 1.0; /* power <= 0 */
- if (noise >= 0.0)
- noise = -1.0;
- else
- noise = wireless_dbm_to_watt (noise);
+ if (noise == 0.0)
+ noise = 1.0; /* noise <= 0 */
wireless_submit (device, quality, power, noise);
}
void module_register (void)
{
- plugin_register (MODULE_NAME, wireless_init, wireless_read, wireless_write);
+ plugin_register (MODULE_NAME, wireless_init, wireless_read, wireless_write);
}
#undef BUFSIZE