Changeset 1063

Show
Ignore:
Timestamp:
04/28/08 15:26:08 (15 years ago)
Author:
ppalmers
Message:

implement Nickname control element

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/libffado/src/bebob/focusrite/focusrite_saffirepro.cpp

    r1047 r1063  
    3737    , m_MixerContainer( NULL ) 
    3838    , m_ControlContainer( NULL ) 
     39    , m_deviceNameControl( NULL ) 
    3940{ 
    4041    debugOutput( DEBUG_LEVEL_VERBOSE, "Created BeBoB::Focusrite::SaffireProDevice (NodeID %d)\n", 
     
    256257            "EnableSPDIF1", "Enable S/PDIF 1", "Enable/disable S/PDIF channel")); 
    257258 
    258     result &= m_ControlContainer->addElement( 
    259         new SaffireProDeviceNameControl(*this, 
    260             "DeviceName", "Flash Device Name", "Device name stored in flash memory")); 
     259    m_deviceNameControl = new SaffireProDeviceNameControl(*this, 
     260            "DeviceName", "Flash Device Name", "Device name stored in flash memory"); 
     261    result &= m_ControlContainer->addElement(m_deviceNameControl); 
    261262 
    262263    if (!result) { 
     
    314315 
    315316    return true; 
     317} 
     318 
     319bool 
     320SaffireProDevice::setNickname( std::string name) 
     321{ 
     322    if(m_deviceNameControl) { 
     323        return m_deviceNameControl->setValue(name); 
     324    } else return false; 
     325} 
     326 
     327std::string 
     328SaffireProDevice::getNickname() 
     329{ 
     330    if(m_deviceNameControl) { 
     331        return m_deviceNameControl->getValue(); 
     332    } else return "Unknown"; 
    316333} 
    317334 
  • trunk/libffado/src/bebob/focusrite/focusrite_saffirepro.h

    r957 r1063  
    337337    virtual bool destroyMixer(); 
    338338 
     339    virtual std::string getNickname(); 
     340    virtual bool setNickname(std::string name); 
    339341protected: 
    340342    void rebootDevice(); 
     
    369371    Control::Container *m_MixerContainer; 
    370372    Control::Container *m_ControlContainer; 
     373    SaffireProDeviceNameControl *m_deviceNameControl; 
    371374}; 
    372375 
  • trunk/libffado/src/dice/dice_avdevice.cpp

    r1047 r1063  
    500500} 
    501501 
     502bool 
     503DiceAvDevice::setNickname( std::string name) 
     504{ 
     505    return setDeviceNickName(name); 
     506} 
     507 
     508std::string 
     509DiceAvDevice::getNickname() 
     510{ 
     511    return getDeviceNickName(); 
     512} 
     513 
    502514void 
    503515DiceAvDevice::showDevice() 
     
    13001312} 
    13011313 
     1314bool 
     1315DiceAvDevice::setDeviceNickName(std::string name) { 
     1316    char namestring[DICE_NICK_NAME_SIZE+1]; 
     1317    strncpy(namestring, name.c_str(), DICE_NICK_NAME_SIZE); 
     1318 
     1319    if (!writeGlobalRegBlock(DICE_REGISTER_GLOBAL_NICK_NAME, 
     1320                        (fb_quadlet_t *)namestring, DICE_NICK_NAME_SIZE)) { 
     1321        debugError("Could not write nickname string \n"); 
     1322        return false; 
     1323    } 
     1324    return true; 
     1325} 
     1326 
    13021327DiceAvDevice::diceNameVector 
    13031328DiceAvDevice::splitNameString(std::string in) { 
  • trunk/libffado/src/dice/dice_avdevice.h

    r864 r1063  
    8989    virtual bool disableStreaming(); 
    9090 
     91    virtual std::string getNickname(); 
     92    virtual bool setNickname(std::string name); 
     93 
    9194protected: 
    9295    struct VendorModelEntry *m_model; 
     
    133136    diceNameVector getClockSourceNameString(); 
    134137    std::string getDeviceNickName(); 
     138    bool setDeviceNickName(std::string name); 
    135139 
    136140    enum eClockSourceType  clockIdToType(unsigned int id); 
  • trunk/libffado/src/ffadodevice.cpp

    r967 r1063  
    3030#include "libcontrol/Element.h" 
    3131#include "libcontrol/ClockSelect.h" 
     32#include "libcontrol/Nickname.h" 
    3233 
    3334#include <iostream> 
     
    6364        if(!m_genericContainer->addElement(new Control::ClockSelect(*this))) { 
    6465            debugWarning("failed to add clock source control to container\n"); 
     66        } 
     67        // add a generic control for the nickname 
     68        if(!m_genericContainer->addElement(new Control::Nickname(*this))) { 
     69            debugWarning("failed to add Nickname control to container\n"); 
    6570        } 
    6671    } 
     
    152157    m_DeviceMutex.Unlock(); 
    153158    return retval; 
     159} 
     160 
     161bool 
     162FFADODevice::setNickname( std::string name) 
     163{ 
     164    return false; 
     165} 
     166 
     167std::string 
     168FFADODevice::getNickname() 
     169{ 
     170    return "Unknown"; 
    154171} 
    155172 
  • trunk/libffado/src/ffadodevice.h

    r967 r1063  
    419419 
    420420    /** 
     421     * @brief return the nick name of this device 
     422     * 
     423     * @return string containing the name 
     424     */ 
     425    virtual std::string getNickname(); 
     426 
     427    /** 
     428     * @brief set the nick name of this device 
     429     * @param name new nickname 
     430     * @return true if successful 
     431     */ 
     432    virtual bool setNickname(std::string name); 
     433 
     434    /** 
    421435     * @brief handle a bus reset 
    422436     * 
     
    425439     * 
    426440     */ 
     441    // FIXME: not virtual? 
    427442    void handleBusReset(); 
    428443 
  • trunk/libffado/src/SConscript

    r1052 r1063  
    8787        libcontrol/MatrixMixer.cpp \ 
    8888        libcontrol/ClockSelect.cpp \ 
     89        libcontrol/Nickname.cpp \ 
    8990') 
    9091