[PATCH 2/2] utils: Support new fields in the v1 of meas_feed in meas_json.

Alexander Chemeris alexander.chemeris at gmail.com
Mon Apr 18 18:53:12 UTC 2016


Ditto here

Please excuse typos. Written with a touchscreen keyboard.

--
Regards,
Alexander Chemeris
CEO Fairwaves, Inc.
https://fairwaves.co
On Dec 12, 2015 5:44 PM, "Alexander Chemeris" <alexander.chemeris at gmail.com>
wrote:

> ---
>  openbsc/src/utils/Makefile.am |  3 ++-
>  openbsc/src/utils/meas_json.c | 25 ++++++++++++++++++++++---
>  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");
>
> --
> 1.9.1
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/openbsc/attachments/20160418/ba406dd5/attachment.html>


More information about the OpenBSC mailing list