root/trunk/libffado/src/libavc/general/avc_subunit.h

Revision 612, 3.2 kB (checked in by ppalmers, 17 years ago)

- Remove dependencies between BeBoB and generic AVC code (functionblocks)
- Clean up the code at some places

Line 
1 /*
2  * Copyright (C)      2007 by Pieter Palmers
3  * Copyright (C) 2005-2007 by Daniel Wagner
4  *
5  * This file is part of FFADO
6  * FFADO = Free Firewire (pro-)audio drivers for linux
7  *
8  * FFADO is based upon FreeBoB
9  *
10  * This library is free software; you can redistribute it and/or
11  * modify it under the terms of the GNU Lesser General Public
12  * License version 2.1, as published by the Free Software Foundation;
13  *
14  * This library is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
17  * Lesser General Public License for more details.
18  *
19  * You should have received a copy of the GNU Lesser General Public
20  * License along with this library; if not, write to the Free Software
21  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
22  * MA 02110-1301 USA
23  */
24
25 #ifndef AVC_SUBUNIT_H
26 #define AVC_SUBUNIT_H
27
28 #include "debugmodule/debugmodule.h"
29
30 #include "../avc_definitions.h"
31 #include "../general/avc_plug.h"
32 #include "../general/avc_extended_subunit_info.h"
33 #include "../general/avc_generic.h"
34 #include "../audiosubunit/avc_function_block.h"
35
36 #include <vector>
37
38 namespace AVC {
39
40 class Unit;
41
42 class Subunit {
43  public:
44     Subunit( Unit& avDevice,
45              ESubunitType type,
46              subunit_t id );
47     virtual ~Subunit();
48
49     virtual bool discover();
50     virtual bool discoverConnections();
51     virtual const char* getName() = 0;
52
53     subunit_t getSubunitId()
54     { return m_sbId; }
55     ESubunitType getSubunitType()
56     { return m_sbType; }
57
58     Unit& getUnit() const
59         { return *m_unit; }
60     Subunit& getSubunit()
61         { return *this; }
62
63     virtual Plug *createPlug( AVC::Unit* unit,
64                               AVC::Subunit* subunit,
65                               AVC::function_block_type_t functionBlockType,
66                               AVC::function_block_type_t functionBlockId,
67                               AVC::Plug::EPlugAddressType plugAddressType,
68                               AVC::Plug::EPlugDirection plugDirection,
69                               AVC::plug_id_t plugId );
70
71     bool addPlug( Plug& plug );
72     virtual bool initPlugFromDescriptor( Plug& plug );
73
74     PlugVector& getPlugs()
75     { return m_plugs; }
76     Plug* getPlug(Plug::EPlugDirection direction, plug_id_t plugId);
77
78     virtual void setVerboseLevel(int l);
79
80     bool serialize( Glib::ustring basePath, Util::IOSerialize& ser ) const;
81     static Subunit* deserialize( Glib::ustring basePath,
82                      Util::IODeserialize& deser, Unit& avDevice );
83  protected:
84     Subunit();
85
86     virtual bool serializeChild( Glib::ustring basePath,
87                                  Util::IOSerialize& ser ) const = 0;
88     virtual bool deserializeChild( Glib::ustring basePath,
89                                    Util::IODeserialize& deser,
90                                    Unit& avDevice ) = 0;
91     bool discoverPlugs();
92     bool discoverPlugs(Plug::EPlugDirection plugDirection,
93                        AVC::plug_id_t plugMaxId );
94
95  protected:
96     Unit*           m_unit;
97     ESubunitType    m_sbType;
98     subunit_t       m_sbId;
99
100     PlugVector      m_plugs;
101
102     DECLARE_DEBUG_MODULE;
103 };
104
105 typedef std::vector<Subunit*> SubunitVector;
106
107 }
108
109 #endif
Note: See TracBrowser for help on using the browser.