1 |
/* |
---|
2 |
* Copyright (C) 2005-2007 by Daniel Wagner |
---|
3 |
* |
---|
4 |
* This file is part of FFADO |
---|
5 |
* FFADO = Free Firewire (pro-)audio drivers for linux |
---|
6 |
* |
---|
7 |
* FFADO is based upon FreeBoB |
---|
8 |
* |
---|
9 |
* This library is free software; you can redistribute it and/or |
---|
10 |
* modify it under the terms of the GNU Lesser General Public |
---|
11 |
* License version 2.1, as published by the Free Software Foundation; |
---|
12 |
* |
---|
13 |
* This library is distributed in the hope that it will be useful, |
---|
14 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
15 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
---|
16 |
* Lesser General Public License for more details. |
---|
17 |
* |
---|
18 |
* You should have received a copy of the GNU Lesser General Public |
---|
19 |
* License along with this library; if not, write to the Free Software |
---|
20 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
---|
21 |
* MA 02110-1301 USA |
---|
22 |
*/ |
---|
23 |
|
---|
24 |
#ifndef AVC_SUBUNIT_H |
---|
25 |
#define AVC_SUBUNIT_H |
---|
26 |
|
---|
27 |
#include "avc_plug.h" |
---|
28 |
|
---|
29 |
#include "debugmodule/debugmodule.h" |
---|
30 |
#include "../general/avc_extended_subunit_info.h" |
---|
31 |
#include "../avc_definitions.h" |
---|
32 |
#include "../general/avc_generic.h" |
---|
33 |
#include "../audiosubunit/avc_function_block.h" |
---|
34 |
|
---|
35 |
#include <vector> |
---|
36 |
|
---|
37 |
#warning merge with bebob functionblock |
---|
38 |
#include "bebob/bebob_functionblock.h" |
---|
39 |
|
---|
40 |
namespace AVC { |
---|
41 |
|
---|
42 |
class Unit; |
---|
43 |
|
---|
44 |
|
---|
45 |
|
---|
46 |
class Subunit { |
---|
47 |
public: |
---|
48 |
Subunit( Unit& avDevice, |
---|
49 |
ESubunitType type, |
---|
50 |
subunit_t id ); |
---|
51 |
virtual ~Subunit(); |
---|
52 |
|
---|
53 |
virtual bool discover(); |
---|
54 |
virtual bool discoverConnections() |
---|
55 |
{//FIXME: |
---|
56 |
#warning FIXME |
---|
57 |
}; |
---|
58 |
|
---|
59 |
virtual const char* getName() = 0; |
---|
60 |
|
---|
61 |
subunit_t getSubunitId() |
---|
62 |
{ return m_sbId; } |
---|
63 |
ESubunitType getSubunitType() |
---|
64 |
{ return m_sbType; } |
---|
65 |
|
---|
66 |
bool addPlug( Plug& plug ); |
---|
67 |
|
---|
68 |
PlugVector& getPlugs() |
---|
69 |
{ return m_plugs; } |
---|
70 |
Plug* getPlug(Plug::EPlugDirection direction, plug_id_t plugId); |
---|
71 |
|
---|
72 |
|
---|
73 |
Unit& getUnit() const |
---|
74 |
{ return *m_unit; } |
---|
75 |
|
---|
76 |
|
---|
77 |
bool serialize( Glib::ustring basePath, Util::IOSerialize& ser ) const; |
---|
78 |
static Subunit* deserialize( Glib::ustring basePath, |
---|
79 |
Util::IODeserialize& deser, |
---|
80 |
Unit& avDevice ); |
---|
81 |
protected: |
---|
82 |
Subunit(); |
---|
83 |
|
---|
84 |
// bool discoverPlugs(); |
---|
85 |
// bool discoverPlugs(Plug::EPlugDirection plugDirection, |
---|
86 |
// plug_id_t plugMaxId ); |
---|
87 |
// |
---|
88 |
virtual bool serializeChild( Glib::ustring basePath, |
---|
89 |
Util::IOSerialize& ser ) const = 0; |
---|
90 |
virtual bool deserializeChild( Glib::ustring basePath, |
---|
91 |
Util::IODeserialize& deser, |
---|
92 |
Unit& avDevice ) = 0; |
---|
93 |
|
---|
94 |
protected: |
---|
95 |
Unit* m_unit; |
---|
96 |
ESubunitType m_sbType; |
---|
97 |
subunit_t m_sbId; |
---|
98 |
|
---|
99 |
PlugVector m_plugs; |
---|
100 |
|
---|
101 |
DECLARE_DEBUG_MODULE; |
---|
102 |
}; |
---|
103 |
|
---|
104 |
typedef std::vector<Subunit*> SubunitVector; |
---|
105 |
|
---|
106 |
// ///////////////////////////// |
---|
107 |
|
---|
108 |
class SubunitAudio: public Subunit { |
---|
109 |
public: |
---|
110 |
SubunitAudio( Unit& avDevice, |
---|
111 |
subunit_t id ); |
---|
112 |
SubunitAudio(); |
---|
113 |
virtual ~SubunitAudio(); |
---|
114 |
|
---|
115 |
virtual bool discover(); |
---|
116 |
// virtual bool discoverConnections(); |
---|
117 |
// |
---|
118 |
virtual const char* getName(); |
---|
119 |
// |
---|
120 |
BeBoB::FunctionBlockVector getFunctionBlocks() { return m_functions; }; |
---|
121 |
// |
---|
122 |
// protected: |
---|
123 |
// bool discoverFunctionBlocks(); |
---|
124 |
// bool discoverFunctionBlocksDo( |
---|
125 |
// ExtendedSubunitInfoCmd::EFunctionBlockType fbType ); |
---|
126 |
// bool createFunctionBlock( |
---|
127 |
// ExtendedSubunitInfoCmd::EFunctionBlockType fbType, |
---|
128 |
// ExtendedSubunitInfoPageData& data ); |
---|
129 |
// |
---|
130 |
// FunctionBlock::ESpecialPurpose convertSpecialPurpose( |
---|
131 |
// function_block_special_purpose_t specialPurpose ); |
---|
132 |
|
---|
133 |
virtual bool serializeChild( Glib::ustring basePath, |
---|
134 |
Util::IOSerialize& ser ) const; |
---|
135 |
virtual bool deserializeChild( Glib::ustring basePath, |
---|
136 |
Util::IODeserialize& deser, |
---|
137 |
Unit& avDevice ); |
---|
138 |
|
---|
139 |
protected: |
---|
140 |
BeBoB::FunctionBlockVector m_functions; |
---|
141 |
}; |
---|
142 |
|
---|
143 |
// ///////////////////////////// |
---|
144 |
|
---|
145 |
class SubunitMusic: public Subunit { |
---|
146 |
public: |
---|
147 |
SubunitMusic( Unit& avDevice, |
---|
148 |
subunit_t id ); |
---|
149 |
SubunitMusic(); |
---|
150 |
virtual ~SubunitMusic(); |
---|
151 |
|
---|
152 |
virtual const char* getName(); |
---|
153 |
|
---|
154 |
protected: |
---|
155 |
virtual bool serializeChild( Glib::ustring basePath, |
---|
156 |
Util::IOSerialize& ser ) const; |
---|
157 |
virtual bool deserializeChild( Glib::ustring basePath, |
---|
158 |
Util::IODeserialize& deser, |
---|
159 |
Unit& avDevice ); |
---|
160 |
}; |
---|
161 |
|
---|
162 |
} |
---|
163 |
|
---|
164 |
#endif |
---|