1 |
/* |
---|
2 |
* Copyright (C) 2005-2008 by Pieter Palmers |
---|
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 program is free software: you can redistribute it and/or modify |
---|
10 |
* it under the terms of the GNU General Public License as published by |
---|
11 |
* the Free Software Foundation, either version 2 of the License, or |
---|
12 |
* (at your option) version 3 of the License. |
---|
13 |
* |
---|
14 |
* This program 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 |
---|
17 |
* GNU General Public License for more details. |
---|
18 |
* |
---|
19 |
* You should have received a copy of the GNU General Public License |
---|
20 |
* along with this program. If not, see <http://www.gnu.org/licenses/>. |
---|
21 |
* |
---|
22 |
*/ |
---|
23 |
|
---|
24 |
#ifndef CONTROLSERVER_H |
---|
25 |
#define CONTROLSERVER_H |
---|
26 |
|
---|
27 |
#include "debugmodule/debugmodule.h" |
---|
28 |
|
---|
29 |
#include <dbus-c++/dbus.h> |
---|
30 |
|
---|
31 |
#include "controlserver-glue.h" |
---|
32 |
|
---|
33 |
#include "libcontrol/BasicElements.h" |
---|
34 |
#include "libieee1394/configrom.h" |
---|
35 |
|
---|
36 |
namespace Control { |
---|
37 |
class MatrixMixer; |
---|
38 |
}; |
---|
39 |
|
---|
40 |
namespace DBusControl { |
---|
41 |
|
---|
42 |
class Element |
---|
43 |
: public org::ffado::Control::Element::Element |
---|
44 |
, public DBus::IntrospectableAdaptor |
---|
45 |
, public DBus::ObjectAdaptor |
---|
46 |
{ |
---|
47 |
public: |
---|
48 |
|
---|
49 |
Element( DBus::Connection& connection, |
---|
50 |
std::string p, |
---|
51 |
Control::Element &slave ); |
---|
52 |
|
---|
53 |
DBus::UInt64 getId( ); |
---|
54 |
DBus::String getName( ); |
---|
55 |
DBus::String getLabel( ); |
---|
56 |
DBus::String getDescription( ); |
---|
57 |
|
---|
58 |
private: |
---|
59 |
Control::Element &m_Slave; |
---|
60 |
|
---|
61 |
protected: |
---|
62 |
DECLARE_DEBUG_MODULE; |
---|
63 |
}; |
---|
64 |
typedef std::vector<Element *> ElementVector; |
---|
65 |
typedef std::vector<Element *>::iterator ElementVectorIterator; |
---|
66 |
typedef std::vector<Element *>::const_iterator ConstElementVectorIterator; |
---|
67 |
|
---|
68 |
class Container |
---|
69 |
: public org::ffado::Control::Element::Container |
---|
70 |
, public Element |
---|
71 |
{ |
---|
72 |
public: |
---|
73 |
Container( DBus::Connection& connection, |
---|
74 |
std::string p, |
---|
75 |
Control::Container &slave ); |
---|
76 |
virtual ~Container(); |
---|
77 |
|
---|
78 |
Element *createHandler(Control::Element& e); |
---|
79 |
|
---|
80 |
DBus::Int32 getNbElements( ); |
---|
81 |
DBus::String getElementName( const DBus::Int32& ); |
---|
82 |
|
---|
83 |
private: |
---|
84 |
Control::Container &m_Slave; |
---|
85 |
ElementVector m_Children; |
---|
86 |
}; |
---|
87 |
|
---|
88 |
class Continuous |
---|
89 |
: public org::ffado::Control::Element::Continuous |
---|
90 |
, public Element |
---|
91 |
{ |
---|
92 |
public: |
---|
93 |
Continuous( DBus::Connection& connection, |
---|
94 |
std::string p, |
---|
95 |
Control::Continuous &slave ); |
---|
96 |
|
---|
97 |
DBus::Double setValue( const DBus::Double & value ); |
---|
98 |
DBus::Double getValue( ); |
---|
99 |
DBus::Double setValueIdx( const DBus::Int32 & idx, |
---|
100 |
const DBus::Double & value ); |
---|
101 |
DBus::Double getValueIdx( const DBus::Int32 & idx ); |
---|
102 |
|
---|
103 |
private: |
---|
104 |
Control::Continuous &m_Slave; |
---|
105 |
}; |
---|
106 |
|
---|
107 |
class Discrete |
---|
108 |
: public org::ffado::Control::Element::Discrete |
---|
109 |
, public Element |
---|
110 |
{ |
---|
111 |
public: |
---|
112 |
Discrete( DBus::Connection& connection, |
---|
113 |
std::string p, |
---|
114 |
Control::Discrete &slave ); |
---|
115 |
|
---|
116 |
DBus::Int32 setValue( const DBus::Int32 & value ); |
---|
117 |
DBus::Int32 getValue( ); |
---|
118 |
DBus::Int32 setValueIdx( const DBus::Int32 & idx, |
---|
119 |
const DBus::Int32 & value ); |
---|
120 |
DBus::Int32 getValueIdx( const DBus::Int32 & idx ); |
---|
121 |
|
---|
122 |
private: |
---|
123 |
Control::Discrete &m_Slave; |
---|
124 |
}; |
---|
125 |
|
---|
126 |
class Text |
---|
127 |
: public org::ffado::Control::Element::Text |
---|
128 |
, public Element |
---|
129 |
{ |
---|
130 |
public: |
---|
131 |
Text( DBus::Connection& connection, |
---|
132 |
std::string p, |
---|
133 |
Control::Text &slave ); |
---|
134 |
|
---|
135 |
DBus::String setValue( const DBus::String & value ); |
---|
136 |
DBus::String getValue( ); |
---|
137 |
|
---|
138 |
private: |
---|
139 |
Control::Text &m_Slave; |
---|
140 |
}; |
---|
141 |
|
---|
142 |
class Register |
---|
143 |
: public org::ffado::Control::Element::Register |
---|
144 |
, public Element |
---|
145 |
{ |
---|
146 |
public: |
---|
147 |
Register( DBus::Connection& connection, |
---|
148 |
std::string p, |
---|
149 |
Control::Register &slave ); |
---|
150 |
|
---|
151 |
DBus::UInt64 setValue( const DBus::UInt64 & addr, const DBus::UInt64 & value ); |
---|
152 |
DBus::UInt64 getValue( const DBus::UInt64 & addr ); |
---|
153 |
|
---|
154 |
private: |
---|
155 |
Control::Register &m_Slave; |
---|
156 |
}; |
---|
157 |
|
---|
158 |
class Enum |
---|
159 |
: public org::ffado::Control::Element::Enum |
---|
160 |
, public Element |
---|
161 |
{ |
---|
162 |
public: |
---|
163 |
Enum( DBus::Connection& connection, |
---|
164 |
std::string p, |
---|
165 |
Control::Enum &slave ); |
---|
166 |
|
---|
167 |
DBus::Int32 select( const DBus::Int32 & idx ); |
---|
168 |
DBus::Int32 selected( ); |
---|
169 |
DBus::Int32 count( ); |
---|
170 |
DBus::String getEnumLabel( const DBus::Int32 & idx ); |
---|
171 |
|
---|
172 |
private: |
---|
173 |
Control::Enum &m_Slave; |
---|
174 |
}; |
---|
175 |
|
---|
176 |
class AttributeEnum |
---|
177 |
: public org::ffado::Control::Element::AttributeEnum |
---|
178 |
, public Element |
---|
179 |
{ |
---|
180 |
public: |
---|
181 |
AttributeEnum( DBus::Connection& connection, |
---|
182 |
std::string p, |
---|
183 |
Control::AttributeEnum &slave ); |
---|
184 |
|
---|
185 |
DBus::Int32 select( const DBus::Int32 & idx ); |
---|
186 |
DBus::Int32 selected( ); |
---|
187 |
DBus::Int32 count( ); |
---|
188 |
DBus::Int32 attributeCount(); |
---|
189 |
DBus::String getEnumLabel( const DBus::Int32 & idx ); |
---|
190 |
DBus::String getAttributeValue( const DBus::Int32 & idx ); |
---|
191 |
DBus::String getAttributeName( const DBus::Int32 & idx ); |
---|
192 |
|
---|
193 |
private: |
---|
194 |
Control::AttributeEnum &m_Slave; |
---|
195 |
}; |
---|
196 |
|
---|
197 |
// FIXME: to change this to a normal ConfigRom class name we have to |
---|
198 |
// put the 1394 config rom class into a separate namespace. |
---|
199 |
class ConfigRomX |
---|
200 |
: public org::ffado::Control::Element::ConfigRomX |
---|
201 |
, public Element |
---|
202 |
{ |
---|
203 |
public: |
---|
204 |
ConfigRomX( DBus::Connection& connection, |
---|
205 |
std::string p, |
---|
206 |
ConfigRom &slave ); |
---|
207 |
|
---|
208 |
DBus::String getGUID( ); |
---|
209 |
DBus::String getVendorName( ); |
---|
210 |
DBus::String getModelName( ); |
---|
211 |
DBus::Int32 getVendorId( ); |
---|
212 |
DBus::Int32 getModelId( ); |
---|
213 |
|
---|
214 |
private: |
---|
215 |
ConfigRom &m_Slave; |
---|
216 |
}; |
---|
217 |
|
---|
218 |
class MatrixMixer |
---|
219 |
: public org::ffado::Control::Element::MatrixMixer |
---|
220 |
, public Element |
---|
221 |
{ |
---|
222 |
public: |
---|
223 |
MatrixMixer( DBus::Connection& connection, |
---|
224 |
std::string p, |
---|
225 |
Control::MatrixMixer &slave ); |
---|
226 |
|
---|
227 |
DBus::String getRowName( const DBus::Int32& ); |
---|
228 |
DBus::String getColName( const DBus::Int32& ); |
---|
229 |
DBus::Int32 canWrite( const DBus::Int32&, const DBus::Int32& ); |
---|
230 |
DBus::Double setValue( const DBus::Int32&, const DBus::Int32&, const DBus::Double& ); |
---|
231 |
DBus::Double getValue( const DBus::Int32&, const DBus::Int32& ); |
---|
232 |
DBus::Int32 getRowCount( ); |
---|
233 |
DBus::Int32 getColCount( ); |
---|
234 |
|
---|
235 |
private: |
---|
236 |
Control::MatrixMixer &m_Slave; |
---|
237 |
}; |
---|
238 |
|
---|
239 |
} |
---|
240 |
|
---|
241 |
#endif // CONTROLSERVER_H |
---|