diff options
| author | Matthias P. Braendli <matthias.braendli@mpb.li> | 2016-09-30 11:31:31 +0200 | 
|---|---|---|
| committer | Matthias P. Braendli <matthias.braendli@mpb.li> | 2016-09-30 11:31:31 +0200 | 
| commit | 9db03b9e567ca4c716aedd017013069a54f0d66f (patch) | |
| tree | a6f72e2cadd20c6e4c9120401c016640613875ed | |
| parent | 38e1b9ca1932c922fc8f64e91596d02961ae3cc1 (diff) | |
| download | dabmux-9db03b9e567ca4c716aedd017013069a54f0d66f.tar.gz dabmux-9db03b9e567ca4c716aedd017013069a54f0d66f.tar.bz2 dabmux-9db03b9e567ca4c716aedd017013069a54f0d66f.zip | |
Add Linkage data structures to MuxElements
| -rw-r--r-- | src/MuxElements.cpp | 50 | ||||
| -rw-r--r-- | src/MuxElements.h | 43 | 
2 files changed, 92 insertions, 1 deletions
| diff --git a/src/MuxElements.cpp b/src/MuxElements.cpp index 773ec17..b2f8bca 100644 --- a/src/MuxElements.cpp +++ b/src/MuxElements.cpp @@ -662,4 +662,54 @@ unsigned short DabSubchannel::getSizeDWord(void) const      return (bitrate * 3) >> 3;  } +static string lsn_to_rc_name(uint16_t lsn) +{ +    std::stringstream ss; +    ss << "linkset" << +        std::uppercase << +        std::setfill('0') << +        std::setw(4) << +        std::hex << +        lsn; +    return ss.str(); +} + +LinkageSet::LinkageSet(uint16_t lsn, bool hard, bool international) : +    RemoteControllable(lsn_to_rc_name(lsn)), +    m_lsn(lsn), +    m_active(false), +    m_hard(hard), +    m_international(international) +{ +    RC_ADD_PARAMETER(active, "Activate this linkage set [0 or 1]"); +} + +void LinkageSet::set_parameter(const string& parameter, const string& value) +{ +    if (parameter == "active") { +        stringstream ss; +        ss << value; +        ss >> m_active; +    } +    else { +        stringstream ss; +        ss << "Parameter '" << parameter << +            "' is not exported by controllable " << get_rc_name(); +        throw ParameterError(ss.str()); +    } +} + +const string LinkageSet::get_parameter(const string& parameter) const +{ +    stringstream ss; +    if (parameter == "active") { +        ss << m_active; +    } +    else { +        ss << "Parameter '" << parameter << +            "' is not exported by controllable " << get_rc_name(); +        throw ParameterError(ss.str()); +    } +    return ss.str(); +} diff --git a/src/MuxElements.h b/src/MuxElements.h index 7056121..47de4e3 100644 --- a/src/MuxElements.h +++ b/src/MuxElements.h @@ -191,8 +191,9 @@ class DabLabel  class DabService;  class DabComponent; -  class DabSubchannel; +class LinkageSet; +  class dabEnsemble : public RemoteControllable {      public:          dabEnsemble() @@ -228,6 +229,7 @@ class dabEnsemble : public RemoteControllable {          std::vector<DabSubchannel*> subchannels;          std::vector<std::shared_ptr<AnnouncementCluster> > clusters; +        std::list<std::shared_ptr<LinkageSet> > linkagesets;  }; @@ -421,6 +423,45 @@ class DabService : public RemoteControllable          DabService(const DabService& other);  }; +enum class ServiceLinkType {dab, fm, drm, amss}; + +/* Represent one link inside a linkage set */ +struct ServiceLink { +    ServiceLinkType type; +    uint16_t id; +    uint8_t ecc; +}; + +/* Represents a linkage set linkage sets according to + * TS 103 176 Clause 5.2.3 "Linkage sets". This information will + * be encoded in FIG 0/6. + */ +class LinkageSet : public RemoteControllable { +    public: +        LinkageSet(uint16_t lsn, bool hard, bool international); + +    private: +        /* Linkage Set Number is a 12-bit number that identifies the linkage +         * set in a country (requires coordination between multiplex operators +         * in a country) +         */ +        uint16_t m_lsn; + +        bool m_active; // Remote-controllable +        bool m_hard; +        bool m_international; + +        DabService *m_keyservice; +        std::list<ServiceLink> id_list; + +        /* Remote control */ +        virtual void set_parameter(const std::string& parameter, +               const std::string& value); + +        /* Getting a parameter always returns a string. */ +        virtual const std::string get_parameter(const std::string& parameter) const; +}; +  std::vector<DabSubchannel*>::iterator getSubchannel(          std::vector<DabSubchannel*>& subchannels, int id); | 
