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