Changeset 582

Show
Ignore:
Timestamp:
08/29/07 01:28:32 (15 years ago)
Author:
ppalmers
Message:

see prev commit

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/libffado/tests/controlclient.cpp

    r575 r582  
    2929// --- 
    3030 
    31 IMPL_DEBUG_MODULE( ContignousClient, ContignousClient, DEBUG_LEVEL_VERBOSE ); 
     31IMPL_DEBUG_MODULE( ContinuousClient, ContinuousClient, DEBUG_LEVEL_VERBOSE ); 
    3232 
    33 ContignousClient::ContignousClient( DBus::Connection& connection, const char* path, const char* name ) 
     33ContinuousClient::ContinuousClient( DBus::Connection& connection, const char* path, const char* name ) 
    3434: DBus::ObjectProxy(connection, path, name) 
    3535{ 
    36     debugOutput( DEBUG_LEVEL_VERBOSE, "Created ContignousClient '%s' on '%s'\n", 
     36    debugOutput( DEBUG_LEVEL_VERBOSE, "Created ContinuousClient '%s' on '%s'\n", 
    3737                 name, path ); 
    3838} 
  • trunk/libffado/tests/controlclient.h

    r575 r582  
    3838 
    3939// simple fader element 
    40 class ContignousClient 
    41 : public org::ffado::Control::Element::Fader
     40class ContinuousClient 
     41: public org::ffado::Control::Element::Continuous
    4242  public DBus::IntrospectableProxy, 
    4343  public DBus::ObjectProxy 
     
    4545public: 
    4646 
    47     ContignousClient( DBus::Connection& connection, const char* path, const char* name ); 
     47    ContinuousClient( DBus::Connection& connection, const char* path, const char* name ); 
    4848 
    4949private: 
  • trunk/libffado/tests/controlserver.cpp

    r575 r582  
    5252} 
    5353 
     54DBus::String 
     55Element::getLabel( ) 
     56{ 
     57    return DBus::String(m_Slave.getLabel()); 
     58} 
     59 
     60DBus::String 
     61Element::getDescription( ) 
     62{ 
     63    return DBus::String(m_Slave.getDescription()); 
     64} 
     65 
    5466// --- Container 
    5567Container::Container( DBus::Connection& connection, std::string p, Control::Container &slave) 
     
    98110            *dynamic_cast<Control::Container *>(&e)); 
    99111    } 
    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"); 
    102115         
    103         return new Contignous(conn(), std::string(path()+"/"+e.getName()), 
    104             *dynamic_cast<Control::Contignous *>(&e)); 
     116        return new Continuous(conn(), std::string(path()+"/"+e.getName()), 
     117            *dynamic_cast<Control::Continuous *>(&e)); 
    105118    } 
     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     
    106127    debugOutput( DEBUG_LEVEL_VERBOSE, "Source is a Control::Element\n"); 
    107128    return new Element(conn(), std::string(path()+"/"+e.getName()), e); 
    108129} 
    109130 
    110 // --- Contignous 
     131// --- Continuous 
    111132 
    112 Contignous::Contignous( DBus::Connection& connection, std::string p, Control::Contignous &slave) 
     133Continuous::Continuous( DBus::Connection& connection, std::string p, Control::Continuous &slave) 
    113134: Element(connection, p, slave) 
    114135, m_Slave(slave) 
    115136{ 
    116     debugOutput( DEBUG_LEVEL_VERBOSE, "Created Contignous on '%s'\n", 
     137    debugOutput( DEBUG_LEVEL_VERBOSE, "Created Continuous on '%s'\n", 
    117138                 path().c_str() ); 
    118139} 
    119140 
    120141DBus::Double 
    121 Contignous::setValue( const DBus::Double& value ) 
     142Continuous::setValue( const DBus::Double& value ) 
    122143{ 
    123144    m_Slave.setValue(value); 
     
    128149 
    129150DBus::Double 
    130 Contignous::getValue(  ) 
     151Continuous::getValue(  ) 
    131152{ 
    132153    debugOutput( DEBUG_LEVEL_VERBOSE, "getValue() => %lf\n", m_Slave.getValue() ); 
     
    134155} 
    135156 
     157// --- Discrete 
     158 
     159Discrete::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 
     167DBus::Int32 
     168Discrete::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 
     176DBus::Int32 
     177Discrete::getValue(  ) 
     178{ 
     179    debugOutput( DEBUG_LEVEL_VERBOSE, "getValue() => %d\n", m_Slave.getValue() ); 
     180    return m_Slave.getValue(); 
     181} 
     182 
    136183} // end of namespace Control 
  • trunk/libffado/tests/controlserver.h

    r575 r582  
    4949    DBus::UInt64 getId( ); 
    5050    DBus::String getName( ); 
     51    DBus::String getLabel( ); 
     52    DBus::String getDescription( ); 
    5153 
    5254private: 
     
    7678}; 
    7779 
    78 class Contignous 
    79 : public org::ffado::Control::Element::Fader 
     80class Continuous 
     81: public org::ffado::Control::Element::Continuous 
    8082, public Element 
    8183{ 
    8284public: 
    83     Contignous( DBus::Connection& connection, 
     85    Continuous( DBus::Connection& connection, 
    8486                  std::string p, 
    85                   Control::Contignous &slave ); 
     87                  Control::Continuous &slave ); 
    8688     
    8789    DBus::Double setValue( const DBus::Double & value ); 
     
    8991 
    9092private: 
    91     Control::Contignous &m_Slave; 
     93    Control::Continuous &m_Slave; 
     94}; 
     95 
     96class Discrete 
     97: public org::ffado::Control::Element::Discrete 
     98, public Element 
     99
     100public: 
     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 
     108private: 
     109    Control::Discrete &m_Slave; 
    92110}; 
    93111 
  • trunk/libffado/tests/SConscript

    r575 r582  
    1616#for app in ["test-ffado", "test-extplugcmd", "test-fw410", "test-volume", "test-mixer", "test-cycletimer", "test-timestampedbuffer", "test-ieee1394service", "test-streamdump"]: 
    1717 
    18 for app in ["test-ffado", "test-fw410", "test-cycletimer", "test-timestampedbuffer", "test-ieee1394service", "test-streamdump"]: 
     18for app in ["test-fw410", "test-cycletimer", "test-timestampedbuffer", "test-ieee1394service", "test-streamdump"]: 
    1919    env.Program( target=app, source = app+".cpp" ) 
    2020 
     
    2626env.XML2CPP_ADAPTOR('controlserver-glue.h', 'controlstuff.xml') 
    2727env.Program( target="test-dbus-server", source = env.Split( "test-dbus-server.cpp controlserver.cpp" ) ) 
     28env.Program( target="test-ffado", source = env.Split( "test-ffado.cpp controlserver.cpp" ) ) 
     29 
    2830 
    2931env.SConscript( dirs="streaming", exports="env" ) 
  • trunk/libffado/tests/test-dbus-server.cpp

    r575 r582  
    109109    conn.request_name(SERVER_NAME); 
    110110     
    111     Control::Contignous c0("test0"); 
     111    Control::Continuous c0("test0"); 
    112112    c0.setVerboseLevel(DEBUG_LEVEL_VERBOSE); 
    113     DBusControl::Contignous fader(conn, "/org/ffado/Control/Test/Fader", c0); 
     113    DBusControl::Continuous fader(conn, "/org/ffado/Control/Test/Fader", c0); 
    114114 
    115115    Control::Container cont("container1"); 
     
    121121    cont.addElement(&cont1); 
    122122 
    123     Control::Contignous c1("test1"); 
     123    Control::Continuous c1("test1"); 
    124124    c1.setVerboseLevel(DEBUG_LEVEL_VERBOSE); 
    125125    cont.addElement(&c1); 
    126126     
    127     Control::Contignous c2("test2"); 
     127    Control::Continuous c2("test2"); 
    128128    c2.setVerboseLevel(DEBUG_LEVEL_VERBOSE); 
    129129    cont.addElement(&c2); 
    130130     
    131     Control::Contignous c3("test3"); 
     131    Control::Continuous c3("test3"); 
    132132    c3.setVerboseLevel(DEBUG_LEVEL_VERBOSE); 
    133133    cont.addElement(&c3); 
    134134 
    135     Control::Contignous c4("test4"); 
     135    Control::Continuous c4("test4"); 
    136136    c4.setVerboseLevel(DEBUG_LEVEL_VERBOSE); 
    137137    cont1.addElement(&c4); 
    138138 
    139     Control::Contignous c5("test5"); 
     139    Control::Continuous c5("test5"); 
    140140    c5.setVerboseLevel(DEBUG_LEVEL_VERBOSE); 
    141141    cont1.addElement(&c5); 
  • trunk/libffado/tests/test-dbus.cpp

    r575 r582  
    107107    DBus::Connection conn = DBus::Connection::SessionBus(); 
    108108 
    109     DBusControl::ContignousClient client(conn, SERVER_PATH, SERVER_NAME); 
     109    DBusControl::ContinuousClient client(conn, SERVER_PATH, SERVER_NAME); 
    110110 
    111111    int i=0; 
  • trunk/libffado/tests/test-ffado.cpp

    r555 r582  
    3636#include "ffadodevice.h" 
    3737 
    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" 
    3943 
    4044#include <signal.h> 
     
    7680void osc_error_handler(int num, const char *msg, const char *path); 
    7781 
     82// DBUS stuff 
     83DBus::BusDispatcher dispatcher; 
     84 
    7885// signal handler 
    7986int run=1; 
     
    8188{ 
    8289    run = 0; 
     90    dispatcher.leave(); 
    8391} 
    8492 
     
    94102                    "           OscServer\n" 
    95103                    "           FocusriteSetPhantom [0=ch1-4, 1=ch5-8] [1=on, 0=off]\n" 
     104                    "           DBus\n" 
    96105                    ; 
    97106 
     
    479488        delete m_deviceManager; 
    480489        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); 
    482535    } else { 
    483536        printf( "unknown operation\n" );