root/branches/echoaudio/src/libavc/general/avc_subunit.h

Revision 508, 2.8 kB (checked in by ppalmers, 16 years ago)

splitted avc_subunit.cpp into separate files per subunit type

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 #warning merge with bebob functionblock
39 #include "bebob/bebob_functionblock.h"
40
41 namespace AVC {
42
43 class Unit;
44
45 class Subunit {
46  public:
47     Subunit( Unit& avDevice,
48              ESubunitType type,
49              subunit_t id );
50     virtual ~Subunit();
51
52     virtual bool discover();
53     virtual bool discoverConnections()
54     {//FIXME:
55     #warning FIXME
56     };
57
58     virtual const char* getName() = 0;
59
60     subunit_t getSubunitId()
61     { return m_sbId; }
62     ESubunitType getSubunitType()
63     { return m_sbType; }
64
65     bool addPlug( Plug& plug );
66
67     PlugVector& getPlugs()
68     { return m_plugs; }
69     Plug* getPlug(Plug::EPlugDirection direction, plug_id_t plugId);
70
71
72     Unit& getUnit() const
73         { return *m_unit; }
74
75
76     bool serialize( Glib::ustring basePath, Util::IOSerialize& ser ) const;
77     static Subunit* deserialize( Glib::ustring basePath,
78                      Util::IODeserialize& deser,
79                                          Unit& avDevice );
80  protected:
81     Subunit();
82
83 //     bool discoverPlugs();
84 //     bool discoverPlugs(Plug::EPlugDirection plugDirection,
85 //                        plug_id_t plugMaxId );
86 //
87     virtual bool serializeChild( Glib::ustring basePath,
88                                  Util::IOSerialize& ser ) const = 0;
89     virtual bool deserializeChild( Glib::ustring basePath,
90                                    Util::IODeserialize& deser,
91                                    Unit& avDevice ) = 0;
92
93  protected:
94     Unit*           m_unit;
95     ESubunitType    m_sbType;
96     subunit_t       m_sbId;
97
98     PlugVector             m_plugs;
99
100     DECLARE_DEBUG_MODULE;
101 };
102
103 typedef std::vector<Subunit*> SubunitVector;
104
105 }
106
107 #endif
Note: See TracBrowser for help on using the browser.