aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Williams <dcbw@redhat.com>2013-04-18 11:02:06 -0500
committerDan Williams <dcbw@redhat.com>2013-04-18 11:02:06 -0500
commit05c394d26d75cb3df479547c778bf8e9052c6e1f (patch)
treefbab77aa9667dcc084af3a67dfcf42dcae4b25dd
parent31edcdaf9a40714229e54f99e2e9956121ef372f (diff)
evdo pilot sets parse updatedcbw/diag-log
-rw-r--r--libqcdm/src/log-items.c24
-rw-r--r--libqcdm/src/log-items.h2
2 files changed, 13 insertions, 13 deletions
diff --git a/libqcdm/src/log-items.c b/libqcdm/src/log-items.c
index de5302c7..4b75a9d2 100644
--- a/libqcdm/src/log-items.c
+++ b/libqcdm/src/log-items.c
@@ -18,6 +18,7 @@
#include <string.h>
#include <stdlib.h>
#include <endian.h>
+#include <sys/param.h>
#include "log-items.h"
#include "errors.h"
@@ -161,7 +162,7 @@ qcdm_log_item_evdo_pilot_sets_result_get_pilot (QcdmResult *result,
u_int32_t num,
u_int32_t *out_pilot_pn,
u_int32_t *out_energy,
- float *out_db,
+ float *out_ecio_db,
u_int32_t *out_band_class,
u_int32_t *out_channel,
u_int32_t *out_window_center)
@@ -213,21 +214,20 @@ qcdm_log_item_evdo_pilot_sets_result_get_pilot (QcdmResult *result,
if (out_window_center)
*out_window_center = window_center;
- /* Log item pilot energy is in units from 0 (bad signal) to about 400
- * (excellent signal), derived by walking around and correlating active
- * pilot energy from this log item to the RSSI from continuous Novatel
- * Snapshot requests.
+ /* Log item pilot energy is in units from 0 (bad signal) to 400+ (excellent
+ * signal), derived by walking around and correlating active pilot energy
+ * from this log item to the RSSI from continuous Novatel Snapshot requests.
*/
-#define MAX_ENERGY 400
-#define MAX_ECIO 32.0
-
- if (energy > MAX_ENERGY)
- energy = MAX_ENERGY;
if (out_energy)
*out_energy = energy;
- if (out_db)
- *out_db = (MAX_ECIO - (((float) energy * MAX_ECIO) / (float) MAX_ENERGY));
+ /* EC/IO (measured in dBm) is not received signal strength; it's an SnR
+ * measurement. Less (-32) = worse, high (0) = better.
+ */
+#define BEST_ENERGY 400
+#define WORST_ECIO 32.0
+ if (out_ecio_db)
+ *out_ecio_db = WORST_ECIO - (((float) MIN (energy, BEST_ENERGY) * WORST_ECIO) / (float) BEST_ENERGY);
return TRUE;
}
diff --git a/libqcdm/src/log-items.h b/libqcdm/src/log-items.h
index 04c4be80..55caa74b 100644
--- a/libqcdm/src/log-items.h
+++ b/libqcdm/src/log-items.h
@@ -60,7 +60,7 @@ qcdmbool qcdm_log_item_evdo_pilot_sets_result_get_pilot (QcdmResult *result,
u_int32_t num,
u_int32_t *out_pilot_pn,
u_int32_t *out_energy,
- float *out_db,
+ float *out_ecio_db,
u_int32_t *out_band_class,
u_int32_t *out_channel,
u_int32_t *out_window_center);