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

Revision 933, 4.4 kB (checked in by ppalmers, 16 years ago)

implement focusrite device naming

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 // FIXME: to change this to a normal ConfigRom class name we have to
137 // put the 1394 config rom class into a separate namespace.
138 class ConfigRomX
139 : public org::ffado::Control::Element::ConfigRomX
140 , public Element
141 {
142 public:
143     ConfigRomX( DBus::Connection& connection,
144                   std::string p,
145                   ConfigRom &slave );
146
147     DBus::String getGUID( );
148     DBus::String getVendorName( );
149     DBus::String getModelName( );
150     DBus::Int32 getVendorId( );
151     DBus::Int32 getModelId( );
152
153 private:
154     ConfigRom &m_Slave;
155 };
156
157 class MatrixMixer
158 : public org::ffado::Control::Element::MatrixMixer
159 , public Element
160 {
161 public:
162     MatrixMixer(  DBus::Connection& connection,
163                   std::string p,
164                   Control::MatrixMixer &slave );
165
166     DBus::String getRowName( const DBus::Int32& );
167     DBus::String getColName( const DBus::Int32& );
168     DBus::Int32 canWrite( const DBus::Int32&, const DBus::Int32& );
169     DBus::Double setValue( const DBus::Int32&, const DBus::Int32&, const DBus::Double& );
170     DBus::Double getValue( const DBus::Int32&, const DBus::Int32& );
171     DBus::Int32 getRowCount( );
172     DBus::Int32 getColCount( );
173
174 private:
175     Control::MatrixMixer &m_Slave;
176 };
177
178 }
179
180 #endif // CONTROLSERVER_H
Note: See TracBrowser for help on using the browser.