Ticket #1267: qtopia-use-Ficgta01ModemHiddenFeatures-class-for-echo-suppression.patch

File qtopia-use-Ficgta01ModemHiddenFeatures-class-for-echo-suppression.patch, 4.3 KB (added by Treviño, 17 months ago)

Ficgta01ModemHiddenFeatures class for echo suppression

  • devices/ficgta01/src/plugins/phonevendors/ficgta01/vendor_ficgta01.cpp

    From 33de7fc81a0322d06ad33238d1d9d9ed763204c4 Mon Sep 17 00:00:00 2001
    From: =?utf-8?q?Marco=20Trevisan=20(Trevi=C3=B1o)?= <mail@3v1n0.net>
    Date: Wed, 15 Oct 2008 06:33:56 +0200
    Subject: [PATCH] Add Ficgta01ModemHiddenFeatures class
     I've reworked the enable-echo-suppression-on-dialing-and-accepting.patch
     creating a new class that allow to set all the known hidden modem at commands.
     All this is based on the informations released in the hardware mailing list:
      - http://lists.openmoko.org/pipermail/hardware/2008-August/000451.html
    
    ---
     .../phonevendors/ficgta01/vendor_ficgta01.cpp      |   58 ++++++++++++++++++--
     .../phonevendors/ficgta01/vendor_ficgta01_p.h      |   17 +++++-
     2 files changed, 68 insertions(+), 7 deletions(-)
    
    diff --git a/devices/ficgta01/src/plugins/phonevendors/ficgta01/vendor_ficgta01.cpp b/devices/ficgta01/src/plugins/phonevendors/ficgta01/vendor_ficgta01.cpp
    index afd5d37..4847634 100644
    a b  
    769769        m_vibratorService->setVibrateNow(false); 
    770770} 
    771771 
    772 void Ficgta01ModemService::echoCancellation(QAtChat * atChat) 
     772void Ficgta01ModemService::echoCancellation(QAtChat* atChat) 
    773773{ 
    774         atChat->chat( "AT@ST=\"-26\"" ); // audio side tone: set to minimum 
    775         atChat->chat( "AT%N028B" ); // Long Echo Cancellation: active, -6db 
    776         atChat->chat( "AT%N0125" ); // Noise reduction: active, -6db 
     774    Ficgta01ModemHiddenFeatures* hs = new Ficgta01ModemHiddenFeatures(atChat); 
     775    atChat->chat( "AT@ST=\"-26\"" );  // audio side tone: set to minimum 
     776    hs->enableAEC( -6, true );        // Long Echo Cancellation: active, -6db 
     777    hs->enableNoiseReduction( -6 );   // Noise reduction: active, -6db 
    777778} 
    778779 
    779  Ficgta01VibrateAccessory::Ficgta01VibrateAccessory 
     780Ficgta01VibrateAccessory::Ficgta01VibrateAccessory 
    780781        ( QModemService *service ) 
    781782    : QVibrateAccessoryProvider( service->service(), service ) 
    782783{ 
     
    909910Ficgta01PreferredNetworkOperators::~Ficgta01PreferredNetworkOperators() 
    910911{ 
    911912} 
     913 
     914Ficgta01ModemHiddenFeatures::Ficgta01ModemHiddenFeatures(QAtChat* atChat) : 
     915    atPrefix( "AT%N" ) 
     916{ 
     917    m_atChat = atChat; 
     918} 
     919 
     920Ficgta01ModemHiddenFeatures::~Ficgta01ModemHiddenFeatures() 
     921{ 
     922} 
     923 
     924void Ficgta01ModemHiddenFeatures::sendHiddenFeatureCommand(int code) 
     925{ 
     926    m_atChat->chat(atPrefix + QString::number(code, 16).toUpper().rightJustified(4, '0')); 
     927} 
     928 
     929void Ficgta01ModemHiddenFeatures::enableAEC(int type, bool longAEC = true) 
     930{ 
     931    if (type <= 0 && type >= -18 && (-type) % 6 == 0) { 
     932        int code = 0x0083 + (((-type) / 6) * 0x8); 
     933         
     934        if (longAEC) 
     935            code += 0x0200; 
     936             
     937         sendHiddenFeatureCommand(code); 
     938    } 
     939} 
     940 
     941void Ficgta01ModemHiddenFeatures::enableNoiseReduction(int type) 
     942{ 
     943    if (type <= 0 && type >= -18 && (-type) % 6 == 0) { 
     944        int code = 0x0105 + (((-type) / 6) * 0x20); 
     945             
     946        sendHiddenFeatureCommand(code); 
     947    } 
     948} 
     949 
     950void Ficgta01ModemHiddenFeatures::enableNoiseReductionAEC() 
     951{ 
     952    sendHiddenFeatureCommand(0x0187); 
     953} 
     954 
     955void Ficgta01ModemHiddenFeatures::disableNoiseReductionAEC() 
     956{ 
     957    sendHiddenFeatureCommand(0x0001); 
     958} 
     959 
  • devices/ficgta01/src/plugins/phonevendors/ficgta01/vendor_ficgta01_p.h

    diff --git a/devices/ficgta01/src/plugins/phonevendors/ficgta01/vendor_ficgta01_p.h b/devices/ficgta01/src/plugins/phonevendors/ficgta01/vendor_ficgta01_p.h
    index b5cc651..92e5aae 100644
    a b  
    168168    void setVibrateOnRing( const bool value ); 
    169169}; 
    170170 
    171  
    172  
    173171class Ficgta01CallVolume : public QModemCallVolume 
    174172{ 
    175173      Q_OBJECT 
     
    211209    void setChannels(const QList<int>& list); 
    212210}; 
    213211 
     212class Ficgta01ModemHiddenFeatures 
     213{ 
     214public: 
     215    Ficgta01ModemHiddenFeatures( QAtChat* ); 
     216    ~Ficgta01ModemHiddenFeatures(); 
    214217 
     218    void sendHiddenFeatureCommand( int ); 
     219    void enableAEC( int, bool ); 
     220    void enableNoiseReduction( int ); 
     221    void enableNoiseReductionAEC(); 
     222    void disableNoiseReductionAEC(); 
     223 
     224private: 
     225    QAtChat * m_atChat; 
     226    const QString atPrefix; 
     227}; 
    215228 
    216229 
    217230#endif