summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Chemeris <Alexander.Chemeris@gmail.com>2015-08-20 20:50:11 -0400
committerAlexander Chemeris <Alexander.Chemeris@gmail.com>2015-12-12 09:37:20 -0500
commit66693935b6a7adad9ad7351e67acc525b302f866 (patch)
treebcdbd84af881d4e84cc31258fd9c72a491c63cc8
parentd0c16e88b22068cf943ec099ff0e12bb3003ef8b (diff)
utils: Support new fields in the v1 of meas_feed in meas_json.achemeris/meas_json
-rw-r--r--openbsc/src/utils/Makefile.am3
-rw-r--r--openbsc/src/utils/meas_json.c25
2 files changed, 24 insertions, 4 deletions
diff --git a/openbsc/src/utils/Makefile.am b/openbsc/src/utils/Makefile.am
index 89f2dfb..681d074 100644
--- a/openbsc/src/utils/Makefile.am
+++ b/openbsc/src/utils/Makefile.am
@@ -33,7 +33,8 @@ meas_vis_LDADD = $(LIBOSMOCORE_LIBS) $(LIBOSMOGSM_LIBS) -lcdk -lncurses
meas_vis_CFLAGS = $(LIBOSMOCORE_CFLAGS) $(LIBOSMOGSM_CFLAGS)
meas_json_SOURCES = meas_json.c
-meas_json_LDADD = $(LIBOSMOCORE_LIBS) $(LIBOSMOGSM_LIBS)
+meas_json_LDADD = $(top_builddir)/src/libcommon/libcommon.a \
+ $(LIBOSMOCORE_LIBS) $(LIBOSMOGSM_LIBS)
meas_json_CFLAGS = $(LIBOSMOCORE_CFLAGS) $(LIBOSMOGSM_CFLAGS)
osmo_meas_pcap2db_SOURCES = meas_pcap2db.c meas_db.c
diff --git a/openbsc/src/utils/meas_json.c b/openbsc/src/utils/meas_json.c
index 940e5e7..88d713b 100644
--- a/openbsc/src/utils/meas_json.c
+++ b/openbsc/src/utils/meas_json.c
@@ -36,6 +36,8 @@
#include <osmocom/gsm/gsm_utils.h>
+#include <openbsc/gsm_data.h>
+#include <openbsc/gsm_data_shared.h>
#include <openbsc/meas_feed.h>
static void print_meas_rep_uni_json(struct gsm_meas_rep_unidir *mru)
@@ -92,6 +94,14 @@ static void print_meas_rep_json(struct gsm_meas_rep *mr)
printf("]");
}
+static void print_chan_info_json(struct meas_feed_meas *mfm)
+{
+ printf("\"lchan_type\":\"%s\", \"pchan_type\":\"%s\", "
+ "\"bts_nr\":%d, \"trx_nr\":%d, \"ts_nr\":%d, \"ss_nr\":%d",
+ gsm_lchant_name(mfm->lchan_type), gsm_pchan_name(mfm->pchan_type),
+ mfm->bts_nr, mfm->trx_nr, mfm->ts_nr, mfm->ss_nr);
+}
+
static void print_meas_feed_json(struct meas_feed_meas *mfm)
{
time_t now = time(NULL);
@@ -100,9 +110,18 @@ static void print_meas_feed_json(struct meas_feed_meas *mfm)
printf("\"time\":%ld, \"imsi\":\"%s\", \"name\":\"%s\", \"scenario\":\"%s\", ",
now, mfm->imsi, mfm->name, mfm->scenario);
- printf("\"meas_rep\":{");
- print_meas_rep_json(&mfm->mr);
- printf("}");
+ switch (mfm->hdr.version) {
+ case 1:
+ printf("\"chan_info\":{");
+ print_chan_info_json(mfm);
+ printf("}, ");
+ /* no break, fall to version 0 */
+ case 0:
+ printf("\"meas_rep\":{");
+ print_meas_rep_json(&mfm->mr);
+ printf("}");
+ break;
+ }
printf("}\n");