fixed typo in DVBSocket
[senf.git] / Socket / Protocols / DVB / DVBDemuxHandles.hh
index 2c839e6..9b4b73a 100644 (file)
@@ -1,9 +1,9 @@
 // $Id$
 //
 // Copyright (C) 2007
-// Fraunhofer Institut fuer offene Kommunikationssysteme (FOKUS)
-// Kompetenzzentrum fuer Satelitenkommunikation (SatCom)
-//     Stefan Bund <stefan.bund@fokus.fraunhofer.de>
+// Fraunhofer Institute for Open Communication Systems (FOKUS)
+// Competence Center NETwork research (NET), St. Augustin, GERMANY
+//     Thorsten Horstmann <tho@berlios.de>
 //
 // This program is free software; you can redistribute it and/or modify
 // it under the terms of the GNU General Public License as published by
 // 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 
 /** \file
-    \brief DVBHandles
- */
+    \brief DVBDemuxHandles public header */
 
-#ifndef HH_DVBDemuxHandles_
-#define HH_DVBDemuxHandles_ 1
+#ifndef HH_SENF_Socket_Protocols_DVB_DVBDemuxHandles_
+#define HH_SENF_Socket_Protocols_DVB_DVBDemuxHandles_ 1
 
 // Custom includes
-#include "Socket/BufferingPolicy.hh"
-#include "Socket/FramingPolicy.hh"
-#include "Socket/CommunicationPolicy.hh"
-#include "Socket/ReadWritePolicy.hh"
-#include "Socket/ProtocolClientSocketHandle.hh"
-#include "DVBDemuxProtocol.hh"
+#include "../../../Socket/FramingPolicy.hh"
+#include "../../../Socket/CommunicationPolicy.hh"
+#include "../../../Socket/ReadWritePolicy.hh"
+#include "../../../Socket/ProtocolClientSocketHandle.hh"
+#include "DVBDemuxSocketProtocol.hh"
 
 //#include "DVBDemuxHandles.mpp"
