From bbe30c24ff1922bdf4f0f31d64524c09f878d298 Mon Sep 17 00:00:00 2001 From: Gina Yeh Date: Mon, 17 Dec 2012 17:51:38 +0800 Subject: [PATCH] Bug 820103 - Patch 1: bluetooth Hfp memory dialing and Hfp supplied number not supported, r=echou --- dom/bluetooth/BluetoothHfpManager.cpp | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/dom/bluetooth/BluetoothHfpManager.cpp b/dom/bluetooth/BluetoothHfpManager.cpp index 595b17007c99..7add829c497f 100644 --- a/dom/bluetooth/BluetoothHfpManager.cpp +++ b/dom/bluetooth/BluetoothHfpManager.cpp @@ -393,13 +393,14 @@ BluetoothHfpManager::NotifySettings() void BluetoothHfpManager::NotifyDialer(const nsAString& aCommand) { - nsString type, name, command; - command = aCommand; + nsString type, name; + BluetoothValue v; InfallibleTArray parameters; type.AssignLiteral("bluetooth-dialer-command"); - BluetoothValue v(command); - parameters.AppendElement(BluetoothNamedValue(type, v)); + name.AssignLiteral("command"); + v = nsString(aCommand); + parameters.AppendElement(BluetoothNamedValue(name, v)); if (!BroadcastSystemMessage(type, parameters)) { NS_WARNING("Failed to broadcast system message to dialer"); @@ -601,6 +602,21 @@ BluetoothHfpManager::ReceiveSocketData(UnixSocketRawData* aMessage) } else if (!strncmp(msg, "AT+CHUP", 7)) { NotifyDialer(NS_LITERAL_STRING("CHUP")); SendLine("OK"); + } else if (!strncmp(msg, "ATD>", 4)) { + // Currently, we don't support memory dialing in Dialer app + SendLine("ERROR"); + } else if (!strncmp(msg, "ATD", 3)) { + nsAutoCString message(msg), newMsg; + int end = message.FindChar(';'); + if (end < 0) { + NS_WARNING("Could't get the value of command [ATD]"); + SendLine("OK"); + return; + } + + newMsg += nsDependentCSubstring(message, 0, end); + NotifyDialer(NS_ConvertUTF8toUTF16(newMsg)); + SendLine("OK"); } else if (!strncmp(msg, "AT+CKPD", 7)) { // For Headset switch (currentCallState) {