From 618c88a6e3c594b8382b4c61710a968c6adcdf49 Mon Sep 17 00:00:00 2001 From: "Matthias P. Braendli" Date: Sat, 3 Mar 2018 18:03:17 +0100 Subject: Output YAML --- src/fig0_6.cpp | 50 +++++++++++++++++++++++++++----------------------- 1 file changed, 27 insertions(+), 23 deletions(-) (limited to 'src/fig0_6.cpp') diff --git a/src/fig0_6.cpp b/src/fig0_6.cpp index 1230be9..0ba4132 100644 --- a/src/fig0_6.cpp +++ b/src/fig0_6.cpp @@ -1,6 +1,6 @@ /* Copyright (C) 2014 CSP Innovazione nelle ICT s.c.a r.l. (http://www.csp.it/) - Copyright (C) 2017 Matthias P. Braendli (http://www.opendigitalradio.org) + Copyright (C) 2018 Matthias P. Braendli (http://www.opendigitalradio.org) Copyright (C) 2015 Data Path This program is free software: you can redistribute it and/or modify @@ -76,27 +76,28 @@ fig_result_t fig0_6(fig0_common_t& fig0, const display_settings_t &disp) key = (fig0.oe() << 15) | (fig0.pd() << 14) | (SH << 13) | (ILS << 12) | LSN; r.complete |= fig0_6_is_complete(key); - r.msgs.push_back(strprintf("Id list flag=%d", Id_list_flag)); - r.msgs.push_back(strprintf("LA=%d %s", LA, LA ? "active" : "inactive")); - r.msgs.push_back(strprintf("S/H=%d %s", SH, SH ? "Hard" : "Soft")); - r.msgs.push_back(strprintf("ILS=%d %s", ILS, ILS ? "international" : "national")); - r.msgs.push_back(strprintf("LSN=%d", LSN)); - r.msgs.push_back(strprintf("database key=0x%04x", key)); + r.msgs.emplace_back(0, "-"); + r.msgs.emplace_back(1, strprintf("Id list flag=%d", Id_list_flag)); + r.msgs.emplace_back(1, strprintf("LA=%d %s", LA, LA ? "active" : "inactive")); + r.msgs.emplace_back(1, strprintf("S/H=%d %s", SH, SH ? "Hard" : "Soft")); + r.msgs.emplace_back(1, strprintf("ILS=%d %s", ILS, ILS ? "international" : "national")); + r.msgs.emplace_back(1, strprintf("LSN=%d", LSN)); + r.msgs.emplace_back(1, strprintf("database key=0x%04x", key)); // check activation / deactivation if ((fig0_6_key_la.count(key) > 0) && (fig0_6_key_la[key] != LA)) { if (LA == 0) { - r.msgs.emplace_back("deactivated"); + r.msgs.emplace_back(1, "status=deactivated"); } else { - r.msgs.emplace_back("activated"); + r.msgs.emplace_back(1, "status=activated"); } } fig0_6_key_la[key] = LA; i += 2; if (Id_list_flag == 0) { if (fig0.cn() == 0) { // Id_list_flag=0 && fig0.cn()=0: CEI Change Event Indication - r.msgs.emplace_back("CEI"); + r.msgs.emplace_back(1, "CEI=true"); } } else { // Id_list_flag == 1 @@ -105,29 +106,30 @@ fig_result_t fig0_6(fig0_common_t& fig0, const display_settings_t &disp) if (fig0.pd() == 0) { IdLQ = (f[i] >> 5) & 0x03; Shd = (f[i] >> 4) & 0x01; - r.msgs.push_back(strprintf("IdLQ=%d", IdLQ)); - r.msgs.push_back(strprintf("Shd=%d %s", Shd, (Shd)?"b11-8 in 4-F are different services":"single service")); - r.msgs.push_back(strprintf("Number of Ids=%d", Number_of_Ids)); + r.msgs.emplace_back(1, strprintf("IdLQ=%d", IdLQ)); + r.msgs.emplace_back(1, strprintf("Shd=%d %s", Shd, (Shd)?"b11-8 in 4-F are different services":"single service")); if (ILS == 0) { // read Id list + r.msgs.emplace_back(1, "Id List:"); for(j = 0; ((j < Number_of_Ids) && ((i+2+(j*2)) < fig0.figlen)); j++) { + r.msgs.emplace_back(2, "-"); // ETSI EN 300 401 8.1.15. Some changes were introducted in spec V2 if (((j == 0) && (fig0.oe() == 0) && (fig0.cn() == 0)) || (IdLQ == 0)) { - r.msgs.emplace_back(1, strprintf("DAB SId 0x%X", + r.msgs.emplace_back(3, strprintf("DAB SId=0x%X", ((f[i+1+(j*2)] << 8) | f[i+2+(j*2)]))); } else if (IdLQ == 1) { - r.msgs.emplace_back(1, strprintf("RDS PI 0x%X", + r.msgs.emplace_back(3, strprintf("RDS PI=0x%X", ((f[i+1+(j*2)] << 8) | f[i+2+(j*2)]))); } else if (IdLQ == 2) { - r.msgs.emplace_back(1, strprintf("(AM-FM legacy) 0x%X", + r.msgs.emplace_back(3, strprintf("(AM-FM legacy)=0x%X", ((f[i+1+(j*2)] << 8) | f[i+2+(j*2)]))); } else { // IdLQ == 3 - r.msgs.emplace_back(1, strprintf("DRM-AMSS service 0x%X", + r.msgs.emplace_back(3, strprintf("DRM-AMSS service=0x%X", ((f[i+1+(j*2)] << 8) | f[i+2+(j*2)]))); } } @@ -139,23 +141,25 @@ fig_result_t fig0_6(fig0_common_t& fig0, const display_settings_t &disp) i += (Number_of_Ids * 2) + 1; } else { // fig0.pd() == 0 && ILS == 1 + r.msgs.emplace_back(1, "Id List:"); // read Id list for(j = 0; ((j < Number_of_Ids) && ((i+3+(j*3)) < fig0.figlen)); j++) { + r.msgs.emplace_back(2, "-"); if (((j == 0) && (fig0.oe() == 0) && (fig0.cn() == 0)) || (IdLQ == 0)) { - r.msgs.emplace_back(1, strprintf("DAB SId ecc 0x%02X Id 0x%04X", + r.msgs.emplace_back(3, strprintf("DAB SId=ecc 0x%02X Id 0x%04X", f[i+1+(j*3)], ((f[i+2+(j*3)] << 8) | f[i+3+(j*3)]))); } else if (IdLQ == 1) { - r.msgs.emplace_back(1, strprintf("RDS PI ecc 0x%02X Id 0x%04X", + r.msgs.emplace_back(3, strprintf("RDS PI=ecc 0x%02X Id 0x%04X", f[i+1+(j*3)], ((f[i+2+(j*3)] << 8) | f[i+3+(j*3)]))); } else if (IdLQ == 2) { - r.msgs.emplace_back(1, strprintf("(AM-FM legacy) ecc 0x%02X Id 0x%04X", + r.msgs.emplace_back(3, strprintf("(AM-FM legacy)=ecc 0x%02X Id 0x%04X", f[i+1+(j*3)], ((f[i+2+(j*3)] << 8) | f[i+3+(j*3)]))); } else { // IdLQ == 3 - r.msgs.emplace_back(1, strprintf("DRM/AMSS service ecc 0x%02X Id 0x%04X", + r.msgs.emplace_back(3, strprintf("DRM/AMSS service=ecc 0x%02X Id 0x%04X", f[i+1+(j*3)], ((f[i+2+(j*3)] << 8) | f[i+3+(j*3)]))); } } @@ -167,11 +171,11 @@ fig_result_t fig0_6(fig0_common_t& fig0, const display_settings_t &disp) } } else { // fig0.pd() == 1 - r.msgs.push_back(strprintf("Number of Ids=%d%s", Number_of_Ids)); + r.msgs.emplace_back(1, "Id List:"); if (Number_of_Ids > 0) { // read Id list for(j = 0; ((j < Number_of_Ids) && ((i+4+(j*4)) < fig0.figlen)); j++) { - r.msgs.emplace_back(1, strprintf("SId 0x%X", + r.msgs.emplace_back(2, strprintf("- 0x%X", ((f[i+1+(j*4)] << 24) | (f[i+2+(j*4)] << 16) | (f[i+3+(j*4)] << 8) | f[i+4+(j*4)]))); } } -- cgit v1.2.3