From 2f9bac62044a89c18908e4d3a6332f9abb645d7a Mon Sep 17 00:00:00 2001 From: Thomas Zimmermann Date: Tue, 22 Jul 2014 13:53:28 +0200 Subject: [PATCH] Bug 1038645: Asynchronous Bluetooth Handsfree voice-recognition functions (under bluetooth2/), r=btian --- .../bluedroid/BluetoothInterface.cpp | 24 ++++++++++++++----- dom/bluetooth2/bluedroid/BluetoothInterface.h | 4 ++-- 2 files changed, 20 insertions(+), 8 deletions(-) diff --git a/dom/bluetooth2/bluedroid/BluetoothInterface.cpp b/dom/bluetooth2/bluedroid/BluetoothInterface.cpp index f18a614c6f6..33cf836ea6a 100644 --- a/dom/bluetooth2/bluedroid/BluetoothInterface.cpp +++ b/dom/bluetooth2/bluedroid/BluetoothInterface.cpp @@ -694,16 +694,28 @@ BluetoothHandsfreeInterface::DisconnectAudio( /* Voice Recognition */ -bt_status_t -BluetoothHandsfreeInterface::StartVoiceRecognition() +void +BluetoothHandsfreeInterface::StartVoiceRecognition( + BluetoothHandsfreeResultHandler* aRes) { - return mInterface->start_voice_recognition(); + bt_status_t status = mInterface->start_voice_recognition(); + + if (aRes) { + DispatchBluetoothHandsfreeResult( + aRes, &BluetoothHandsfreeResultHandler::StartVoiceRecognition, status); + } } -bt_status_t -BluetoothHandsfreeInterface::StopVoiceRecognition() +void +BluetoothHandsfreeInterface::StopVoiceRecognition( + BluetoothHandsfreeResultHandler* aRes) { - return mInterface->stop_voice_recognition(); + bt_status_t status = mInterface->stop_voice_recognition(); + + if (aRes) { + DispatchBluetoothHandsfreeResult( + aRes, &BluetoothHandsfreeResultHandler::StopVoiceRecognition, status); + } } /* Volume */ diff --git a/dom/bluetooth2/bluedroid/BluetoothInterface.h b/dom/bluetooth2/bluedroid/BluetoothInterface.h index e8f0366a755..4947b49ee16 100644 --- a/dom/bluetooth2/bluedroid/BluetoothInterface.h +++ b/dom/bluetooth2/bluedroid/BluetoothInterface.h @@ -129,8 +129,8 @@ public: /* Voice Recognition */ - bt_status_t StartVoiceRecognition(); - bt_status_t StopVoiceRecognition(); + void StartVoiceRecognition(BluetoothHandsfreeResultHandler* aRes); + void StopVoiceRecognition(BluetoothHandsfreeResultHandler* aRes); /* Volume */