From d6923be4bd2e198b4cba161e8040072128bd392c Mon Sep 17 00:00:00 2001 From: "Matthias P. Braendli" Date: Fri, 14 Feb 2014 15:46:54 +0100 Subject: make DabComponent a class and make its label RC controllable --- src/MuxElements.h | 69 ++++++++++++++++++++++++++++++++++++------------------- 1 file changed, 45 insertions(+), 24 deletions(-) (limited to 'src/MuxElements.h') diff --git a/src/MuxElements.h b/src/MuxElements.h index a0ee23a..41037b5 100644 --- a/src/MuxElements.h +++ b/src/MuxElements.h @@ -86,8 +86,9 @@ class DabLabel }; -struct DabService; -struct dabComponent; +class DabService; +class DabComponent; + struct dabSubchannel; struct dabEnsemble { uint16_t id; @@ -95,7 +96,7 @@ struct dabEnsemble { DabLabel label; uint8_t mode; vector services; - vector components; + vector components; vector subchannels; }; @@ -163,20 +164,39 @@ struct dabPacketComponent { }; -struct dabComponent { - DabLabel label; - uint32_t serviceId; - uint8_t subchId; - uint8_t type; - uint8_t SCIdS; - union { - dabAudioComponent audio; - dabDataComponent data; - dabFidcComponent fidc; - dabPacketComponent packet; - }; +class DabComponent : public RemoteControllable +{ + public: + DabComponent(std::string uid) : + RemoteControllable("Component " + uid) + { + RC_ADD_PARAMETER(label, "Label and shortlabel [label,short]"); + } - bool isPacketComponent(vector& subchannels); + DabLabel label; + uint32_t serviceId; + uint8_t subchId; + uint8_t type; + uint8_t SCIdS; + union { + dabAudioComponent audio; + dabDataComponent data; + dabFidcComponent fidc; + dabPacketComponent packet; + }; + + bool isPacketComponent(vector& subchannels); + + /* Remote control */ + virtual void set_parameter(string parameter, string value); + + /* Getting a parameter always returns a string. */ + virtual string get_parameter(string parameter); + + + private: + const DabComponent& operator=(const DabComponent& other); + DabComponent(const DabComponent& other); }; @@ -184,7 +204,8 @@ struct dabComponent { class DabService : public RemoteControllable { public: - DabService(std::string uid) : RemoteControllable(uid) + DabService(std::string uid) : + RemoteControllable("Service " + uid) { RC_ADD_PARAMETER(label, "Label and shortlabel [label,short]"); } @@ -195,7 +216,7 @@ class DabService : public RemoteControllable bool program; unsigned char getType(dabEnsemble* ensemble); - unsigned char nbComponent(vector& components); + unsigned char nbComponent(vector& components); DabLabel label; @@ -213,17 +234,17 @@ class DabService : public RemoteControllable vector::iterator getSubchannel( vector& subchannels, int id); -vector::iterator getComponent( - vector& components, +vector::iterator getComponent( + vector& components, uint32_t serviceId, - vector::iterator current); + vector::iterator current); -vector::iterator getComponent( - vector& components, +vector::iterator getComponent( + vector& components, uint32_t serviceId); vector::iterator getService( - dabComponent* component, + DabComponent* component, vector& services); unsigned short getSizeCu(dabSubchannel* subchannel); -- cgit v1.2.3