From c9b60cd79e0ca142b4758cf4c77733d2011a3a76 Mon Sep 17 00:00:00 2001 From: Eric Chou Date: Fri, 31 May 2013 20:43:18 +0800 Subject: [PATCH] Bug 878005 - Send system message 'ATD>' to Gaia instead of sending 'BLDN' when receive 'ATD>' from headset, r=gyeh --- dom/bluetooth/BluetoothHfpManager.cpp | 28 +++++++++++++++------------ dom/bluetooth/BluetoothHfpManager.h | 2 +- 2 files changed, 17 insertions(+), 13 deletions(-) diff --git a/dom/bluetooth/BluetoothHfpManager.cpp b/dom/bluetooth/BluetoothHfpManager.cpp index bd543d81ddc..b4d02b0eeee 100644 --- a/dom/bluetooth/BluetoothHfpManager.cpp +++ b/dom/bluetooth/BluetoothHfpManager.cpp @@ -58,7 +58,7 @@ namespace { // Wait for 2 seconds for Dialer processing event 'BLDN'. '2' seconds is a // magic number. The mechanism should be revised once we can get call history. - static int sWaitingForProcessingBLDNInterval = 2000; //unit: ms + static int sWaitingForDialingInterval = 2000; //unit: ms } // anonymous namespace /* CallState for sCINDItems[CINDType::CALL].value @@ -276,8 +276,8 @@ private: { MOZ_ASSERT(gBluetoothHfpManager); - if (!gBluetoothHfpManager->mBLDNProcessed) { - gBluetoothHfpManager->mBLDNProcessed = true; + if (!gBluetoothHfpManager->mDialingRequestProcessed) { + gBluetoothHfpManager->mDialingRequestProcessed = true; gBluetoothHfpManager->SendLine("ERROR"); } } @@ -374,7 +374,7 @@ BluetoothHfpManager::Reset() mCMEE = false; mCMER = false; mReceiveVgsFlag = false; - mBLDNProcessed = true; + mDialingRequestProcessed = true; ResetCallArray(); } @@ -881,15 +881,19 @@ BluetoothHfpManager::ReceiveSocketData(BluetoothSocket* aSocket, os->NotifyObservers(nullptr, "bluetooth-volume-change", data.get()); } else if ((msg.Find("AT+BLDN") != -1) || (msg.Find("ATD>") != -1)) { // Dialer app of FFOS v1 does not have plan to support Memory Dailing. - // However, in order to pass Bluetooth HFP certification, we have to - // make a call when we receive AT command 'ATD>n'. The solution here - // is firing a 'BLDN' event to Dialer to do 'Last Number Redial'. - mBLDNProcessed = false; - NotifyDialer(NS_LITERAL_STRING("BLDN")); + // However, in order to pass Bluetooth HFP certification, we still have to + // make a call when we receive AT command 'ATD>n'. + mDialingRequestProcessed = false; + + if (msg.Find("AT+BLDN") != -1) { + NotifyDialer(NS_LITERAL_STRING("BLDN")); + } else { + NotifyDialer(NS_ConvertUTF8toUTF16(msg)); + } MessageLoop::current()-> PostDelayedTask(FROM_HERE, new RespondToBLDNTask(), - sWaitingForProcessingBLDNInterval); + sWaitingForDialingInterval); // Don't send response 'OK' here because we'll respond later in either // RespondToBLDNTask or HandleCallStateChanged() @@ -1313,9 +1317,9 @@ BluetoothHfpManager::HandleCallStateChanged(uint32_t aCallIndex, } break; case nsITelephonyProvider::CALL_STATE_DIALING: - if (!mBLDNProcessed) { + if (!mDialingRequestProcessed) { SendLine("OK"); - mBLDNProcessed = true; + mDialingRequestProcessed = true; } UpdateCIND(CINDType::CALLSETUP, CallSetupState::OUTGOING, aSend); diff --git a/dom/bluetooth/BluetoothHfpManager.h b/dom/bluetooth/BluetoothHfpManager.h index 06e5d130b09..c715a46b429 100644 --- a/dom/bluetooth/BluetoothHfpManager.h +++ b/dom/bluetooth/BluetoothHfpManager.h @@ -132,7 +132,7 @@ private: bool mFirstCKPD; int mNetworkSelectionMode; bool mReceiveVgsFlag; - bool mBLDNProcessed; + bool mDialingRequestProcessed; bool mIsHandsfree; bool mNeedsUpdatingSdpRecords; nsString mDeviceAddress;