Changeset 582
- Timestamp:
- 08/29/07 01:28:32 (15 years ago)
- Files:
-
- trunk/libffado/tests/controlclient.cpp (modified) (1 diff)
- trunk/libffado/tests/controlclient.h (modified) (2 diffs)
- trunk/libffado/tests/controlserver.cpp (modified) (4 diffs)
- trunk/libffado/tests/controlserver.h (modified) (3 diffs)
- trunk/libffado/tests/SConscript (modified) (2 diffs)
- trunk/libffado/tests/test-dbus-server.cpp (modified) (2 diffs)
- trunk/libffado/tests/test-dbus.cpp (modified) (1 diff)
- trunk/libffado/tests/test-ffado.cpp (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/libffado/tests/controlclient.cpp
r575 r582 29 29 // --- 30 30 31 IMPL_DEBUG_MODULE( Conti gnousClient, ContignousClient, DEBUG_LEVEL_VERBOSE );31 IMPL_DEBUG_MODULE( ContinuousClient, ContinuousClient, DEBUG_LEVEL_VERBOSE ); 32 32 33 Conti gnousClient::ContignousClient( DBus::Connection& connection, const char* path, const char* name )33 ContinuousClient::ContinuousClient( DBus::Connection& connection, const char* path, const char* name ) 34 34 : DBus::ObjectProxy(connection, path, name) 35 35 { 36 debugOutput( DEBUG_LEVEL_VERBOSE, "Created Conti gnousClient '%s' on '%s'\n",36 debugOutput( DEBUG_LEVEL_VERBOSE, "Created ContinuousClient '%s' on '%s'\n", 37 37 name, path ); 38 38 } trunk/libffado/tests/controlclient.h
r575 r582 38 38 39 39 // simple fader element 40 class Conti gnousClient41 : public org::ffado::Control::Element:: Fader,40 class ContinuousClient 41 : public org::ffado::Control::Element::Continuous, 42 42 public DBus::IntrospectableProxy, 43 43 public DBus::ObjectProxy … … 45 45 public: 46 46 47 Conti gnousClient( DBus::Connection& connection, const char* path, const char* name );47 ContinuousClient( DBus::Connection& connection, const char* path, const char* name ); 48 48 49 49 private: trunk/libffado/tests/controlserver.cpp
r575 r582 52 52 } 53 53 54 DBus::String 55 Element::getLabel( ) 56 { 57 return DBus::String(m_Slave.getLabel()); 58 } 59 60 DBus::String 61 Element::getDescription( ) 62 { 63 return DBus::String(m_Slave.getDescription()); 64 } 65 54 66 // --- Container 55 67 Container::Container( DBus::Connection& connection, std::string p, Control::Container &slave) … … 98 110 *dynamic_cast<Control::Container *>(&e)); 99 111 } 100 if (dynamic_cast<Control::Contignous *>(&e) != NULL) { 101 debugOutput( DEBUG_LEVEL_VERBOSE, "Source is a Control::Contignous\n"); 112 113 if (dynamic_cast<Control::Continuous *>(&e) != NULL) { 114 debugOutput( DEBUG_LEVEL_VERBOSE, "Source is a Control::Continuous\n"); 102 115 103 return new Conti gnous(conn(), std::string(path()+"/"+e.getName()),104 *dynamic_cast<Control::Conti gnous *>(&e));116 return new Continuous(conn(), std::string(path()+"/"+e.getName()), 117 *dynamic_cast<Control::Continuous *>(&e)); 105 118 } 119 120 if (dynamic_cast<Control::Discrete *>(&e) != NULL) { 121 debugOutput( DEBUG_LEVEL_VERBOSE, "Source is a Control::Discrete\n"); 122 123 return new Discrete(conn(), std::string(path()+"/"+e.getName()), 124 *dynamic_cast<Control::Discrete *>(&e)); 125 } 126 106 127 debugOutput( DEBUG_LEVEL_VERBOSE, "Source is a Control::Element\n"); 107 128 return new Element(conn(), std::string(path()+"/"+e.getName()), e); 108 129 } 109 130 110 // --- Conti gnous131 // --- Continuous 111 132 112 Conti gnous::Contignous( DBus::Connection& connection, std::string p, Control::Contignous &slave)133 Continuous::Continuous( DBus::Connection& connection, std::string p, Control::Continuous &slave) 113 134 : Element(connection, p, slave) 114 135 , m_Slave(slave) 115 136 { 116 debugOutput( DEBUG_LEVEL_VERBOSE, "Created Conti gnous on '%s'\n",137 debugOutput( DEBUG_LEVEL_VERBOSE, "Created Continuous on '%s'\n", 117 138 path().c_str() ); 118 139 } 119 140 120 141 DBus::Double 121 Conti gnous::setValue( const DBus::Double& value )142 Continuous::setValue( const DBus::Double& value ) 122 143 { 123 144 m_Slave.setValue(value); … … 128 149 129 150 DBus::Double 130 Conti gnous::getValue( )151 Continuous::getValue( ) 131 152 { 132 153 debugOutput( DEBUG_LEVEL_VERBOSE, "getValue() => %lf\n", m_Slave.getValue() ); … … 134 155 } 135 156 157 // --- Discrete 158 159 Discrete::Discrete( DBus::Connection& connection, std::string p, Control::Discrete &slave) 160 : Element(connection, p, slave) 161 , m_Slave(slave) 162 { 163 debugOutput( DEBUG_LEVEL_VERBOSE, "Created Discrete on '%s'\n", 164 path().c_str() ); 165 } 166 167 DBus::Int32 168 Discrete::setValue( const DBus::Int32& value ) 169 { 170 m_Slave.setValue(value); 171 debugOutput( DEBUG_LEVEL_VERBOSE, "setValue(%d) => %d\n", value, m_Slave.getValue() ); 172 173 return m_Slave.getValue(); 174 } 175 176 DBus::Int32 177 Discrete::getValue( ) 178 { 179 debugOutput( DEBUG_LEVEL_VERBOSE, "getValue() => %d\n", m_Slave.getValue() ); 180 return m_Slave.getValue(); 181 } 182 136 183 } // end of namespace Control trunk/libffado/tests/controlserver.h
r575 r582 49 49 DBus::UInt64 getId( ); 50 50 DBus::String getName( ); 51 DBus::String getLabel( ); 52 DBus::String getDescription( ); 51 53 52 54 private: … … 76 78 }; 77 79 78 class Conti gnous79 : public org::ffado::Control::Element:: Fader80 class Continuous 81 : public org::ffado::Control::Element::Continuous 80 82 , public Element 81 83 { 82 84 public: 83 Conti gnous( DBus::Connection& connection,85 Continuous( DBus::Connection& connection, 84 86 std::string p, 85 Control::Conti gnous &slave );87 Control::Continuous &slave ); 86 88 87 89 DBus::Double setValue( const DBus::Double & value ); … … 89 91 90 92 private: 91 Control::Contignous &m_Slave; 93 Control::Continuous &m_Slave; 94 }; 95 96 class Discrete 97 : public org::ffado::Control::Element::Discrete 98 , public Element 99 { 100 public: 101 Discrete( DBus::Connection& connection, 102 std::string p, 103 Control::Discrete &slave ); 104 105 DBus::Int32 setValue( const DBus::Int32 & value ); 106 DBus::Int32 getValue( ); 107 108 private: 109 Control::Discrete &m_Slave; 92 110 }; 93 111 trunk/libffado/tests/SConscript
r575 r582 16 16 #for app in ["test-ffado", "test-extplugcmd", "test-fw410", "test-volume", "test-mixer", "test-cycletimer", "test-timestampedbuffer", "test-ieee1394service", "test-streamdump"]: 17 17 18 for app in ["test-f fado", "test-fw410", "test-cycletimer", "test-timestampedbuffer", "test-ieee1394service", "test-streamdump"]:18 for app in ["test-fw410", "test-cycletimer", "test-timestampedbuffer", "test-ieee1394service", "test-streamdump"]: 19 19 env.Program( target=app, source = app+".cpp" ) 20 20 … … 26 26 env.XML2CPP_ADAPTOR('controlserver-glue.h', 'controlstuff.xml') 27 27 env.Program( target="test-dbus-server", source = env.Split( "test-dbus-server.cpp controlserver.cpp" ) ) 28 env.Program( target="test-ffado", source = env.Split( "test-ffado.cpp controlserver.cpp" ) ) 29 28 30 29 31 env.SConscript( dirs="streaming", exports="env" ) trunk/libffado/tests/test-dbus-server.cpp
r575 r582 109 109 conn.request_name(SERVER_NAME); 110 110 111 Control::Conti gnous c0("test0");111 Control::Continuous c0("test0"); 112 112 c0.setVerboseLevel(DEBUG_LEVEL_VERBOSE); 113 DBusControl::Conti gnous fader(conn, "/org/ffado/Control/Test/Fader", c0);113 DBusControl::Continuous fader(conn, "/org/ffado/Control/Test/Fader", c0); 114 114 115 115 Control::Container cont("container1"); … … 121 121 cont.addElement(&cont1); 122 122 123 Control::Conti gnous c1("test1");123 Control::Continuous c1("test1"); 124 124 c1.setVerboseLevel(DEBUG_LEVEL_VERBOSE); 125 125 cont.addElement(&c1); 126 126 127 Control::Conti gnous c2("test2");127 Control::Continuous c2("test2"); 128 128 c2.setVerboseLevel(DEBUG_LEVEL_VERBOSE); 129 129 cont.addElement(&c2); 130 130 131 Control::Conti gnous c3("test3");131 Control::Continuous c3("test3"); 132 132 c3.setVerboseLevel(DEBUG_LEVEL_VERBOSE); 133 133 cont.addElement(&c3); 134 134 135 Control::Conti gnous c4("test4");135 Control::Continuous c4("test4"); 136 136 c4.setVerboseLevel(DEBUG_LEVEL_VERBOSE); 137 137 cont1.addElement(&c4); 138 138 139 Control::Conti gnous c5("test5");139 Control::Continuous c5("test5"); 140 140 c5.setVerboseLevel(DEBUG_LEVEL_VERBOSE); 141 141 cont1.addElement(&c5); trunk/libffado/tests/test-dbus.cpp
r575 r582 107 107 DBus::Connection conn = DBus::Connection::SessionBus(); 108 108 109 DBusControl::Conti gnousClient client(conn, SERVER_PATH, SERVER_NAME);109 DBusControl::ContinuousClient client(conn, SERVER_PATH, SERVER_NAME); 110 110 111 111 int i=0; trunk/libffado/tests/test-ffado.cpp
r555 r582 36 36 #include "ffadodevice.h" 37 37 38 #include "bebob/vendorspecific/focusrite.h" 38 #include "bebob/focusrite/focusrite.h" 39 40 #include <dbus-c++/dbus.h> 41 #include "controlserver.h" 42 #include "libcontrol/BasicElements.h" 39 43 40 44 #include <signal.h> … … 76 80 void osc_error_handler(int num, const char *msg, const char *path); 77 81 82 // DBUS stuff 83 DBus::BusDispatcher dispatcher; 84 78 85 // signal handler 79 86 int run=1; … … 81 88 { 82 89 run = 0; 90 dispatcher.leave(); 83 91 } 84 92 … … 94 102 " OscServer\n" 95 103 " FocusriteSetPhantom [0=ch1-4, 1=ch5-8] [1=on, 0=off]\n" 104 " DBus\n" 96 105 ; 97 106 … … 479 488 delete m_deviceManager; 480 489 return exitfunction(0); 481 490 } else if ( strcmp( arguments.args[0], "DBus" ) == 0 ) { 491 DeviceManager *m_deviceManager = new DeviceManager(); 492 if ( !m_deviceManager ) { 493 fprintf( stderr, "Could not allocate device manager\n" ); 494 return exitfunction(-1); 495 } 496 if ( !m_deviceManager->initialize( arguments.port ) ) { 497 fprintf( stderr, "Could not initialize device manager\n" ); 498 delete m_deviceManager; 499 return exitfunction(-1); 500 } 501 if ( arguments.verbose ) { 502 m_deviceManager->setVerboseLevel(arguments.verbose); 503 } 504 if ( !m_deviceManager->discover() ) { 505 fprintf( stderr, "Could not discover devices\n" ); 506 delete m_deviceManager; 507 return exitfunction(-1); 508 } 509 510 signal (SIGINT, sighandler); 511 512 DBus::_init_threading(); 513 514 // test DBUS stuff 515 DBus::default_dispatcher = &dispatcher; 516 517 DBus::Connection conn = DBus::Connection::SessionBus(); 518 conn.request_name("org.ffado.Control"); 519 520 DBusControl::Container *container 521 = new DBusControl::Container(conn, "/org/ffado/Control/DeviceManager", *m_deviceManager); 522 523 printf("DBUS test service running\n"); 524 printf("press ctrl-c to stop it & continue\n"); 525 526 dispatcher.enter(); 527 528 delete container; 529 530 signal (SIGINT, SIG_DFL); 531 532 printf("server stopped\n"); 533 delete m_deviceManager; 534 return exitfunction(0); 482 535 } else { 483 536 printf( "unknown operation\n" );