+#include <boost/enable_shared_from_this.hpp>
+#include <boost/shared_ptr.hpp>
+#include <iostream>
 ///////////////////////////////hh.p////////////////////////////////////////
 
 namespace senf {
@@ -44,20 +45,48 @@ namespace senf {
     /// @{
 
     typedef MakeSocketPolicy<
-       NoAddressingPolicy,
+        NoAddressingPolicy,
         DatagramFramingPolicy,
         UnconnectedCommunicationPolicy,
         ReadablePolicy,
-        NotWriteablePolicy,
-        NoBufferingPolicy
+        NotWriteablePolicy
         >::policy DVBDemux_Policy;   ///< Socket Policy for xxxx
 
-    /** \brief xxx
+    /** \brief Baseclass of various DVBProtocolWrappers which are defined in DVBProtocolWrapper.hh 
      */
-    class DVBDemuxSectionProtocol
-        : public ConcreteSocketProtocol<DVBDemux_Policy>,
-          public DVBDemuxProtocol
+    class DVBProtocolWrapper :public boost::enable_shared_from_this<DVBProtocolWrapper> {
+        public:
+            DVBProtocolWrapper(){}
+            virtual ~DVBProtocolWrapper(){}
+    };
+    /** \brief Baseclass for DVBSocketProtocols which want use Wrappers for console. 
+    */
+    class DVBSocketProtocol : public virtual SocketProtocol {
+private:
+        boost::shared_ptr<DVBProtocolWrapper> wrap_;
+public:
+        DVBSocketProtocol() {}
+        ~DVBSocketProtocol() {}
+        
+        void addWrapper(boost::shared_ptr<DVBProtocolWrapper> wrap)/**< Binds a wrapper to a DVBProtocol, 
+                                                                        so if it is closed the functionality of the wrapper is automatically removed from console.*/ 
+        {
+            wrap_ = wrap;
+        }
+        virtual void close(){
+            wrap_.reset();
+            SocketProtocol::close();
+
+        }
+    };
+    
+    
+    class DVBDemuxSectionSocketProtocol
+        : public ConcreteSocketProtocol<DVBDemux_Policy, DVBDemuxSectionSocketProtocol>,
+          public DVBDemuxSocketProtocol, 
+          public DVBSocketProtocol
     {
+    
     public:
         ///////////////////////////////////////////////////////////////////////////
         // internal interface
@@ -65,32 +94,38 @@ namespace senf {
         ///\name Constructors
         ///@{
 
-        void init_client() const;       ///< xxx
+        void init_client(unsigned short adapter=0, unsigned short device=0) const;       ///< xxx
                                         /**< \note This member is implicitly called from the
                                              ProtocolClientSocketHandle::ProtocolClientSocketHandle()
                                              constructor */
 
         ///@}
         ///\name Abstract Interface Implementation
+        ///@{
         
         unsigned available() const;
 
-        std::auto_ptr<SocketProtocol> clone() const;
-
         ///@}
         
-        void setSectionFilter(struct dmx_sct_filter_params *filter) const;    
+        void setSectionFilter(unsigned short int pid, 
+                unsigned char filter= 0x3e,
+                unsigned int flags= DMX_IMMEDIATE_START | DMX_CHECK_CRC, 
+                unsigned char mask = 0xff, 
+                unsigned char mode =0x00,
+                unsigned int timeout =0x00) const;
+        
     };
 
-    typedef ProtocolClientSocketHandle<DVBDemuxSectionProtocol> DVBDemuxSectionHandle;
+    typedef ProtocolClientSocketHandle<DVBDemuxSectionSocketProtocol> DVBDemuxSectionHandle;
     
     // ----------------------------------------------------------------
     
     /** \brief xxx
      */
-    class DVBDemuxPESProtocol
-        : public ConcreteSocketProtocol<DVBDemux_Policy>,
-          public DVBDemuxProtocol
+    class DVBDemuxPESSocketProtocol
+        : public ConcreteSocketProtocol<DVBDemux_Policy,DVBDemuxPESSocketProtocol>,
+          public DVBDemuxSocketProtocol,
+          public DVBSocketProtocol
     {
     public:
         ///////////////////////////////////////////////////////////////////////////
@@ -99,24 +134,23 @@ namespace senf {
         ///\name Constructors
         ///@{
 
-        void init_client() const;       ///< xxx
+        void init_client(unsigned short adapter=0, unsigned short device=0) const;       ///< xxx
                                         /**< \note This member is implicitly called from the
                                              ProtocolClientSocketHandle::ProtocolClientSocketHandle()
                                              constructor */
 
         ///@}
         ///\name Abstract Interface Implementation
+        ///@{
         
         unsigned available() const;
 
-        std::auto_ptr<SocketProtocol> clone() const;
-
         ///@}
         
-        void setPESFilter(struct dmx_pes_filter_params *filter) const;    
+        void setPESFilter(unsigned short int pid, dmx_input_t input, dmx_output_t output, dmx_pes_type_t pesType, unsigned int flags)const;    
     };
 
-    typedef ProtocolClientSocketHandle<DVBDemuxPESProtocol> DVBDemuxPESHandle;
+    typedef ProtocolClientSocketHandle<DVBDemuxPESSocketProtocol> DVBDemuxPESHandle;
 
     
     // ----------------------------------------------------------------
@@ -124,9 +158,9 @@ namespace senf {
     
     /** \brief xxx
          */
-    class DVBDvrProtocol
-        : public ConcreteSocketProtocol<DVBDemux_Policy>,
-          public DVBDemuxProtocol
+    class DVBDvrSocketProtocol
+        : public ConcreteSocketProtocol<DVBDemux_Policy, DVBDvrSocketProtocol>,
+          public DVBDemuxSocketProtocol
     {
     public:
         ///////////////////////////////////////////////////////////////////////////
@@ -135,23 +169,23 @@ namespace senf {
         ///\name Constructors
         ///@{
 
-        void init_client() const;       ///< xxx
+        void init_client(unsigned short adapter=0, unsigned short device=0) const;       ///< xxx
                                         /**< \note This member is implicitly called from the
                                              ProtocolClientSocketHandle::ProtocolClientSocketHandle()
                                              constructor */
 
         ///@}
         ///\name Abstract Interface Implementation
+        ///@{
         
         unsigned available() const;
 
-        std::auto_ptr<SocketProtocol> clone() const;
-
         ///@}
-   
      };
 
-     typedef ProtocolClientSocketHandle<DVBDvrProtocol> DVBDvrHandle;
+     typedef ProtocolClientSocketHandle<DVBDvrSocketProtocol> DVBDvrHandle;
+
+    ///@}
     
 }