root/trunk/libffado/support/dbus/controlserver.h

Revision 965, 5.7 kB (checked in by ppalmers, 15 years ago)

add generic register read for focusrite devices

Line 
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
100 private:
101     Control::Continuous &m_Slave;
102 };
103
104 class Discrete
105 : public org::ffado::Control::Element::Discrete
106 , public Element
107 {
108 public:
109     Discrete( DBus::Connection& connection,
110               std::string p,
111               Control::Discrete &slave );
112    
113     DBus::Int32 setValue( const DBus::Int32 & value );
114     DBus::Int32 getValue( );
115
116 private:
117     Control::Discrete &m_Slave;
118 };
119
120 class Text
121 : public org::ffado::Control::Element::Text
122 , public Element
123 {
124 public:
125     Text( DBus::Connection& connection,
126           std::string p,
127           Control::Text &slave );
128
129     DBus::String setValue( const DBus::String & value );
130     DBus::String getValue( );
131
132 private:
133     Control::Text &m_Slave;
134 };
135
136 class Register
137 : public org::ffado::Control::Element::Register
138 , public Element
139 {
140 public:
141     Register( DBus::Connection& connection,
142               std::string p,
143               Control::Register &slave );
144    
145     DBus::UInt64 setValue( const DBus::UInt64 & addr, const DBus::UInt64 & value );
146     DBus::UInt64 getValue( const DBus::UInt64 & addr );
147
148 private:
149     Control::Register &m_Slave;
150 };
151
152 class Enum
153 : public org::ffado::Control::Element::Enum
154 , public Element
155 {
156 public:
157     Enum( DBus::Connection& connection,
158           std::string p,
159           Control::Enum &slave );
160    
161     DBus::Int32 select( const DBus::Int32 & idx );
162     DBus::Int32 selected( );
163     DBus::Int32 count( );
164     DBus::String getEnumLabel( const DBus::Int32 & idx );
165
166 private:
167     Control::Enum &m_Slave;
168 };
169
170 class AttributeEnum
171 : public org::ffado::Control::Element::AttributeEnum
172 , public Element
173 {
174 public:
175     AttributeEnum( DBus::Connection& connection,
176                    std::string p,
177                    Control::AttributeEnum &slave );
178    
179     DBus::Int32 select( const DBus::Int32 & idx );
180     DBus::Int32 selected( );
181     DBus::Int32 count( );
182     DBus::Int32 attributeCount();
183     DBus::String getEnumLabel( const DBus::Int32 & idx );
184     DBus::String getAttributeValue( const DBus::Int32 & idx );
185     DBus::String getAttributeName( const DBus::Int32 & idx );
186
187 private:
188     Control::AttributeEnum &m_Slave;
189 };
190
191 // FIXME: to change this to a normal ConfigRom class name we have to
192 // put the 1394 config rom class into a separate namespace.
193 class ConfigRomX
194 : public org::ffado::Control::Element::ConfigRomX
195 , public Element
196 {
197 public:
198     ConfigRomX( DBus::Connection& connection,
199                   std::string p,
200                   ConfigRom &slave );
201
202     DBus::String getGUID( );
203     DBus::String getVendorName( );
204     DBus::String getModelName( );
205     DBus::Int32 getVendorId( );
206     DBus::Int32 getModelId( );
207
208 private:
209     ConfigRom &m_Slave;
210 };
211
212 class MatrixMixer
213 : public org::ffado::Control::Element::MatrixMixer
214 , public Element
215 {
216 public:
217     MatrixMixer(  DBus::Connection& connection,
218                   std::string p,
219                   Control::MatrixMixer &slave );
220
221     DBus::String getRowName( const DBus::Int32& );
222     DBus::String getColName( const DBus::Int32& );
223     DBus::Int32 canWrite( const DBus::Int32&, const DBus::Int32& );
224     DBus::Double setValue( const DBus::Int32&, const DBus::Int32&, const DBus::Double& );
225     DBus::Double getValue( const DBus::Int32&, const DBus::Int32& );
226     DBus::Int32 getRowCount( );
227     DBus::Int32 getColCount( );
228
229 private:
230     Control::MatrixMixer &m_Slave;
231 };
232
233 }
234
235 #endif // CONTROLSERVER_H
Note: See TracBrowser for help on using the browser.