From 062da8f9221aa88cb7fc5c647f208543163571e6 Mon Sep 17 00:00:00 2001 From: Gina Yeh Date: Fri, 5 Oct 2012 18:48:05 +0800 Subject: [PATCH] Bug 797810 - Patch 1: Support command "AT+CKPD=200" in BluetoothHfpManager, r=qdot --- dom/bluetooth/BluetoothHfpManager.cpp | 30 +++++++++++++++++++++++++-- 1 file changed, 28 insertions(+), 2 deletions(-) diff --git a/dom/bluetooth/BluetoothHfpManager.cpp b/dom/bluetooth/BluetoothHfpManager.cpp index eb0ed4e2587..3b98b2f4ff4 100644 --- a/dom/bluetooth/BluetoothHfpManager.cpp +++ b/dom/bluetooth/BluetoothHfpManager.cpp @@ -434,6 +434,27 @@ BluetoothHfpManager::ReceiveSocketData(UnixSocketRawData* aMessage) } else if (!strncmp(msg, "AT+CHUP", 7)) { NotifyDialer(NS_LITERAL_STRING("CHUP")); SendLine("OK"); + } else if (!strncmp(msg, "AT+CKPD", 7)) { + // For Headset + switch (mCurrentCallState) { + case nsIRadioInterfaceLayer::CALL_STATE_INCOMING: + NotifyDialer(NS_LITERAL_STRING("ATA")); + break; + case nsIRadioInterfaceLayer::CALL_STATE_CONNECTED: + case nsIRadioInterfaceLayer::CALL_STATE_DIALING: + case nsIRadioInterfaceLayer::CALL_STATE_ALERTING: + NotifyDialer(NS_LITERAL_STRING("CHUP")); + break; + case nsIRadioInterfaceLayer::CALL_STATE_DISCONNECTED: + NotifyDialer(NS_LITERAL_STRING("BLDN")); + break; + default: +#ifdef DEBUG + NS_WARNING("Not handling state changed"); +#endif + break; + } + SendLine("OK"); } else { #ifdef DEBUG nsCString warningMsg; @@ -447,6 +468,7 @@ BluetoothHfpManager::ReceiveSocketData(UnixSocketRawData* aMessage) bool BluetoothHfpManager::Connect(const nsAString& aDeviceObjectPath, + const bool aIsHandsfree, BluetoothReplyRunnable* aRunnable) { MOZ_ASSERT(NS_IsMainThread()); @@ -463,8 +485,12 @@ BluetoothHfpManager::Connect(const nsAString& aDeviceObjectPath, } mDevicePath = aDeviceObjectPath; - nsString serviceUuidStr = - NS_ConvertUTF8toUTF16(mozilla::dom::bluetooth::BluetoothServiceUuidStr::Handsfree); + nsString serviceUuidStr; + if (aIsHandsfree) { + serviceUuidStr = NS_ConvertUTF8toUTF16(mozilla::dom::bluetooth::BluetoothServiceUuidStr::Handsfree); + } else { + serviceUuidStr = NS_ConvertUTF8toUTF16(mozilla::dom::bluetooth::BluetoothServiceUuidStr::Headset); + } nsRefPtr runnable = aRunnable;