aboutsummaryrefslogtreecommitdiffstats
path: root/src/ensembledatabase.hpp
diff options
context:
space:
mode:
authorMatthias P. Braendli <matthias.braendli@mpb.li>2019-01-16 13:54:01 +0100
committerMatthias P. Braendli <matthias.braendli@mpb.li>2019-01-16 13:54:01 +0100
commit1df947bae7346948e08edb75616d34fcf8802dae (patch)
tree4f26efa73b82c3404f8bedbe5efae732afb570b2 /src/ensembledatabase.hpp
parentadcee856b3628f013d31ed890bf1a28cb4d688cd (diff)
downloadetisnoop-1df947bae7346948e08edb75616d34fcf8802dae.tar.gz
etisnoop-1df947bae7346948e08edb75616d34fcf8802dae.tar.bz2
etisnoop-1df947bae7346948e08edb75616d34fcf8802dae.zip
Add FIG2 label decoding with draft TS 103 176 v2.2.1 support
Diffstat (limited to 'src/ensembledatabase.hpp')
-rw-r--r--src/ensembledatabase.hpp39
1 files changed, 32 insertions, 7 deletions
diff --git a/src/ensembledatabase.hpp b/src/ensembledatabase.hpp
index b0c9320..cc080ec 100644
--- a/src/ensembledatabase.hpp
+++ b/src/ensembledatabase.hpp
@@ -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) 2019 Matthias P. Braendli (http://www.opendigitalradio.org)
Copyright (C) 2015 Data Path
This program is free software: you can redistribute it and/or modify
@@ -36,9 +36,35 @@
#include <stdexcept>
#include <string>
#include <list>
+#include <vector>
+#include <map>
namespace ensemble_database {
+enum class extended_label_charset {
+ UTF8, // encoding flag = 0
+ UCS2, // encoding flag = 1
+};
+
+struct label_t {
+ // FIG 1 Label and shortlabel
+ std::string label;
+ uint16_t shortlabel_flag;
+
+ // Extended Label from FIG 2
+ std::map<int, std::vector<uint8_t> > segments;
+ size_t segment_count = 0; // number if actual segments (not segment count as in spec)
+ extended_label_charset charset;
+ uint8_t toggle_flag = 0;
+
+ // Assemble all segments into a UTF-8 string. Returns an
+ // empty string if not all segments received.
+ std::string assemble() const;
+
+ // Return a string that represents segment count and completeness
+ std::string assembly_state() const;
+};
+
struct subchannel_t {
uint8_t id;
uint8_t start_addr;
@@ -66,8 +92,8 @@ struct component_t {
bool primary;
- std::string label;
- uint16_t shortlabel_flag;
+ label_t label;
+
/* TODO
uint8_t type;
@@ -77,8 +103,8 @@ struct component_t {
struct service_t {
uint32_t id;
- std::string label;
- uint16_t shortlabel_flag;
+ label_t label;
+
bool programme_not_data;
std::list<component_t> components;
@@ -98,8 +124,7 @@ class not_found : public std::runtime_error
struct ensemble_t {
uint16_t EId;
- std::string label;
- uint16_t shortlabel_flag;
+ label_t label;
std::list<service_t> services;
std::list<subchannel_t> subchannels;