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
|
|
| 769 | 769 | m_vibratorService->setVibrateNow(false); |
| 770 | 770 | } |
| 771 | 771 | |
| 772 | | void Ficgta01ModemService::echoCancellation(QAtChat * atChat) |
| | 772 | void Ficgta01ModemService::echoCancellation(QAtChat* atChat) |
| 773 | 773 | { |
| 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 |
| 777 | 778 | } |
| 778 | 779 | |
| 779 | | Ficgta01VibrateAccessory::Ficgta01VibrateAccessory |
| | 780 | Ficgta01VibrateAccessory::Ficgta01VibrateAccessory |
| 780 | 781 | ( QModemService *service ) |
| 781 | 782 | : QVibrateAccessoryProvider( service->service(), service ) |
| 782 | 783 | { |
| … |
… |
|
| 909 | 910 | Ficgta01PreferredNetworkOperators::~Ficgta01PreferredNetworkOperators() |
| 910 | 911 | { |
| 911 | 912 | } |
| | 913 | |
| | 914 | Ficgta01ModemHiddenFeatures::Ficgta01ModemHiddenFeatures(QAtChat* atChat) : |
| | 915 | atPrefix( "AT%N" ) |
| | 916 | { |
| | 917 | m_atChat = atChat; |
| | 918 | } |
| | 919 | |
| | 920 | Ficgta01ModemHiddenFeatures::~Ficgta01ModemHiddenFeatures() |
| | 921 | { |
| | 922 | } |
| | 923 | |
| | 924 | void Ficgta01ModemHiddenFeatures::sendHiddenFeatureCommand(int code) |
| | 925 | { |
| | 926 | m_atChat->chat(atPrefix + QString::number(code, 16).toUpper().rightJustified(4, '0')); |
| | 927 | } |
| | 928 | |
| | 929 | void 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 | |
| | 941 | void 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 | |
| | 950 | void Ficgta01ModemHiddenFeatures::enableNoiseReductionAEC() |
| | 951 | { |
| | 952 | sendHiddenFeatureCommand(0x0187); |
| | 953 | } |
| | 954 | |
| | 955 | void Ficgta01ModemHiddenFeatures::disableNoiseReductionAEC() |
| | 956 | { |
| | 957 | sendHiddenFeatureCommand(0x0001); |
| | 958 | } |
| | 959 | |
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
|
|
| 168 | 168 | void setVibrateOnRing( const bool value ); |
| 169 | 169 | }; |
| 170 | 170 | |
| 171 | | |
| 172 | | |
| 173 | 171 | class Ficgta01CallVolume : public QModemCallVolume |
| 174 | 172 | { |
| 175 | 173 | Q_OBJECT |
| … |
… |
|
| 211 | 209 | void setChannels(const QList<int>& list); |
| 212 | 210 | }; |
| 213 | 211 | |
| | 212 | class Ficgta01ModemHiddenFeatures |
| | 213 | { |
| | 214 | public: |
| | 215 | Ficgta01ModemHiddenFeatures( QAtChat* ); |
| | 216 | ~Ficgta01ModemHiddenFeatures(); |
| 214 | 217 | |
| | 218 | void sendHiddenFeatureCommand( int ); |
| | 219 | void enableAEC( int, bool ); |
| | 220 | void enableNoiseReduction( int ); |
| | 221 | void enableNoiseReductionAEC(); |
| | 222 | void disableNoiseReductionAEC(); |
| | 223 | |
| | 224 | private: |
| | 225 | QAtChat * m_atChat; |
| | 226 | const QString atPrefix; |
| | 227 | }; |
| 215 | 228 | |
| 216 | 229 | |
| 217 | 230 | #endif |