Changeset 1474 for branches

Show
Ignore:
Timestamp:
11/23/08 03:25:32 (15 years ago)
Author:
ppalmers
Message:

add a streaming status control element to the control tree and use it in the global control element

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/libffado-2.0/src/ffadodevice.cpp

    r1406 r1474  
    7373        if(!m_genericContainer->addElement(new Control::Nickname(*this))) { 
    7474            debugWarning("failed to add Nickname control to container\n"); 
     75        } 
     76        // add a generic control for the streaming status 
     77        if(!m_genericContainer->addElement(new Control::StreamingStatus(*this))) { 
     78            debugWarning("failed to add StreamingStatus control to container\n"); 
    7579        } 
    7680    } 
  • branches/libffado-2.0/src/ffadodevice.h

    r1406 r1474  
    264264     */ 
    265265    enum eStreamingState { 
    266         eSS_Idle,        ///> not streaming 
    267         eSS_Sending,     ///> the device is sending a stream 
    268         eSS_Receiving,   ///> the device is receiving a stream 
    269         eSS_Both,        ///> the device is sending and receiving a stream 
     266        eSS_Idle = 0,        ///> not streaming 
     267        eSS_Sending = 1,     ///> the device is sending a stream 
     268        eSS_Receiving = 2,   ///> the device is receiving a stream 
     269        eSS_Both = 3,        ///> the device is sending and receiving a stream 
    270270    }; 
    271271 
  • branches/libffado-2.0/src/libcontrol/ClockSelect.cpp

    r1385 r1474  
    260260} 
    261261 
     262// --- stream status feedback selection --- 
     263 
     264StreamingStatus::StreamingStatus(FFADODevice &d) 
     265: Enum(&d) 
     266, m_Device( d ) 
     267{ 
     268    setName("StreamingStatus"); 
     269    setLabel("Streaming Status"); 
     270    setDescription("Obtain information of the current streaming status of a device"); 
     271} 
     272 
     273bool 
     274StreamingStatus::select(int idx) 
     275{ 
     276    debugWarning("Cannot change stream status through control interface\n"); 
     277    return false; 
     278} 
     279 
     280int 
     281StreamingStatus::selected() 
     282{ 
     283    return m_Device.getStreamingState(); 
     284} 
     285 
     286int 
     287StreamingStatus::count() 
     288{ 
     289    // NOTE: this should correspond to the number of enums in FFADODevice::eStreamingState 
     290    return 4; 
     291} 
     292 
     293std::string 
     294StreamingStatus::getEnumLabel(int idx) 
     295{ 
     296    switch(idx) { 
     297        case FFADODevice::eSS_Idle: 
     298            return "Idle"; 
     299        case FFADODevice::eSS_Sending: 
     300            return "Sending"; 
     301        case FFADODevice::eSS_Receiving: 
     302            return "Receiving"; 
     303        case FFADODevice::eSS_Both: 
     304            return "Both"; 
     305        default: 
     306            debugError("Invalid enum index specified: %d\n", idx); 
     307            return "Invalid enum index"; 
     308    } 
     309} 
     310 
     311bool 
     312StreamingStatus::canChangeValue() 
     313{ 
     314    return false; 
     315} 
     316 
     317void 
     318StreamingStatus::show() 
     319{ 
     320    debugOutput( DEBUG_LEVEL_NORMAL, "StreamingStatus Element %s, current: %d\n", 
     321        getName().c_str(), m_Device.getStreamingState()); 
     322} 
     323 
    262324 
    263325} // namespace Control 
  • branches/libffado-2.0/src/libcontrol/ClockSelect.h

    r1385 r1474  
    9090}; 
    9191 
     92/*! 
     93 * @brief Stream status control element 
     94 */ 
     95class StreamingStatus 
     96: public Enum 
     97{ 
     98public: 
     99    StreamingStatus(FFADODevice &); 
     100    virtual ~StreamingStatus() {}; 
     101 
     102    virtual bool select(int idx); 
     103    virtual int selected(); 
     104    virtual int count(); 
     105    virtual std::string getEnumLabel(int idx); 
     106 
     107    virtual bool canChangeValue(); 
     108 
     109    virtual void show(); 
     110 
     111protected: 
     112    FFADODevice &m_Device; 
     113}; 
     114 
    92115}; // namespace Control 
    93116 
  • branches/libffado-2.0/support/mixer-qt4/ffado_dbus_util.py

    r1406 r1474  
    313313        return self.iface_element.canChangeValue() 
    314314 
    315 class SamplerateSelectInterface: 
    316     def __init__(self, servername, devicepath): 
    317         self.basepath=devicepath + '/Generic/SamplerateSelect' 
    318         self.servername=servername 
    319         self.bus=dbus.SessionBus() 
     315class EnumInterface: 
     316    def __init__(self, servername, basepath): 
     317        self.basepath = basepath 
     318        self.servername = servername 
     319        self.bus = dbus.SessionBus() 
    320320        self.dev = self.bus.get_object(self.servername, self.basepath) 
    321321        self.iface = dbus.Interface(self.dev, dbus_interface='org.ffado.Control.Element.Enum') 
     
    332332        return self.iface_element.canChangeValue() 
    333333 
     334class SamplerateSelectInterface(EnumInterface): 
     335    def __init__(self, servername, devicepath): 
     336        EnumInterface.__init__(self, servername, devicepath + '/Generic/SamplerateSelect') 
     337 
     338class StreamingStatusInterface(EnumInterface): 
     339    def __init__(self, servername, devicepath): 
     340        EnumInterface.__init__(self, servername, devicepath + '/Generic/StreamingStatus') 
     341 
    334342class TextInterface: 
    335343    def __init__(self, servername, basepath): 
  • branches/libffado-2.0/support/mixer-qt4/ffado_panelmanager.py

    r1436 r1474  
    298298            clockselect = ClockSelectInterface( FFADO_DBUS_SERVER, FFADO_DBUS_BASEPATH+"/DeviceManager/"+path ) 
    299299            samplerateselect = SamplerateSelectInterface( FFADO_DBUS_SERVER, FFADO_DBUS_BASEPATH+"/DeviceManager/"+path ) 
     300            streamingstatus = StreamingStatusInterface( FFADO_DBUS_SERVER, FFADO_DBUS_BASEPATH+"/DeviceManager/"+path ) 
    300301            nickname = TextInterface( FFADO_DBUS_SERVER, FFADO_DBUS_BASEPATH+"/DeviceManager/"+path+"/Generic/Nickname" ) 
    301302 
     
    307308            globalmixer.clockselect = clockselect 
    308309            globalmixer.samplerateselect = samplerateselect 
     310            globalmixer.streamingstatus = streamingstatus 
    309311            globalmixer.nickname = nickname 
    310312            globalmixer.hw = hw 
     
    334336            mixerwidget.clockselect = clockselect 
    335337            mixerwidget.samplerateselect = samplerateselect 
     338            mixerwidget.streamingstatus = streamingstatus 
    336339            mixerwidget.nickname = nickname 
    337340            mixerwidget.hw = hw 
  • branches/libffado-2.0/support/mixer-qt4/mixer_global.py

    r1433 r1474  
    119119        self.clocksource.setEnabled(self.clockselect.canChangeValue()) 
    120120        self.txtNickname.setEnabled(self.nickname.canChangeValue()) 
     121        ss = self.streamingstatus.selected() 
     122        ss_txt = self.streamingstatus.getEnumLabel(ss) 
     123        if ss_txt == 'Idle': 
     124            self.chkStreamIn.setChecked(False) 
     125            self.chkStreamOut.setChecked(False) 
     126        elif ss_txt == 'Sending': 
     127            self.chkStreamIn.setChecked(False) 
     128            self.chkStreamOut.setChecked(True) 
     129        elif ss_txt == 'Receiving': 
     130            self.chkStreamIn.setChecked(True) 
     131            self.chkStreamOut.setChecked(False) 
     132        elif ss_txt == 'Both': 
     133            self.chkStreamIn.setChecked(True) 
     134            self.chkStreamOut.setChecked(True) 
     135 
  • branches/libffado-2.0/support/mixer-qt4/mixer_global.ui

    r1433 r1474  
    2323    <x>0</x> 
    2424    <y>0</y> 
    25     <width>444</width> 
    26     <height>81</height> 
     25    <width>700</width> 
     26    <height>80</height> 
    2727   </rect> 
    2828  </property> 
     
    3636   <string>Global Mixer Options</string> 
    3737  </property> 
    38   <layout class="QHBoxLayout" name="horizontalLayout" > 
    39    <property name="margin" > 
    40     <number>3</number> 
    41    </property> 
    42    <item> 
    43     <layout class="QGridLayout" name="gridLayout_2" > 
     38  <layout class="QHBoxLayout" > 
     39   <property name="leftMargin" > 
     40    <number>3</number> 
     41   </property> 
     42   <property name="topMargin" > 
     43    <number>3</number> 
     44   </property> 
     45   <property name="rightMargin" > 
     46    <number>3</number> 
     47   </property> 
     48   <property name="bottomMargin" > 
     49    <number>3</number> 
     50   </property> 
     51   <item> 
     52    <layout class="QGridLayout" > 
    4453     <property name="horizontalSpacing" > 
    4554      <number>9</number> 
     
    8493   </item> 
    8594   <item> 
    86     <layout class="QGridLayout" name="gridLayout"
     95    <layout class="QGridLayout"
    8796     <property name="horizontalSpacing" > 
    8897      <number>9</number> 
     
    140149   </item> 
    141150   <item> 
     151    <widget class="QGroupBox" name="grpStatus" > 
     152     <property name="sizePolicy" > 
     153      <sizepolicy vsizetype="Preferred" hsizetype="Maximum" > 
     154       <horstretch>0</horstretch> 
     155       <verstretch>0</verstretch> 
     156      </sizepolicy> 
     157     </property> 
     158     <property name="title" > 
     159      <string>Stream Status</string> 
     160     </property> 
     161     <layout class="QVBoxLayout" > 
     162      <item> 
     163       <widget class="QCheckBox" name="chkStreamOut" > 
     164        <property name="enabled" > 
     165         <bool>false</bool> 
     166        </property> 
     167        <property name="layoutDirection" > 
     168         <enum>Qt::RightToLeft</enum> 
     169        </property> 
     170        <property name="text" > 
     171         <string>Outgoing</string> 
     172        </property> 
     173       </widget> 
     174      </item> 
     175      <item> 
     176       <widget class="QCheckBox" name="chkStreamIn" > 
     177        <property name="enabled" > 
     178         <bool>false</bool> 
     179        </property> 
     180        <property name="layoutDirection" > 
     181         <enum>Qt::RightToLeft</enum> 
     182        </property> 
     183        <property name="text" > 
     184         <string>Incoming</string> 
     185        </property> 
     186       </widget> 
     187      </item> 
     188     </layout> 
     189    </widget> 
     190   </item> 
     191   <item> 
    142192    <spacer> 
    143193     <property name="orientation" > 
     
    147197      <enum>QSizePolicy::Expanding</enum> 
    148198     </property> 
    149      <property name="sizeHint" stdset="0"
     199     <property name="sizeHint"
    150200      <size> 
    151201       <width>330</width>