diff options
author | Matthias P. Braendli <matthias.braendli@mpb.li> | 2015-05-25 19:04:57 +0200 |
---|---|---|
committer | Matthias P. Braendli <matthias.braendli@mpb.li> | 2015-05-25 19:04:57 +0200 |
commit | 0b647385bb6e379c253099b32692f867fe1bd428 (patch) | |
tree | a5355f61bf8a91c7e52f2a1fcb0e50e70bf522df /src/MuxElements.h | |
parent | f470de09c4215c39387fbe6d85330c90fecea10d (diff) | |
download | dabmux-0b647385bb6e379c253099b32692f867fe1bd428.tar.gz dabmux-0b647385bb6e379c253099b32692f867fe1bd428.tar.bz2 dabmux-0b647385bb6e379c253099b32692f867fe1bd428.zip |
Simplify DAB label handling
The DabLabel object only save the label in the unpadded form,
and handle padding with spaces at the time of usage.
Diffstat (limited to 'src/MuxElements.h')
-rw-r--r-- | src/MuxElements.h | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/src/MuxElements.h b/src/MuxElements.h index 22112db..a116427 100644 --- a/src/MuxElements.h +++ b/src/MuxElements.h @@ -51,6 +51,7 @@ struct dabOutput { DabOutput* output; }; +#define DABLABEL_LENGTH 16 class DabLabel { @@ -71,18 +72,26 @@ class DabLabel */ int setLabel(const std::string& label); - const char* text() const { return m_text; } + /* Write the label to the 16-byte buffer given in buf + * In the DAB standard, the label is 16 bytes long, and is + * padded using spaces. + */ + void writeLabel(uint8_t* buf) const; + uint16_t flag() const { return m_flag; } const std::string long_label() const { return m_label; } const std::string short_label() const; private: - // In the DAB standard, the label is 16 bytes long. - // We use spaces for padding at the end if needed. - char m_text[16]; + /* The flag field selects which label characters make + * up the short label + */ uint16_t m_flag; + + /* The m_label is not padded in any way */ std::string m_label; + /* Checks and calculates the flag */ int setShortLabel(const std::string& slabel); }; |