aboutsummaryrefslogtreecommitdiffstats
path: root/fig0_5.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'fig0_5.cpp')
-rw-r--r--fig0_5.cpp27
1 files changed, 26 insertions, 1 deletions
diff --git a/fig0_5.cpp b/fig0_5.cpp
index f3ef08c..8d966a6 100644
--- a/fig0_5.cpp
+++ b/fig0_5.cpp
@@ -28,16 +28,34 @@
#include <cstdio>
#include <cstring>
#include <map>
+#include <unordered_set>
+
+static std::unordered_set<int> components_seen;
+
+bool fig0_5_is_complete(int components_id)
+{
+ bool complete = components_seen.count(components_id);
+
+ if (complete) {
+ components_seen.clear();
+ }
+ else {
+ components_seen.insert(components_id);
+ }
+
+ return complete;
+}
// FIG 0/5 Service component language
// ETSI EN 300 401 8.1.2
-void fig0_5(fig0_common_t& fig0, int indent)
+bool fig0_5(fig0_common_t& fig0, int indent)
{
uint16_t SCId;
uint8_t i = 1, SubChId, FIDCId, Language, Rfa;
char tmpbuf[256];
char desc[256];
bool LS_flag, MSC_FIC_flag;
+ bool complete = false;
uint8_t* f = fig0.f;
@@ -62,6 +80,9 @@ void fig0_5(fig0_common_t& fig0, int indent)
LS_flag, MSC_FIC_flag, FIDCId, Language,
get_language_name(Language));
}
+
+ int key = (MSC_FIC_flag << 7) | (f[i] % 0x3F);
+ complete |= fig0_5_is_complete(key);
printbuf(desc, indent+1, NULL, 0);
i += 2;
}
@@ -70,6 +91,8 @@ void fig0_5(fig0_common_t& fig0, int indent)
if (i < (fig0.figlen - 2)) {
Rfa = (f[i] >> 4) & 0x07;
SCId = (((uint16_t)f[i] & 0x0F) << 8) | (uint16_t)f[i+1];
+ int key = (LS_flag << 15) | SCId;
+ complete |= fig0_5_is_complete(key);
Language = f[i+2];
sprintf(desc, "L/S flag=%d long form", LS_flag);
if (Rfa != 0) {
@@ -85,5 +108,7 @@ void fig0_5(fig0_common_t& fig0, int indent)
i += 3;
}
}
+
+ return complete;
}