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 BEBOB_AVDEVICESUBUNIT_H |
---|
25 |
#define BEBOB_AVDEVICESUBUNIT_H |
---|
26 |
|
---|
27 |
#include "bebob/bebob_avplug.h" |
---|
28 |
#include "bebob/bebob_functionblock.h" |
---|
29 |
|
---|
30 |
#include "debugmodule/debugmodule.h" |
---|
31 |
#include "libavc/avc_extended_subunit_info.h" |
---|
32 |
#include "libavc/avc_definitions.h" |
---|
33 |
#include "libavc/avc_generic.h" |
---|
34 |
|
---|
35 |
#include <vector> |
---|
36 |
|
---|
37 |
namespace BeBoB { |
---|
38 |
|
---|
39 |
class AvDevice; |
---|
40 |
|
---|
41 |
class AvDeviceSubunit { |
---|
42 |
public: |
---|
43 |
AvDeviceSubunit( AvDevice& avDevice, |
---|
44 |
AVCCommand::ESubunitType type, |
---|
45 |
subunit_t id, |
---|
46 |
int verboseLevel ); |
---|
47 |
virtual ~AvDeviceSubunit(); |
---|
48 |
|
---|
49 |
virtual bool discover(); |
---|
50 |
virtual bool discoverConnections(); |
---|
51 |
virtual const char* getName() = 0; |
---|
52 |
|
---|
53 |
bool addPlug( AvPlug& plug ); |
---|
54 |
|
---|
55 |
subunit_t getSubunitId() |
---|
56 |
{ return m_sbId; } |
---|
57 |
AVCCommand::ESubunitType getSubunitType() |
---|
58 |
{ return m_sbType; } |
---|
59 |
|
---|
60 |
AvPlugVector& getPlugs() |
---|
61 |
{ return m_plugs; } |
---|
62 |
AvPlug* getPlug(AvPlug::EAvPlugDirection direction, plug_id_t plugId); |
---|
63 |
|
---|
64 |
|
---|
65 |
AvDevice& getAvDevice() const |
---|
66 |
{ return *m_avDevice; } |
---|
67 |
|
---|
68 |
|
---|
69 |
bool serialize( Glib::ustring basePath, Util::IOSerialize& ser ) const; |
---|
70 |
static AvDeviceSubunit* deserialize( Glib::ustring basePath, |
---|
71 |
Util::IODeserialize& deser, |
---|
72 |
AvDevice& avDevice ); |
---|
73 |
protected: |
---|
74 |
AvDeviceSubunit(); |
---|
75 |
|
---|
76 |
bool discoverPlugs(); |
---|
77 |
bool discoverPlugs(AvPlug::EAvPlugDirection plugDirection, |
---|
78 |
plug_id_t plugMaxId ); |
---|
79 |
|
---|
80 |
virtual bool serializeChild( Glib::ustring basePath, |
---|
81 |
Util::IOSerialize& ser ) const = 0; |
---|
82 |
virtual bool deserializeChild( Glib::ustring basePath, |
---|
83 |
Util::IODeserialize& deser, |
---|
84 |
AvDevice& avDevice ) = 0; |
---|
85 |
|
---|
86 |
protected: |
---|
87 |
AvDevice* m_avDevice; |
---|
88 |
AVCCommand::ESubunitType m_sbType; |
---|
89 |
subunit_t m_sbId; |
---|
90 |
int m_verboseLevel; |
---|
91 |
|
---|
92 |
AvPlugVector m_plugs; |
---|
93 |
|
---|
94 |
DECLARE_DEBUG_MODULE; |
---|
95 |
}; |
---|
96 |
|
---|
97 |
typedef std::vector<AvDeviceSubunit*> AvDeviceSubunitVector; |
---|
98 |
|
---|
99 |
///////////////////////////// |
---|
100 |
|
---|
101 |
class AvDeviceSubunitAudio: public AvDeviceSubunit { |
---|
102 |
public: |
---|
103 |
AvDeviceSubunitAudio( AvDevice& avDevice, |
---|
104 |
subunit_t id, |
---|
105 |
int verboseLevel ); |
---|
106 |
AvDeviceSubunitAudio(); |
---|
107 |
virtual ~AvDeviceSubunitAudio(); |
---|
108 |
|
---|
109 |
virtual bool discover(); |
---|
110 |
virtual bool discoverConnections(); |
---|
111 |
|
---|
112 |
virtual const char* getName(); |
---|
113 |
|
---|
114 |
FunctionBlockVector getFunctionBlocks() { return m_functions; }; |
---|
115 |
|
---|
116 |
protected: |
---|
117 |
bool discoverFunctionBlocks(); |
---|
118 |
bool discoverFunctionBlocksDo( |
---|
119 |
ExtendedSubunitInfoCmd::EFunctionBlockType fbType ); |
---|
120 |
bool createFunctionBlock( |
---|
121 |
ExtendedSubunitInfoCmd::EFunctionBlockType fbType, |
---|
122 |
ExtendedSubunitInfoPageData& data ); |
---|
123 |
|
---|
124 |
FunctionBlock::ESpecialPurpose convertSpecialPurpose( |
---|
125 |
function_block_special_purpose_t specialPurpose ); |
---|
126 |
|
---|
127 |
virtual bool serializeChild( Glib::ustring basePath, |
---|
128 |
Util::IOSerialize& ser ) const; |
---|
129 |
virtual bool deserializeChild( Glib::ustring basePath, |
---|
130 |
Util::IODeserialize& deser, |
---|
131 |
AvDevice& avDevice ); |
---|
132 |
|
---|
133 |
protected: |
---|
134 |
FunctionBlockVector m_functions; |
---|
135 |
}; |
---|
136 |
|
---|
137 |
///////////////////////////// |
---|
138 |
|
---|
139 |
class AvDeviceSubunitMusic: public AvDeviceSubunit { |
---|
140 |
public: |
---|
141 |
AvDeviceSubunitMusic( AvDevice& avDevice, |
---|
142 |
subunit_t id, |
---|
143 |
int verboseLevel ); |
---|
144 |
AvDeviceSubunitMusic(); |
---|
145 |
virtual ~AvDeviceSubunitMusic(); |
---|
146 |
|
---|
147 |
virtual const char* getName(); |
---|
148 |
|
---|
149 |
protected: |
---|
150 |
virtual bool serializeChild( Glib::ustring basePath, |
---|
151 |
Util::IOSerialize& ser ) const; |
---|
152 |
virtual bool deserializeChild( Glib::ustring basePath, |
---|
153 |
Util::IODeserialize& deser, |
---|
154 |
AvDevice& avDevice ); |
---|
155 |
}; |
---|
156 |
|
---|
157 |
} |
---|
158 |
|
---|
159 |
#endif |
---|