gsmmap: Dump SYSTEM INFORMATION messages while processing
[osmocom-bb.git] / src / host / gsmmap / gsmmap.c
index 588a65e..83f0d01 100644 (file)
@@ -32,6 +32,7 @@
 
 #include <osmocom/bb/common/osmocom_data.h>
 #include <osmocom/bb/common/networks.h>
+#include <osmocom/bb/common/logging.h>
 
 #include "log.h"
 #include "geo.h"
@@ -69,6 +70,21 @@ static void add_power()
        memcpy(&node_power->power, &power, sizeof(power));
 }
 
+static void print_si(void *priv, const char *fmt, ...)
+{
+       char buffer[1000];
+       FILE *outfp = (FILE *)priv;
+       va_list args;
+
+       va_start(args, fmt);
+       vsnprintf(buffer, sizeof(buffer) - 1, fmt, args);
+       buffer[sizeof(buffer) - 1] = '\0';
+       va_end(args);
+
+       if (buffer[0])
+               fprintf(outfp, "%s", buffer);
+}
+
 static void add_sysinfo()
 {
        struct gsm48_sysinfo s;
@@ -107,7 +123,8 @@ static void add_sysinfo()
                gsm48_decode_sysinfo4(&s,
                        (struct gsm48_system_information_type_4 *) sysinfo.si4,
                        23);
-
+       printf("--------------------------------------------------------------------------\n");
+       gsm48_sysinfo_dump(&s, sysinfo.arfcn, print_si, stdout, NULL);
        mcc = get_node_mcc(s.mcc);
        if (!mcc)
                nomem();
@@ -322,21 +339,6 @@ void kml_meas(FILE *outfp, struct node_meas *meas, int n, uint16_t mcc,
        fprintf(outfp, "\t\t\t\t\t</Placemark>\n");
 }
 
-static void print_si(void *priv, const char *fmt, ...)
-{
-       char buffer[1000];
-       FILE *outfp = (FILE *)priv;
-       va_list args;
-
-       va_start(args, fmt);
-       vsnprintf(buffer, sizeof(buffer) - 1, fmt, args);
-       buffer[sizeof(buffer) - 1] = '\0';
-       va_end(args);
-
-       if (buffer[0])
-               fprintf(outfp, "%s", buffer);
-}
-
 double debug_long, debug_lat, debug_x_scale;
 FILE *debug_fp;
 
@@ -499,6 +501,8 @@ void kml_cell(FILE *outfp, struct node_cell *cell)
        fprintf(outfp, "\t</Folder>\n");
 }
 
+struct log_target *stderr_target;
+
 int main(int argc, char *argv[])
 {
        FILE *infp, *outfp;
@@ -510,6 +514,13 @@ int main(int argc, char *argv[])
        struct node_cell *cell;
        struct node_meas *meas;
 
+       log_init(&log_info, NULL);
+       stderr_target = log_target_create_stderr();
+       log_add_target(stderr_target);
+       log_set_all_filter(stderr_target, 1);
+       log_parse_category_mask(stderr_target, "Dxxx");
+       log_set_log_level(stderr_target, LOGL_INFO);
+
        if (argc <= 2) {
 usage:
                fprintf(stderr, "Usage: %s <file.log> <file.kml> "