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

Revision 864, 3.2 kB (checked in by ppalmers, 15 years ago)

update license to GPLv2 or GPLv3 instead of GPLv2 or any later version. Update copyrights to reflect the new year

Line 
1 /*
2  * Copyright (C) 2005-2008 by Pieter Palmers
3  * Copyright (C) 2005-2008 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 program is free software: you can redistribute it and/or modify
11  * it under the terms of the GNU General Public License as published by
12  * the Free Software Foundation, either version 2 of the License, or
13  * (at your option) version 3 of the License.
14  *
15  * This program is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU General Public License for more details.
19  *
20  * You should have received a copy of the GNU General Public License
21  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
22  *
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.