Changeset 730

Show
Ignore:
Timestamp:
11/27/07 10:28:51 (16 years ago)
Author:
ppalmers
Message:

- Remove OSC related code
- create DBus server application
- add "scons debian" target that builds a debian package

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/ppalmers-streaming/config.h.in

    r609 r730  
    1313 
    1414/* Define to the full name and version of this package. */ 
    15 #define PACKAGE_STRING "$PACKAGE $VERSION
     15#define PACKAGE_STRING "$PACKAGE $VERSION-$REVISION
    1616 
    1717/* Define to the one symbol short name of this package. */ 
     
    1919 
    2020/* Define to the version of this package. */ 
    21 #define PACKAGE_VERSION $VERSION 
     21#define PACKAGE_VERSION "$VERSION-$REVISION" 
    2222 
    2323/* Define to 1 if SSE assembly is available. */ 
    2424/*#define USE_SSE 1*/ 
    25  
    26 /* Version number of package */ 
    27 #define VERSION "$VERSION" 
    2825 
    2926#define CACHEDIR "~/.ffado" 
  • branches/ppalmers-streaming/libffado/ffado.h

    r453 r730  
    145145typedef struct ffado_device_info { 
    146146    /* TODO: How is the device specification done? */ 
    147 //    char xml_location[FFADO_STREAMING_MAX_URL_LENGTH]; // can be an osc url or an XML filename 
    148147//    ffado_device_info_location_type location_type; 
    149148} ffado_device_info_t; 
  • branches/ppalmers-streaming/SConstruct

    r724 r730  
    136136                'alsa' : '1.0.0', 
    137137                'libxml++-2.6' : '2.13.0', 
    138                 'liblo' : '0.22', 
    139138                'dbus-1' : '1.0', 
    140139                } 
     
    203202env.Alias( "install", env['bindir'] ) 
    204203 
     204 
     205env['REVISION'] = os.popen('svnversion .').read()[:-1] 
     206# This may be as simple as '89' or as complex as '4123:4184M'. 
     207# We'll just use the last bit. 
     208env['REVISION'] = env['REVISION'].split(':')[-1] 
     209 
     210if env['REVISION'] == 'exported': 
     211        env['REVISION'] = '' 
     212 
    205213env['PACKAGE'] = "libffado" 
    206 env['VERSION'] = "1.999.6
     214env['VERSION'] = "1.999.7
    207215env['LIBVERSION'] = "1.0.0" 
    208216 
     
    215223# Start building 
    216224# 
    217  
    218225env.ScanReplace( "config.h.in" ) 
    219226 
     
    227234        env.SConscript( dirs=subdirs, exports="env" ) 
    228235 
     236if 'debian' in COMMAND_LINE_TARGETS: 
     237        env.SConscript("deb/SConscript", exports="env") 
    229238 
    230239# By default only src is built but all is cleaned 
  • branches/ppalmers-streaming/src/debugmodule/debugmodule.cpp

    r720 r730  
    4646 
    4747ColorEntry colorTable[] = { 
     48    { "",           ""        }, 
    4849    { "\033[31mFatal",   "\033[0m" }, 
    4950    { "\033[31mError",   "\033[0m" }, 
     
    213214DebugModule::getPreSequence( debug_level_t level ) const 
    214215{ 
    215     if ( ( level <= eDL_Normal ) && ( level >= eDL_Fatal ) ) { 
     216    if ( ( level <= eDL_Normal ) && ( level >= eDL_Message ) ) { 
    216217        return colorTable[level].preSequence; 
    217218    } 
     
    222223DebugModule::getPostSequence( debug_level_t level ) const 
    223224{ 
    224     if ( ( level <= eDL_Normal ) && ( level >= eDL_Fatal ) ) { 
     225    if ( ( level <= eDL_Normal ) && ( level >= eDL_Message ) ) { 
    225226        return colorTable[level].postSequence; 
    226227    } 
  • branches/ppalmers-streaming/src/debugmodule/debugmodule.h

    r698 r730  
    3434typedef short debug_level_t; 
    3535 
    36 #define DEBUG_LEVEL_FATAL          0 
    37 #define DEBUG_LEVEL_ERROR          1 
    38 #define DEBUG_LEVEL_WARNING        2 
    39 #define DEBUG_LEVEL_NORMAL         3 
    40 #define DEBUG_LEVEL_INFO           4 
    41 #define DEBUG_LEVEL_VERBOSE        5 
    42 #define DEBUG_LEVEL_VERY_VERBOSE   6 
    43 #define DEBUG_LEVEL_ULTRA_VERBOSE  7 
     36#define DEBUG_LEVEL_MESSAGE        0 
     37#define DEBUG_LEVEL_FATAL          1 
     38#define DEBUG_LEVEL_ERROR          2 
     39#define DEBUG_LEVEL_WARNING        3 
     40#define DEBUG_LEVEL_NORMAL         4 
     41#define DEBUG_LEVEL_INFO           5 
     42#define DEBUG_LEVEL_VERBOSE        6 
     43#define DEBUG_LEVEL_VERY_VERBOSE   7 
     44#define DEBUG_LEVEL_ULTRA_VERBOSE  8 
    4445 
    4546#define DEBUG_MAX_MESSAGE_LENGTH 512 
     
    9596                                     ##args ) 
    9697 
     98// these are for messages that are also displayed when not compiled 
     99// for debug 
     100#define printMessage( format, args... )                             \ 
     101                m_debugModule.print( DebugModule::eDL_Message,      \ 
     102                                     __FILE__,                      \ 
     103                                     __FUNCTION__,                  \ 
     104                                     __LINE__,                      \ 
     105                                    format,                         \ 
     106                                    ##args ) 
     107#define printMessageShort( format, args... )                        \ 
     108                m_debugModule.printShort( DebugModule::eDL_Message, \ 
     109                                     format,                        \ 
     110                                     ##args ) 
     111 
    97112#define DECLARE_DEBUG_MODULE static DebugModule m_debugModule 
    98113#define IMPL_DEBUG_MODULE( ClassName, RegisterName, Level )        \ 
     
    182197public: 
    183198    enum { 
     199        eDL_Message      = DEBUG_LEVEL_MESSAGE, 
    184200        eDL_Fatal        = DEBUG_LEVEL_FATAL, 
    185201        eDL_Error        = DEBUG_LEVEL_ERROR, 
  • branches/ppalmers-streaming/src/devicemanager.h

    r674 r730  
    3232 
    3333#include "libutil/OptionContainer.h" 
    34 // #include "libosc/OscServer.h" 
    35 // #include "libosc/OscNode.h" 
    3634#include "libcontrol/BasicElements.h" 
    3735 
  • branches/ppalmers-streaming/src/ffadodevice.cpp

    r674 r730  
    118118 
    119119    retval=setOption("id",idstr.str()); 
    120 /*    if (retval) { 
    121         setOscBase(idstr.str()); 
    122     }*/ 
    123120    return retval; 
    124121} 
  • branches/ppalmers-streaming/src/SConscript

    r712 r730  
    4242        libieee1394/ieee1394service.cpp \ 
    4343        libieee1394/IEC61883.cpp \ 
    44         libosc/OscArgument.cpp \ 
    45         libosc/OscClient.cpp \ 
    46         libosc/OscMessage.cpp \ 
    47         libosc/OscNode.cpp \ 
    48         libosc/OscResponse.cpp \ 
    49         libosc/OscServer.cpp \ 
    5044        libstreaming/StreamProcessorManager.cpp \ 
    5145        libstreaming/util/cip.c \ 
     
    197191        libenv.MergeFlags( env['ALSA_FLAGS'] ) 
    198192        libenv.MergeFlags( env['LIBXML26_FLAGS'] ) 
    199         libenv.MergeFlags( env['LIBLO_FLAGS'] ) 
    200193 
    201194#env1.AppendUnique( LINKFLAGS = env.Split("-Wl,-rpath $libdir -Wl,-soname -Wl,libffado.so.1 --version-info=1:0:0") ) 
     
    248241        "test-dll" : "libutil/test-dll.cpp", \ 
    249242        "test-unittests-util" : "libutil/unittests.cpp", \ 
    250         "test-unittests-osc" : "libosc/unittests.cpp" \ 
    251243} 
    252244 
  • branches/ppalmers-streaming/support/dbus/ffado-dbus-server.cpp

    r639 r730  
    5252#include <sstream> 
    5353 
    54 #include <lo/lo.h> 
    55  
    5654using namespace std; 
    5755 
    5856DECLARE_GLOBAL_DEBUG_MODULE; 
    59  
    60 // prototypes & stuff for listing the OSC space 
    61 void list_osc_paths(lo_server s, lo_address t, const char *path); 
    62 void list_osc_params(lo_server s, lo_address t, const char *path); 
    63 string osc_param_get_value(lo_server s, lo_address t, const char *path, const char *param); 
    64  
    65 vector<string> osc_paths; 
    66 vector<string> osc_params; 
    67 string osc_value; 
    68  
    69 int osc_path_response_handler(const char *path, const char *types, lo_arg **argv, int argc, 
    70     void *data, void *user_data); 
    71  
    72 int osc_param_response_handler(const char *path, const char *types, lo_arg **argv, int argc, 
    73     void *data, void *user_data); 
    74  
    75 int osc_data_response_handler(const char *path, const char *types, lo_arg **argv, int argc, 
    76     void *data, void *user_data); 
    77  
    78 void osc_error_handler(int num, const char *msg, const char *path); 
    7957 
    8058// DBUS stuff 
     
    9472 
    9573// Program documentation. 
    96 static char doc[] = "FFADO -- a driver for Firewire Audio devices (test application)\n\n" 
    97                     "OPERATION: Discover\n" 
    98                     "           SetSamplerate samplerate\n" 
    99                     "           SetClockSource [id]\n" 
    100                     "           ListOscSpace\n" 
    101                     "           OscServer\n" 
    102                     "           DBus\n" 
     74static char doc[] = "ffado-dbus-server -- expose the mixer features of connected FFADO devices through DBus\n\n" 
    10375                    ; 
    10476 
    10577// A description of the arguments we accept. 
    106 static char args_doc[] = "OPERATION"; 
     78static char args_doc[] = ""; 
    10779 
    10880struct arguments 
     
    12496 
    12597 
    126     {"node",     'n',    "id",    0,  "Node to use" }, 
     98    {"node",     'n',    "id",    0,  "Only expose mixer of a device on a specific node" }, 
    12799    {"port",     'p',    "nr",    0,  "IEEE1394 Port to use" }, 
    128100    { 0 } 
     
    148120            arguments->verbose = strtol( arg, &tail, 0 ); 
    149121            if ( errno ) { 
    150                 fprintf( stderr, "Could not parse 'verbose' argument\n" ); 
     122                debugError( "Could not parse 'verbose' argument\n" ); 
    151123                return ARGP_ERR_UNKNOWN; 
    152124            } 
     
    157129            arguments->port = strtol( arg, &tail, 0 ); 
    158130            if ( errno ) { 
    159                 fprintf( stderr, "Could not parse 'port' argument\n" ); 
     131                debugError( "Could not parse 'port' argument\n" ); 
    160132                return ARGP_ERR_UNKNOWN; 
    161133            } 
    162134        } else { 
    163135            if ( errno ) { 
    164                 fprintf( stderr, "Could not parse 'port' argumen\n" ); 
     136                debugError("Could not parse 'port' argumen\n" ); 
    165137                return ARGP_ERR_UNKNOWN; 
    166138            } 
     
    171143            arguments->node_id = strtol( arg, &tail, 0 ); 
    172144            if ( errno ) { 
    173                 fprintf( stderr, "Could not parse 'node' argument\n" ); 
     145                debugError( "Could not parse 'node' argument\n" ); 
    174146                return ARGP_ERR_UNKNOWN; 
    175147            } 
     
    177149        } else { 
    178150            if ( errno ) { 
    179                 fprintf( stderr, "Could not parse 'node' argumen\n" ); 
     151                debugError("Could not parse 'node' argumen\n" ); 
    180152                return ARGP_ERR_UNKNOWN; 
    181153            } 
     
    183155        break; 
    184156    case ARGP_KEY_ARG: 
    185         if (state->arg_num >= 3) { 
     157        if (state->arg_num >= 1) { 
    186158            // Too many arguments. 
    187159            argp_usage( state ); 
     
    190162        break; 
    191163    case ARGP_KEY_END: 
    192         if (state->arg_num < 1) { 
     164        if (state->arg_num < 0) { 
    193165        // Not enough arguments. 
    194166        argp_usage( state ); 
     
    207179    debugOutput( DEBUG_LEVEL_NORMAL, "Debug output flushed...\n" ); 
    208180    flushDebugOutput(); 
    209      
    210181    return retval; 
    211182} 
     
    230201    // be reflected in `arguments'. 
    231202    if ( argp_parse ( &argp, argc, argv, 0, 0, &arguments ) ) { 
    232         fprintf( stderr, "Could not parse command line\n" ); 
     203        debugError("Could not parse command line\n" ); 
    233204        return exitfunction(-1); 
    234205    } 
    235206 
    236     printf("verbose level = %d\n", arguments.verbose); 
    237  
    238     printf( "Using ffado library version: %s\n\n", ffado_get_version() ); 
    239  
    240     if ( strcmp( arguments.args[0], "Discover" ) == 0 ) { 
     207    debugOutput( DEBUG_LEVEL_NORMAL, "verbose level = %d\n", arguments.verbose); 
     208    debugOutput( DEBUG_LEVEL_NORMAL, "Using ffado library version: %s\n\n", ffado_get_version() ); 
     209 
    241210        DeviceManager *m_deviceManager = new DeviceManager(); 
    242211        if ( !m_deviceManager ) { 
    243             fprintf( stderr, "Could not allocate device manager\n" ); 
     212            debugError("Could not allocate device manager\n" ); 
     213            return exitfunction(-1); 
     214        } 
     215        if ( !m_deviceManager->initialize( arguments.port ) ) { 
     216            debugError("Could not initialize device manager\n" ); 
     217            delete m_deviceManager; 
    244218            return exitfunction(-1); 
    245219        } 
     
    247221            m_deviceManager->setVerboseLevel(arguments.verbose); 
    248222        } 
    249         if ( !m_deviceManager->initialize( arguments.port ) ) { 
    250             fprintf( stderr, "Could not initialize device manager\n" ); 
    251             delete m_deviceManager; 
    252             return exitfunction(-1); 
    253         } 
    254         if ( arguments.verbose ) { 
    255             m_deviceManager->setVerboseLevel(arguments.verbose); 
    256         } 
    257223        if ( !m_deviceManager->discover() ) { 
    258             fprintf( stderr, "Could not discover devices\n" ); 
    259             delete m_deviceManager; 
    260             return exitfunction(-1); 
    261         } 
    262         delete m_deviceManager; 
    263         return exitfunction(0); 
    264     } else if ( strcmp( arguments.args[0], "SetSamplerate" ) == 0 ) { 
    265         char* tail; 
    266         int samplerate = strtol( arguments.args[1], &tail, 0 ); 
    267         if ( errno ) { 
    268             fprintf( stderr,  "Could not parse samplerate argument\n" ); 
    269             return exitfunction(-1); 
    270         } 
    271  
    272         DeviceManager *m_deviceManager = new DeviceManager(); 
    273         if ( !m_deviceManager ) { 
    274             fprintf( stderr, "Could not allocate device manager\n" ); 
    275             return exitfunction(-1); 
    276         } 
    277         if ( arguments.verbose ) { 
    278             m_deviceManager->setVerboseLevel(arguments.verbose); 
    279         } 
    280         if ( !m_deviceManager->initialize( arguments.port ) ) { 
    281             fprintf( stderr, "Could not initialize device manager\n" ); 
    282             delete m_deviceManager; 
    283             return exitfunction(-1); 
    284         } 
    285         if ( arguments.verbose ) { 
    286             m_deviceManager->setVerboseLevel(arguments.verbose); 
    287         } 
    288         if ( !m_deviceManager->discover() ) { 
    289             fprintf( stderr, "Could not discover devices\n" ); 
    290             delete m_deviceManager; 
    291             return exitfunction(-1); 
    292         } 
    293  
    294         if(arguments.node_id_set) { 
    295             FFADODevice* avDevice = m_deviceManager->getAvDevice( arguments.node_id ); 
    296             if ( avDevice ) { 
    297                 avDevice->setVerboseLevel(arguments.verbose); 
    298                 if ( ! avDevice->setSamplingFrequency( samplerate ) ) { 
    299                     fprintf( stderr, "Could not set samplerate\n" ); 
    300                 } 
    301             } 
    302         } else { 
    303             int i=0; 
    304  
    305             int devices_on_bus = m_deviceManager->getNbDevices(); 
    306             printf("  port = %d, devices_on_bus = %d\n", arguments.port, devices_on_bus); 
    307  
    308             for(i=0;i<devices_on_bus;i++) { 
    309                 int node_id=m_deviceManager->getDeviceNodeId(i); 
    310                 printf("  set samplerate for device = %d, node = %d\n", i, node_id); 
    311                 FFADODevice* avDevice = m_deviceManager->getAvDevice( node_id ); 
    312                 if ( avDevice ) { 
    313                     avDevice->setVerboseLevel(arguments.verbose); 
    314                     if ( !avDevice->setSamplingFrequency( samplerate ) ) { 
    315                         fprintf( stderr, "Could not set samplerate\n" ); 
    316                     } 
    317                 } 
    318             } 
    319         } 
    320         delete m_deviceManager; 
    321         return exitfunction(0); 
    322     } else if ( strcmp( arguments.args[0], "SetClockSource" ) == 0 ) { 
    323         char* tail; 
    324         unsigned int targetid = (unsigned int)strtol( arguments.args[1], &tail, 0 ); 
    325         if ( errno ) { 
    326             fprintf( stderr,  "Could not parse clock source argument\n" ); 
    327             targetid=0xFFFF; 
    328         } 
    329         DeviceManager *m_deviceManager = new DeviceManager(); 
    330         if ( !m_deviceManager ) { 
    331             fprintf( stderr, "Could not allocate device manager\n" ); 
    332             return exitfunction(-1); 
    333         } 
    334         if ( arguments.verbose ) { 
    335             m_deviceManager->setVerboseLevel(arguments.verbose); 
    336         } 
    337         if ( !m_deviceManager->initialize( arguments.port ) ) { 
    338             fprintf( stderr, "Could not initialize device manager\n" ); 
    339             delete m_deviceManager; 
    340             return exitfunction(-1); 
    341         } 
    342         if ( arguments.verbose ) { 
    343             m_deviceManager->setVerboseLevel(arguments.verbose); 
    344         } 
    345         if ( !m_deviceManager->discover() ) { 
    346             fprintf( stderr, "Could not discover devices\n" ); 
    347             delete m_deviceManager; 
    348             return exitfunction(-1); 
    349         } 
    350  
    351         if(arguments.node_id_set) { 
    352             FFADODevice* avDevice = m_deviceManager->getAvDevice( arguments.node_id ); 
    353             if ( avDevice ) { 
    354                 FFADODevice::ClockSource s; 
    355              
    356                 avDevice->setVerboseLevel(arguments.verbose); 
    357                 FFADODevice::ClockSourceVector sources=avDevice->getSupportedClockSources(); 
    358                 for ( FFADODevice::ClockSourceVector::const_iterator it 
    359                         = sources.begin(); 
    360                     it != sources.end(); 
    361                     ++it ) 
    362                 { 
    363                     FFADODevice::ClockSource c=*it; 
    364                     printf( " Type: %s, Id: %d, Valid: %d, Active: %d, Description: %s\n", 
    365                         FFADODevice::ClockSourceTypeToString(c.type), c.id, c.valid, c.active, c.description.c_str()); 
    366                      
    367                     if (c.id==targetid) { 
    368                         s=*it; 
    369                     } 
    370                 } 
    371                  
    372                 if (s.type != FFADODevice::eCT_Invalid) { 
    373                     printf("  set clock source to %d\n", s.id); 
    374                     if ( ! avDevice->setActiveClockSource( s ) ) { 
    375                         fprintf( stderr, "Could not set clock source\n" ); 
    376                     } 
    377                 } else { 
    378                     printf("  no clock source with id %d found\n", targetid); 
    379                 } 
    380             } 
    381         } else { 
    382             fprintf( stderr, "please specify a node\n" ); 
    383         } 
    384         delete m_deviceManager; 
    385         return exitfunction(0); 
    386     } else if ( strcmp( arguments.args[0], "ListOscSpace" ) == 0 ) { 
    387         // list osc space by using OSC messages 
    388         // a server is assumed to be present 
    389  
    390         /* start a new server. 
    391         when sending a message from this context, the response 
    392         address will be set to this server's address. 
    393         */ 
    394         lo_server s = lo_server_new(NULL, osc_error_handler); 
    395         lo_address t = lo_address_new(NULL, "17820"); 
    396  
    397         list_osc_paths(s, t, "/"); 
    398  
    399         lo_address_free(t); 
    400         lo_server_free(s); 
    401  
    402     } else if ( strcmp( arguments.args[0], "OscServer" ) == 0 ) { 
    403         DeviceManager *m_deviceManager = new DeviceManager(); 
    404         if ( !m_deviceManager ) { 
    405             fprintf( stderr, "Could not allocate device manager\n" ); 
    406             return exitfunction(-1); 
    407         } 
    408         if ( !m_deviceManager->initialize( arguments.port ) ) { 
    409             fprintf( stderr, "Could not initialize device manager\n" ); 
    410             delete m_deviceManager; 
    411             return exitfunction(-1); 
    412         } 
    413         if ( arguments.verbose ) { 
    414             m_deviceManager->setVerboseLevel(arguments.verbose); 
    415         } 
    416         if ( !m_deviceManager->discover() ) { 
    417             fprintf( stderr, "Could not discover devices\n" ); 
    418             delete m_deviceManager; 
    419             return exitfunction(-1); 
    420         } 
    421  
    422         printf("server started\n"); 
    423         printf("press ctrl-c to stop it & continue\n"); 
    424  
    425         signal (SIGINT, sighandler); 
    426  
    427         run=1; 
    428         while(run) { 
    429             sleep(1); 
    430             fflush(stdout); 
    431             fflush(stderr); 
    432         } 
    433         signal (SIGINT, SIG_DFL); 
    434  
    435         printf("server stopped\n"); 
    436         delete m_deviceManager; 
    437         return exitfunction(0); 
    438     } else if ( strcmp( arguments.args[0], "DBus" ) == 0 ) { 
    439         DeviceManager *m_deviceManager = new DeviceManager(); 
    440         if ( !m_deviceManager ) { 
    441             fprintf( stderr, "Could not allocate device manager\n" ); 
    442             return exitfunction(-1); 
    443         } 
    444         if ( !m_deviceManager->initialize( arguments.port ) ) { 
    445             fprintf( stderr, "Could not initialize device manager\n" ); 
    446             delete m_deviceManager; 
    447             return exitfunction(-1); 
    448         } 
    449         if ( arguments.verbose ) { 
    450             m_deviceManager->setVerboseLevel(arguments.verbose); 
    451         } 
    452         if ( !m_deviceManager->discover() ) { 
    453             fprintf( stderr, "Could not discover devices\n" ); 
     224            debugError("Could not discover devices\n" ); 
    454225            delete m_deviceManager; 
    455226            return exitfunction(-1); 
     
    469240            = new DBusControl::Container(conn, "/org/ffado/Control/DeviceManager", *m_deviceManager); 
    470241         
    471         printf("DBUS test service running\n"); 
    472         printf("press ctrl-c to stop it & continue\n"); 
     242        printMessage("DBUS test service running\n"); 
     243        printMessage("press ctrl-c to stop it & continue\n"); 
    473244         
    474245        dispatcher.enter(); 
     
    478249        signal (SIGINT, SIG_DFL); 
    479250 
    480         printf("server stopped\n"); 
     251        printMessage("server stopped\n"); 
    481252        delete m_deviceManager; 
    482253        return exitfunction(0); 
    483     } else { 
    484         printf( "unknown operation\n" ); 
    485     } 
    486  
    487 
    488  
    489 void list_osc_paths(lo_server s, lo_address t, const char *path) { 
    490     vector<string> my_paths; 
    491  
    492     printf("listing path: %s\n", path); 
    493  
    494     osc_paths.clear(); 
    495     lo_server_add_method(s, "/response", NULL, osc_path_response_handler, NULL); 
    496  
    497     if (lo_send(t, path, "s", "list") == -1) { 
    498         printf(" OSC error %d: %s\n", lo_address_errno(t), lo_address_errstr(t)); 
    499     } 
    500  
    501     if (lo_server_recv_noblock(s, 1000) == 0) { 
    502         printf("timeout\n"); 
    503         return; 
    504     } 
    505  
    506     lo_server_del_method(s, "/response", NULL); 
    507  
    508     list_osc_params(s, t, path); 
    509  
    510     my_paths=osc_paths; 
    511     for ( vector<string>::iterator it = my_paths.begin(); 
    512             it != my_paths.end(); 
    513             ++it ) 
    514     { 
    515         string new_path=string(path) + *it; 
    516         new_path += string("/"); 
    517         list_osc_paths(s, t, new_path.c_str()); 
    518     } 
    519  
    520 
    521  
    522 void list_osc_params(lo_server s, lo_address t, const char *path) { 
    523     vector<string> my_paths; 
    524     printf("params for: %s\n", path); 
    525  
    526     osc_params.clear(); 
    527     lo_server_add_method(s, "/response", NULL, osc_param_response_handler, NULL); 
    528  
    529     if (lo_send(t, path, "s", "params") == -1) { 
    530         printf(" OSC error %d: %s\n", lo_address_errno(t), lo_address_errstr(t)); 
    531     } 
    532  
    533     if (lo_server_recv_noblock(s, 1000) == 0) { 
    534         printf("timeout\n"); 
    535         return; 
    536     } 
    537  
    538     lo_server_del_method(s, "/response", NULL); 
    539  
    540     vector<string> my_params=osc_params; 
    541  
    542     for ( vector<string>::iterator it = my_params.begin(); 
    543             it != my_params.end(); 
    544             ++it ) 
    545     { 
    546         string value=osc_param_get_value(s, t, path, (*it).c_str()); 
    547         printf("  %20s = %s\n", (*it).c_str(), value.c_str()); 
    548     } 
    549  
    550 
    551  
    552 string osc_param_get_value(lo_server s, lo_address t, const char *path, const char *param) { 
    553     lo_server_add_method(s, "/response", NULL, osc_data_response_handler, NULL); 
    554  
    555     if (lo_send(t, path, "ss", "get", param) == -1) { 
    556         printf(" OSC error %d: %s\n", lo_address_errno(t), lo_address_errstr(t)); 
    557     } 
    558  
    559     if (lo_server_recv_noblock(s, 1000) == 0) { 
    560         return string("timeout"); 
    561     } 
    562  
    563     lo_server_del_method(s, "/response", NULL); 
    564     return osc_value; 
    565 
    566  
    567 void osc_error_handler(int num, const char *msg, const char *path) 
    568 
    569     printf("liblo server error %d in path %s: %s\n", num, path, msg); 
    570 
    571  
    572 int osc_path_response_handler(const char *path, const char *types, lo_arg **argv, int argc, 
    573         void *data, void *user_data) 
    574 
    575     for (int i=0; i< argc;i++) { 
    576         switch (lo_type(types[i])) { 
    577             /** Standard C, NULL terminated string. */ 
    578             case LO_STRING: 
    579                 osc_paths.push_back(string(&(argv[i]->s))); 
    580                 break; 
    581             default: 
    582                 printf("unexpected data type in response message\n"); 
    583         } 
    584     } 
    585     return 1; 
    586 
    587  
    588 int osc_param_response_handler(const char *path, const char *types, lo_arg **argv, int argc, 
    589         void *data, void *user_data) 
    590 
    591     for (int i=0; i< argc;i++) { 
    592         switch (lo_type(types[i])) { 
    593             /** Standard C, NULL terminated string. */ 
    594             case LO_STRING: 
    595                 osc_params.push_back(string(&(argv[i]->s))); 
    596                 break; 
    597             default: 
    598                 printf("unexpected data type in response message\n"); 
    599         } 
    600     } 
    601     return 1; 
    602 
    603  
    604 int osc_data_response_handler(const char *path, const char *types, lo_arg **argv, int argc, 
    605         void *data, void *user_data) 
    606 
    607     std::ostringstream str; 
    608  
    609     if(argc==1) { 
    610         switch (lo_type(types[0])) { 
    611             /* basic OSC types */ 
    612             /** 32 bit signed integer. */ 
    613             case LO_INT32: 
    614                 str << "0x" << std::hex << argv[0]->i; 
    615                 osc_value=str.str(); 
    616                 break; 
    617             case LO_INT64: 
    618                 str << "0x" << std::hex << argv[0]->h; 
    619                 osc_value=str.str(); 
    620                 break; 
    621             /** 32 bit IEEE-754 float. */ 
    622             case LO_FLOAT: 
    623                 str << argv[0]->f; 
    624                 osc_value=str.str(); 
    625                 break; 
    626             /** Standard C, NULL terminated string. */ 
    627             case LO_STRING: 
    628                 osc_value=string(&argv[0]->s); 
    629                 break; 
    630             default: 
    631                 osc_value="unsupported response datatype"; 
    632         } 
    633     } else { 
    634         osc_value="invalid response"; 
    635     } 
    636     return 1; 
    637 
     254
  • branches/ppalmers-streaming/support/firmware/SConscript

    r689 r730  
    1919    env.MergeFlags( env['ALSA_FLAGS'] ) 
    2020    env.MergeFlags( env['LIBXML26_FLAGS'] ) 
    21     env.MergeFlags( env['LIBLO_FLAGS'] ) 
    2221 
    2322apps = { 
     
    2726 
    2827if env['ENABLE_BEBOB']: 
    29     apps["bridgeco-downloader"] = "bridgeco-downloader.cpp" 
    30     installapps += [ "bridgeco-downloader" ] 
     28    apps["ffado-bridgeco-downloader"] = "bridgeco-downloader.cpp" 
     29    installapps += [ "ffado-bridgeco-downloader" ] 
    3130 
    3231if env['ENABLE_FIREWORKS']: 
    33     apps["fireworks-downloader"] = "fireworks-downloader.cpp" 
    34     installapps += [ "fireworks-downloader" ] 
     32    apps["ffado-fireworks-downloader"] = "fireworks-downloader.cpp" 
     33    installapps += [ "ffado-fireworks-downloader" ] 
    3534 
    3635for app in apps.keys(): 
  • branches/ppalmers-streaming/support/SConscript

    r688 r730  
    1818# 
    1919 
    20 env.SConscript( dirs=["mixer","firmware"], exports="env" ) 
     20env.SConscript( dirs=["mixer","firmware","dbus"], exports="env" ) 
    2121 
  • branches/ppalmers-streaming/tests/SConscript

    r663 r730  
    55env = env.Copy() 
    66 
    7 env.PrependUnique( CPPPATH=["#/src", "#/external/dbus/include"] ) 
    8 env.PrependUnique( LIBPATH=[env['build_base']+"src", env['build_base']+"external/dbus"] ) 
    9 env.PrependUnique( LIBS=["ffado", "dbus-c++"] ) 
     7env.PrependUnique( CPPPATH=["#/src"] ) 
     8env.PrependUnique( LIBPATH=[env['build_base']+"src"] ) 
     9env.PrependUnique( LIBS=["ffado"] ) 
    1010 
    1111if not env.GetOption( "clean" ): 
    12         env.MergeFlags( env["DBUS1_FLAGS"] ) 
    1312        env.MergeFlags( env['LIBRAW1394_FLAGS'] ) 
    1413        env.MergeFlags( env['LIBXML26_FLAGS'] ) 
    15  
    16 env.Xml2Cpp_Proxy('controlclient-glue.h', 'control-interface.xml') 
    17 env.Xml2Cpp_Adaptor('controlserver-glue.h', 'control-interface.xml') 
    1814 
    1915# 
     
    2218# 
    2319apps = { 
    24         "test-ffado" : "test-ffado.cpp controlserver.cpp", 
     20        "test-ffado" : "test-ffado.cpp", 
    2521        "test-fw410" : "test-fw410.cpp", 
    2622        "test-avccmd" : "test-avccmd.cpp", 
     
    3329        "test-streamdump" : "test-streamdump.cpp", 
    3430        "test-sytmonitor" : "test-sytmonitor.cpp SytMonitor.cpp", 
    35         "test-dbus" : "test-dbus.cpp controlclient.cpp", 
    36         "test-dbus-server" : "test-dbus-server.cpp controlserver.cpp", 
    3731} 
    3832 
  • branches/ppalmers-streaming/tests/test-ffado.cpp

    r639 r730  
    3636#include "ffadodevice.h" 
    3737 
    38 #include <dbus-c++/dbus.h> 
    39 #include "controlserver.h" 
    40 #include "libcontrol/BasicElements.h" 
    41  
    4238#include <signal.h> 
    4339 
     
    5248#include <sstream> 
    5349 
    54 #include <lo/lo.h> 
    55  
    5650using namespace std; 
    5751 
    5852DECLARE_GLOBAL_DEBUG_MODULE; 
    59  
    60 // prototypes & stuff for listing the OSC space 
    61 void list_osc_paths(lo_server s, lo_address t, const char *path); 
    62 void list_osc_params(lo_server s, lo_address t, const char *path); 
    63 string osc_param_get_value(lo_server s, lo_address t, const char *path, const char *param); 
    64  
    65 vector<string> osc_paths; 
    66 vector<string> osc_params; 
    67 string osc_value; 
    68  
    69 int osc_path_response_handler(const char *path, const char *types, lo_arg **argv, int argc, 
    70     void *data, void *user_data); 
    71  
    72 int osc_param_response_handler(const char *path, const char *types, lo_arg **argv, int argc, 
    73     void *data, void *user_data); 
    74  
    75 int osc_data_response_handler(const char *path, const char *types, lo_arg **argv, int argc, 
    76     void *data, void *user_data); 
    77  
    78 void osc_error_handler(int num, const char *msg, const char *path); 
    79  
    80 // DBUS stuff 
    81 DBus::BusDispatcher dispatcher; 
    82  
    83 // signal handler 
    84 int run=1; 
    85 static void sighandler (int sig) 
    86 { 
    87     run = 0; 
    88     dispatcher.leave(); 
    89 } 
    9053 
    9154// global's 
     
    9861                    "           SetSamplerate samplerate\n" 
    9962                    "           SetClockSource [id]\n" 
    100                     "           ListOscSpace\n" 
    101                     "           OscServer\n" 
    102                     "           DBus\n" 
    10363                    ; 
    10464 
     
    384344        delete m_deviceManager; 
    385345        return exitfunction(0); 
    386     } else if ( strcmp( arguments.args[0], "ListOscSpace" ) == 0 ) { 
    387         // list osc space by using OSC messages 
    388         // a server is assumed to be present 
    389  
    390         /* start a new server. 
    391         when sending a message from this context, the response 
    392         address will be set to this server's address. 
    393         */ 
    394         lo_server s = lo_server_new(NULL, osc_error_handler); 
    395         lo_address t = lo_address_new(NULL, "17820"); 
    396  
    397         list_osc_paths(s, t, "/"); 
    398  
    399         lo_address_free(t); 
    400         lo_server_free(s); 
    401  
    402     } else if ( strcmp( arguments.args[0], "OscServer" ) == 0 ) { 
    403         DeviceManager *m_deviceManager = new DeviceManager(); 
    404         if ( !m_deviceManager ) { 
    405             fprintf( stderr, "Could not allocate device manager\n" ); 
    406             return exitfunction(-1); 
    407         } 
    408         if ( !m_deviceManager->initialize( arguments.port ) ) { 
    409             fprintf( stderr, "Could not initialize device manager\n" ); 
    410             delete m_deviceManager; 
    411             return exitfunction(-1); 
    412         } 
    413         if ( arguments.verbose ) { 
    414             m_deviceManager->setVerboseLevel(arguments.verbose); 
    415         } 
    416         if ( !m_deviceManager->discover() ) { 
    417             fprintf( stderr, "Could not discover devices\n" ); 
    418             delete m_deviceManager; 
    419             return exitfunction(-1); 
    420         } 
    421  
    422         printf("server started\n"); 
    423         printf("press ctrl-c to stop it & continue\n"); 
    424  
    425         signal (SIGINT, sighandler); 
    426  
    427         run=1; 
    428         while(run) { 
    429             sleep(1); 
    430             fflush(stdout); 
    431             fflush(stderr); 
    432         } 
    433         signal (SIGINT, SIG_DFL); 
    434  
    435         printf("server stopped\n"); 
    436         delete m_deviceManager; 
    437         return exitfunction(0); 
    438     } else if ( strcmp( arguments.args[0], "DBus" ) == 0 ) { 
    439         DeviceManager *m_deviceManager = new DeviceManager(); 
    440         if ( !m_deviceManager ) { 
    441             fprintf( stderr, "Could not allocate device manager\n" ); 
    442             return exitfunction(-1); 
    443         } 
    444         if ( !m_deviceManager->initialize( arguments.port ) ) { 
    445             fprintf( stderr, "Could not initialize device manager\n" ); 
    446             delete m_deviceManager; 
    447             return exitfunction(-1); 
    448         } 
    449         if ( arguments.verbose ) { 
    450             m_deviceManager->setVerboseLevel(arguments.verbose); 
    451         } 
    452         if ( !m_deviceManager->discover() ) { 
    453             fprintf( stderr, "Could not discover devices\n" ); 
    454             delete m_deviceManager; 
    455             return exitfunction(-1); 
    456         } 
    457         
    458         signal (SIGINT, sighandler); 
    459          
    460         DBus::_init_threading(); 
    461      
    462         // test DBUS stuff 
    463         DBus::default_dispatcher = &dispatcher; 
    464      
    465         DBus::Connection conn = DBus::Connection::SessionBus(); 
    466         conn.request_name("org.ffado.Control"); 
    467          
    468         DBusControl::Container *container 
    469             = new DBusControl::Container(conn, "/org/ffado/Control/DeviceManager", *m_deviceManager); 
    470          
    471         printf("DBUS test service running\n"); 
    472         printf("press ctrl-c to stop it & continue\n"); 
    473          
    474         dispatcher.enter(); 
    475      
    476         delete container; 
    477  
    478         signal (SIGINT, SIG_DFL); 
    479  
    480         printf("server stopped\n"); 
    481         delete m_deviceManager; 
    482         return exitfunction(0); 
    483     } else { 
    484         printf( "unknown operation\n" ); 
    485346    } 
    486  
    487347} 
    488  
    489 void list_osc_paths(lo_server s, lo_address t, const char *path) { 
    490     vector<string> my_paths; 
    491  
    492     printf("listing path: %s\n", path); 
    493  
    494     osc_paths.clear(); 
    495     lo_server_add_method(s, "/response", NULL, osc_path_response_handler, NULL); 
    496  
    497     if (lo_send(t, path, "s", "list") == -1) { 
    498         printf(" OSC error %d: %s\n", lo_address_errno(t), lo_address_errstr(t)); 
    499     } 
    500  
    501     if (lo_server_recv_noblock(s, 1000) == 0) { 
    502         printf("timeout\n"); 
    503         return; 
    504     } 
    505  
    506     lo_server_del_method(s, "/response", NULL); 
    507  
    508     list_osc_params(s, t, path); 
    509  
    510     my_paths=osc_paths; 
    511     for ( vector<string>::iterator it = my_paths.begin(); 
    512             it != my_paths.end(); 
    513             ++it ) 
    514     { 
    515         string new_path=string(path) + *it; 
    516         new_path += string("/"); 
    517         list_osc_paths(s, t, new_path.c_str()); 
    518     } 
    519  
    520 } 
    521  
    522 void list_osc_params(lo_server s, lo_address t, const char *path) { 
    523     vector<string> my_paths; 
    524     printf("params for: %s\n", path); 
    525  
    526     osc_params.clear(); 
    527     lo_server_add_method(s, "/response", NULL, osc_param_response_handler, NULL); 
    528  
    529     if (lo_send(t, path, "s", "params") == -1) { 
    530         printf(" OSC error %d: %s\n", lo_address_errno(t), lo_address_errstr(t)); 
    531     } 
    532  
    533     if (lo_server_recv_noblock(s, 1000) == 0) { 
    534         printf("timeout\n"); 
    535         return; 
    536     } 
    537  
    538     lo_server_del_method(s, "/response", NULL); 
    539  
    540     vector<string> my_params=osc_params; 
    541  
    542     for ( vector<string>::iterator it = my_params.begin(); 
    543             it != my_params.end(); 
    544             ++it ) 
    545     { 
    546         string value=osc_param_get_value(s, t, path, (*it).c_str()); 
    547         printf("  %20s = %s\n", (*it).c_str(), value.c_str()); 
    548     } 
    549  
    550 } 
    551  
    552 string osc_param_get_value(lo_server s, lo_address t, const char *path, const char *param) { 
    553     lo_server_add_method(s, "/response", NULL, osc_data_response_handler, NULL); 
    554  
    555     if (lo_send(t, path, "ss", "get", param) == -1) { 
    556         printf(" OSC error %d: %s\n", lo_address_errno(t), lo_address_errstr(t)); 
    557     } 
    558  
    559     if (lo_server_recv_noblock(s, 1000) == 0) { 
    560         return string("timeout"); 
    561     } 
    562  
    563     lo_server_del_method(s, "/response", NULL); 
    564     return osc_value; 
    565 } 
    566  
    567 void osc_error_handler(int num, const char *msg, const char *path) 
    568 { 
    569     printf("liblo server error %d in path %s: %s\n", num, path, msg); 
    570 } 
    571  
    572 int osc_path_response_handler(const char *path, const char *types, lo_arg **argv, int argc, 
    573         void *data, void *user_data) 
    574 { 
    575     for (int i=0; i< argc;i++) { 
    576         switch (lo_type(types[i])) { 
    577             /** Standard C, NULL terminated string. */ 
    578             case LO_STRING: 
    579                 osc_paths.push_back(string(&(argv[i]->s))); 
    580                 break; 
    581             default: 
    582                 printf("unexpected data type in response message\n"); 
    583         } 
    584     } 
    585     return 1; 
    586 } 
    587  
    588 int osc_param_response_handler(const char *path, const char *types, lo_arg **argv, int argc, 
    589         void *data, void *user_data) 
    590 { 
    591     for (int i=0; i< argc;i++) { 
    592         switch (lo_type(types[i])) { 
    593             /** Standard C, NULL terminated string. */ 
    594             case LO_STRING: 
    595                 osc_params.push_back(string(&(argv[i]->s))); 
    596                 break; 
    597             default: 
    598                 printf("unexpected data type in response message\n"); 
    599         } 
    600     } 
    601     return 1; 
    602 } 
    603  
    604 int osc_data_response_handler(const char *path, const char *types, lo_arg **argv, int argc, 
    605         void *data, void *user_data) 
    606 { 
    607     std::ostringstream str; 
    608  
    609     if(argc==1) { 
    610         switch (lo_type(types[0])) { 
    611             /* basic OSC types */ 
    612             /** 32 bit signed integer. */ 
    613             case LO_INT32: 
    614                 str << "0x" << std::hex << argv[0]->i; 
    615                 osc_value=str.str(); 
    616                 break; 
    617             case LO_INT64: 
    618                 str << "0x" << std::hex << argv[0]->h; 
    619                 osc_value=str.str(); 
    620                 break; 
    621             /** 32 bit IEEE-754 float. */ 
    622             case LO_FLOAT: 
    623                 str << argv[0]->f; 
    624                 osc_value=str.str(); 
    625                 break; 
    626             /** Standard C, NULL terminated string. */ 
    627             case LO_STRING: 
    628                 osc_value=string(&argv[0]->s); 
    629                 break; 
    630             default: 
    631                 osc_value="unsupported response datatype"; 
    632         } 
    633     } else { 
    634         osc_value="invalid response"; 
    635     } 
    636     return 1; 
    637 }