Changeset 1297 for branches

Show
Ignore:
Timestamp:
07/13/08 15:35:22 (13 years ago)
Author:
ppalmers
Message:

improve signals

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/libffado-2.0/support/dbus/control-interface.xml

    r1173 r1297  
    3131          <arg type="s" name="name" direction="out"/> 
    3232      </method> 
     33      <signal name="Destroyed"></signal> 
    3334      <signal name="Updated"></signal> 
     35      <signal name="PreUpdate"></signal> 
     36      <signal name="PostUpdate"></signal> 
    3437  </interface> 
    3538 
  • branches/libffado-2.0/support/dbus/controlserver.cpp

    r1201 r1297  
    4444    // allocate a lock 
    4545    if(parent == NULL) { 
    46         m_UpdateLock = new Util::PosixMutex(); 
     46        m_UpdateLock = new Util::PosixMutex("CTLSVEL"); 
    4747    } else { 
    4848        m_UpdateLock = NULL; 
     
    129129 
    130130    // register an update signal handler 
    131     m_updateFunctor = new MemberSignalFunctor< Container*, 
     131    m_updateFunctor = new MemberSignalFunctor1< Container*, 
    132132                      void (Container::*)(int) > 
    133133                      ( this, &Container::updated, (int)Control::Container::eS_Updated ); 
     
    148148    debugOutput( DEBUG_LEVEL_VERBOSE, "Deleting Container on '%s'\n", 
    149149                 path().c_str() ); 
     150 
     151    Destroyed(); //send dbus signal 
     152 
    150153    if(m_updateFunctor) { 
    151154        if(!m_Slave.remSignalHandler(m_updateFunctor)) { 
     
    201204    bool something_changed = false; 
    202205    debugOutput( DEBUG_LEVEL_VERBOSE, "Updating tree...\n"); 
     206    // send a pre update signal 
     207    PreUpdate(); 
    203208    debugOutput( DEBUG_LEVEL_VERBOSE, "Add handlers for elements...\n"); 
    204209    // add handlers for the slaves that don't have one yet 
     
    272277        Updated(); 
    273278    } 
     279    // send a post update signal 
     280    PostUpdate(); 
    274281} 
    275282 
  • branches/libffado-2.0/support/dbus/controlserver.h

    r1173 r1297  
    4545 
    4646template< typename CalleePtr, typename MemFunPtr > 
    47 class MemberSignalFunctor 
     47class MemberSignalFunctor0 
    4848    : public Control::SignalFunctor 
    4949{ 
    5050public: 
    51     MemberSignalFunctor( const CalleePtr& pCallee, 
     51    MemberSignalFunctor0( const CalleePtr& pCallee, 
    5252            MemFunPtr pMemFun, 
    5353            int pSignalId) 
     
    5757        {} 
    5858 
    59     virtual ~MemberSignalFunctor() 
     59    virtual ~MemberSignalFunctor0() 
    6060        {} 
     61 
     62    virtual void operator() () 
     63        { 
     64            ( ( *m_pCallee ).*m_pMemFun )(); 
     65        } 
     66    virtual void operator() (int) {} 
     67private: 
     68    CalleePtr  m_pCallee; 
     69    MemFunPtr  m_pMemFun; 
     70}; 
     71 
     72template< typename CalleePtr, typename MemFunPtr > 
     73class MemberSignalFunctor1 
     74    : public Control::SignalFunctor 
     75{ 
     76public: 
     77    MemberSignalFunctor1( const CalleePtr& pCallee, 
     78            MemFunPtr pMemFun, 
     79            int pSignalId) 
     80        : Control::SignalFunctor( pSignalId ) 
     81        , m_pCallee( pCallee ) 
     82        , m_pMemFun( pMemFun ) 
     83        {} 
     84 
     85    virtual ~MemberSignalFunctor1() 
     86        {} 
     87 
     88    virtual void operator() () {} 
    6189 
    6290    virtual void operator() (int value) 
     
    119147 
    120148    void updated(int new_nb_elements); 
     149    void destroyed(); 
     150 
    121151    void setVerboseLevel( const DBus::Int32 &); 
    122152private: 
  • branches/libffado-2.0/support/dbus/ffado-dbus-server.cpp

    r1238 r1297  
    333333    delete postupdate_functor; 
    334334    delete container; 
     335    delete m_deviceManager; 
    335336 
    336337    signal (SIGINT, SIG_DFL); 
    337     delete m_deviceManager; 
    338338 
    339339    printMessage(" Bye.\n");