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 |
// FIXME: to change this to a normal ConfigRom class name we have to |
---|
121 |
// put the 1394 config rom class into a separate namespace. |
---|
122 |
class ConfigRomX |
---|
123 |
: public org::ffado::Control::Element::ConfigRomX |
---|
124 |
, public Element |
---|
125 |
{ |
---|
126 |
public: |
---|
127 |
ConfigRomX( DBus::Connection& connection, |
---|
128 |
std::string p, |
---|
129 |
ConfigRom &slave ); |
---|
130 |
|
---|
131 |
DBus::String getGUID( ); |
---|
132 |
DBus::String getVendorName( ); |
---|
133 |
DBus::String getModelName( ); |
---|
134 |
DBus::Int32 getVendorId( ); |
---|
135 |
DBus::Int32 getModelId( ); |
---|
136 |
|
---|
137 |
private: |
---|
138 |
ConfigRom &m_Slave; |
---|
139 |
}; |
---|
140 |
|
---|
141 |
class MatrixMixer |
---|
142 |
: public org::ffado::Control::Element::MatrixMixer |
---|
143 |
, public Element |
---|
144 |
{ |
---|
145 |
public: |
---|
146 |
MatrixMixer( DBus::Connection& connection, |
---|
147 |
std::string p, |
---|
148 |
Control::MatrixMixer &slave ); |
---|
149 |
|
---|
150 |
DBus::String getRowName( const DBus::Int32& ); |
---|
151 |
DBus::String getColName( const DBus::Int32& ); |
---|
152 |
DBus::Int32 canWrite( const DBus::Int32&, const DBus::Int32& ); |
---|
153 |
DBus::Double setValue( const DBus::Int32&, const DBus::Int32&, const DBus::Double& ); |
---|
154 |
DBus::Double getValue( const DBus::Int32&, const DBus::Int32& ); |
---|
155 |
DBus::Int32 getRowCount( ); |
---|
156 |
DBus::Int32 getColCount( ); |
---|
157 |
|
---|
158 |
private: |
---|
159 |
Control::MatrixMixer &m_Slave; |
---|
160 |
}; |
---|
161 |
|
---|
162 |
} |
---|
163 |
|
---|
164 |
#endif // CONTROLSERVER_H |
---|