Bug 878005 - Send system message 'ATD>' to Gaia instead of sending 'BLDN' when receive 'ATD>' from headset, r=gyeh

This commit is contained in:
Eric Chou 2013-05-31 20:43:18 +08:00
parent 0b00c94948
commit c9b60cd79e
2 changed files with 17 additions and 13 deletions

View File

@ -58,7 +58,7 @@ namespace {
// Wait for 2 seconds for Dialer processing event 'BLDN'. '2' seconds is a // 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. // 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 } // anonymous namespace
/* CallState for sCINDItems[CINDType::CALL].value /* CallState for sCINDItems[CINDType::CALL].value
@ -276,8 +276,8 @@ private:
{ {
MOZ_ASSERT(gBluetoothHfpManager); MOZ_ASSERT(gBluetoothHfpManager);
if (!gBluetoothHfpManager->mBLDNProcessed) { if (!gBluetoothHfpManager->mDialingRequestProcessed) {
gBluetoothHfpManager->mBLDNProcessed = true; gBluetoothHfpManager->mDialingRequestProcessed = true;
gBluetoothHfpManager->SendLine("ERROR"); gBluetoothHfpManager->SendLine("ERROR");
} }
} }
@ -374,7 +374,7 @@ BluetoothHfpManager::Reset()
mCMEE = false; mCMEE = false;
mCMER = false; mCMER = false;
mReceiveVgsFlag = false; mReceiveVgsFlag = false;
mBLDNProcessed = true; mDialingRequestProcessed = true;
ResetCallArray(); ResetCallArray();
} }
@ -881,15 +881,19 @@ BluetoothHfpManager::ReceiveSocketData(BluetoothSocket* aSocket,
os->NotifyObservers(nullptr, "bluetooth-volume-change", data.get()); os->NotifyObservers(nullptr, "bluetooth-volume-change", data.get());
} else if ((msg.Find("AT+BLDN") != -1) || (msg.Find("ATD>") != -1)) { } else if ((msg.Find("AT+BLDN") != -1) || (msg.Find("ATD>") != -1)) {
// Dialer app of FFOS v1 does not have plan to support Memory Dailing. // Dialer app of FFOS v1 does not have plan to support Memory Dailing.
// However, in order to pass Bluetooth HFP certification, we have to // However, in order to pass Bluetooth HFP certification, we still have to
// make a call when we receive AT command 'ATD>n'. The solution here // make a call when we receive AT command 'ATD>n'.
// is firing a 'BLDN' event to Dialer to do 'Last Number Redial'. mDialingRequestProcessed = false;
mBLDNProcessed = false;
NotifyDialer(NS_LITERAL_STRING("BLDN")); if (msg.Find("AT+BLDN") != -1) {
NotifyDialer(NS_LITERAL_STRING("BLDN"));
} else {
NotifyDialer(NS_ConvertUTF8toUTF16(msg));
}
MessageLoop::current()-> MessageLoop::current()->
PostDelayedTask(FROM_HERE, new RespondToBLDNTask(), PostDelayedTask(FROM_HERE, new RespondToBLDNTask(),
sWaitingForProcessingBLDNInterval); sWaitingForDialingInterval);
// Don't send response 'OK' here because we'll respond later in either // Don't send response 'OK' here because we'll respond later in either
// RespondToBLDNTask or HandleCallStateChanged() // RespondToBLDNTask or HandleCallStateChanged()
@ -1313,9 +1317,9 @@ BluetoothHfpManager::HandleCallStateChanged(uint32_t aCallIndex,
} }
break; break;
case nsITelephonyProvider::CALL_STATE_DIALING: case nsITelephonyProvider::CALL_STATE_DIALING:
if (!mBLDNProcessed) { if (!mDialingRequestProcessed) {
SendLine("OK"); SendLine("OK");
mBLDNProcessed = true; mDialingRequestProcessed = true;
} }
UpdateCIND(CINDType::CALLSETUP, CallSetupState::OUTGOING, aSend); UpdateCIND(CINDType::CALLSETUP, CallSetupState::OUTGOING, aSend);

View File

@ -132,7 +132,7 @@ private:
bool mFirstCKPD; bool mFirstCKPD;
int mNetworkSelectionMode; int mNetworkSelectionMode;
bool mReceiveVgsFlag; bool mReceiveVgsFlag;
bool mBLDNProcessed; bool mDialingRequestProcessed;
bool mIsHandsfree; bool mIsHandsfree;
bool mNeedsUpdatingSdpRecords; bool mNeedsUpdatingSdpRecords;
nsString mDeviceAddress; nsString mDeviceAddress;