Bug 1096194 - Responding Enhanced call control with ERROR if enhanced call control is not supported, r=btian

This commit is contained in:
Shawn Huang 2014-11-12 11:15:21 +08:00
parent a3ba9b4cb5
commit 042f661de2
2 changed files with 26 additions and 0 deletions

View File

@ -65,6 +65,12 @@ IsValidDtmf(const char aChar) {
(aChar >= 'A' && aChar <= 'D');
}
static bool
IsSupportedChld(const int aChld) {
// We currently only support CHLD=0~3.
return (aChld >= 0 && aChld <= 3);
}
class BluetoothHfpManager::GetVolumeTask : public nsISettingsServiceCallback
{
public:
@ -1420,6 +1426,13 @@ BluetoothHfpManager::CallHoldNotification(BluetoothHandsfreeCallHoldType aChld)
{
MOZ_ASSERT(NS_IsMainThread());
if (!IsSupportedChld((int)aChld)) {
// We currently don't support Enhanced Call Control.
// AT+CHLD=1x and AT+CHLD=2x will be ignored
SendResponse(HFP_AT_RESPONSE_ERROR);
return;
}
SendResponse(HFP_AT_RESPONSE_OK);
nsAutoCString message("CHLD=");

View File

@ -62,6 +62,12 @@ IsValidDtmf(const char aChar) {
(aChar >= 'A' && aChar <= 'D');
}
static bool
IsSupportedChld(const int aChld) {
// We currently only support CHLD=0~3.
return (aChld >= 0 && aChld <= 3);
}
class BluetoothHfpManager::GetVolumeTask MOZ_FINAL : public nsISettingsServiceCallback
{
public:
@ -1411,6 +1417,13 @@ BluetoothHfpManager::CallHoldNotification(BluetoothHandsfreeCallHoldType aChld)
{
MOZ_ASSERT(NS_IsMainThread());
if (!IsSupportedChld((int)aChld)) {
// We currently don't support Enhanced Call Control.
// AT+CHLD=1x and AT+CHLD=2x will be ignored
SendResponse(HFP_AT_RESPONSE_ERROR);
return;
}
SendResponse(HFP_AT_RESPONSE_OK);
nsAutoCString message("CHLD=");