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

Revision 958, 5.4 kB (checked in by ppalmers, 15 years ago)

add clock source control to dbus

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 Enum
137 : public org::ffado::Control::Element::Enum
138 , public Element
139 {
140 public:
141     Enum( DBus::Connection& connection,
142           std::string p,
143           Control::Enum &slave );
144    
145     DBus::Int32 select( const DBus::Int32 & idx );
146     DBus::Int32 selected( );
147     DBus::Int32 count( );
148     DBus::String getEnumLabel( const DBus::Int32 & idx );
149
150 private:
151     Control::Enum &m_Slave;
152 };
153
154 class AttributeEnum
155 : public org::ffado::Control::Element::AttributeEnum
156 , public Element
157 {
158 public:
159     AttributeEnum( DBus::Connection& connection,
160                    std::string p,
161                    Control::AttributeEnum &slave );
162    
163     DBus::Int32 select( const DBus::Int32 & idx );
164     DBus::Int32 selected( );
165     DBus::Int32 count( );
166     DBus::Int32 attributeCount();
167     DBus::String getEnumLabel( const DBus::Int32 & idx );
168     DBus::String getAttributeValue( const DBus::Int32 & idx );
169     DBus::String getAttributeName( const DBus::Int32 & idx );
170
171 private:
172     Control::AttributeEnum &m_Slave;
173 };
174
175 // FIXME: to change this to a normal ConfigRom class name we have to
176 // put the 1394 config rom class into a separate namespace.
177 class ConfigRomX
178 : public org::ffado::Control::Element::ConfigRomX
179 , public Element
180 {
181 public:
182     ConfigRomX( DBus::Connection& connection,
183                   std::string p,
184                   ConfigRom &slave );
185
186     DBus::String getGUID( );
187     DBus::String getVendorName( );
188     DBus::String getModelName( );
189     DBus::Int32 getVendorId( );
190     DBus::Int32 getModelId( );
191
192 private:
193     ConfigRom &m_Slave;
194 };
195
196 class MatrixMixer
197 : public org::ffado::Control::Element::MatrixMixer
198 , public Element
199 {
200 public:
201     MatrixMixer(  DBus::Connection& connection,
202                   std::string p,
203                   Control::MatrixMixer &slave );
204
205     DBus::String getRowName( const DBus::Int32& );
206     DBus::String getColName( const DBus::Int32& );
207     DBus::Int32 canWrite( const DBus::Int32&, const DBus::Int32& );
208     DBus::Double setValue( const DBus::Int32&, const DBus::Int32&, const DBus::Double& );
209     DBus::Double getValue( const DBus::Int32&, const DBus::Int32& );
210     DBus::Int32 getRowCount( );
211     DBus::Int32 getColCount( );
212
213 private:
214     Control::MatrixMixer &m_Slave;
215 };
216
217 }
218
219 #endif // CONTROLSERVER_H
Note: See TracBrowser for help on using the browser.