diff options
author | Alexander Chemeris <Alexander.Chemeris@gmail.com> | 2015-08-20 20:50:11 -0400 |
---|---|---|
committer | Ivan Kluchnikov <kluchnikovi@gmail.com> | 2017-02-07 18:53:38 +0300 |
commit | 1c33b898865a82f6940b7b2e8598f93d9af0900a (patch) | |
tree | 82c5e257f3d4c37608f496973f08a6b3f14464f3 /openbsc | |
parent | 077e62cded07347043d6d5e772c14c6683ce6132 (diff) |
utils: Support new fields in the v1 of meas_feed in meas_json.
Diffstat (limited to 'openbsc')
-rw-r--r-- | openbsc/src/utils/Makefile.am | 1 | ||||
-rw-r--r-- | openbsc/src/utils/meas_json.c | 25 |
2 files changed, 23 insertions, 3 deletions
diff --git a/openbsc/src/utils/Makefile.am b/openbsc/src/utils/Makefile.am index 3f0619e35..876f69453 100644 --- a/openbsc/src/utils/Makefile.am +++ b/openbsc/src/utils/Makefile.am @@ -128,6 +128,7 @@ meas_json_SOURCES = \ $(NULL) meas_json_LDADD = \ + $(top_builddir)/src/libcommon/libcommon.a \ $(LIBOSMOCORE_LIBS) \ $(LIBOSMOGSM_LIBS) \ $(NULL) diff --git a/openbsc/src/utils/meas_json.c b/openbsc/src/utils/meas_json.c index 940e5e7ad..88d713be5 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"); |