root/trunk/libffado/tests/controlserver.h

Revision 644, 3.4 kB (checked in by ppalmers, 15 years ago)

- Adapt the phase 88 mixer control application to the new DBUS control interface

Line 
1 /*
2  * Copyright (C) 2007 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  * FFADO 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) any later version.
13  * FFADO is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with FFADO; if not, write to the Free Software
20  * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
21  * MA 02111-1307 USA.
22  *
23  */
24
25 #ifndef CONTROLSERVER_H
26 #define CONTROLSERVER_H
27
28 #include "debugmodule/debugmodule.h"
29
30 #include <dbus-c++/dbus.h>
31
32 #include "controlserver-glue.h"
33
34 #include "libcontrol/BasicElements.h"
35 #include "libieee1394/configrom.h"
36
37 namespace DBusControl {
38
39 class Element
40 : public org::ffado::Control::Element::Element
41 , public DBus::IntrospectableAdaptor
42 , public DBus::ObjectAdaptor
43 {
44 public:
45
46     Element( DBus::Connection& connection,
47              std::string p,
48              Control::Element &slave );
49
50     DBus::UInt64 getId( );
51     DBus::String getName( );
52     DBus::String getLabel( );
53     DBus::String getDescription( );
54
55 private:
56     Control::Element &m_Slave;
57
58 protected:
59     DECLARE_DEBUG_MODULE;
60 };
61 typedef std::vector<Element *> ElementVector;
62 typedef std::vector<Element *>::iterator ElementVectorIterator;
63 typedef std::vector<Element *>::const_iterator ConstElementVectorIterator;
64
65 class Container
66 : public org::ffado::Control::Element::Container
67 , public Element
68 {
69 public:
70     Container( DBus::Connection& connection,
71                   std::string p,
72                   Control::Container &slave );
73     virtual ~Container();
74    
75     Element *createHandler(Control::Element& e);
76
77     DBus::Int32 getNbElements( );
78     DBus::String getElementName( const DBus::Int32& );
79
80 private:
81     Control::Container &m_Slave;
82     ElementVector m_Children;
83 };
84
85 class Continuous
86 : public org::ffado::Control::Element::Continuous
87 , public Element
88 {
89 public:
90     Continuous( DBus::Connection& connection,
91                   std::string p,
92                   Control::Continuous &slave );
93    
94     DBus::Double setValue( const DBus::Double & value );
95     DBus::Double getValue( );
96
97 private:
98     Control::Continuous &m_Slave;
99 };
100
101 class Discrete
102 : public org::ffado::Control::Element::Discrete
103 , public Element
104 {
105 public:
106     Discrete( DBus::Connection& connection,
107                   std::string p,
108                   Control::Discrete &slave );
109    
110     DBus::Int32 setValue( const DBus::Int32 & value );
111     DBus::Int32 getValue( );
112
113 private:
114     Control::Discrete &m_Slave;
115 };
116
117 // FIXME: to change this to a normal ConfigRom class name we have to
118 // put the 1394 config rom class into a separate namespace.
119 class ConfigRomX
120 : public org::ffado::Control::Element::ConfigRomX
121 , public Element
122 {
123 public:
124     ConfigRomX( DBus::Connection& connection,
125                   std::string p,
126                   ConfigRom &slave );
127
128     DBus::String getGUID( );
129     DBus::String getVendorName( );
130     DBus::String getModelName( );
131     DBus::Int32 getVendorId( );
132     DBus::Int32 getModelId( );
133
134 private:
135     ConfigRom &m_Slave;
136 };
137
138
139 }
140
141 #endif // CONTROLSERVER_H
Note: See TracBrowser for help on using the browser.