mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-20 00:35:44 +00:00
Bug 1056539: Use Bluetooth Handsfree notifications (under bluetooth2/), r=btian
This patch replaces Handsfree callbacks by notifications. One important change is that the first call to |BluetoothHandsfreeManager::Get| now happens during initialization. Hence the Handsfree manager is now setup immediately, instead of later at use.
This commit is contained in:
parent
7a32c354b9
commit
519eae713e
@ -2300,7 +2300,7 @@ struct BluetoothHandsfreeCallback
|
||||
}
|
||||
|
||||
static void
|
||||
KeyPressedCallback()
|
||||
KeyPressed()
|
||||
{
|
||||
KeyPressedNotification::Dispatch(
|
||||
&BluetoothHandsfreeNotificationHandler::KeyPressedNotification);
|
||||
@ -2321,10 +2321,33 @@ BluetoothHandsfreeInterface::~BluetoothHandsfreeInterface()
|
||||
{ }
|
||||
|
||||
void
|
||||
BluetoothHandsfreeInterface::Init(bthf_callbacks_t* aCallbacks,
|
||||
BluetoothHandsfreeResultHandler* aRes)
|
||||
BluetoothHandsfreeInterface::Init(
|
||||
BluetoothHandsfreeNotificationHandler* aNotificationHandler,
|
||||
BluetoothHandsfreeResultHandler* aRes)
|
||||
{
|
||||
bt_status_t status = mInterface->init(aCallbacks);
|
||||
static bthf_callbacks_t sCallbacks = {
|
||||
.size = sizeof(sCallbacks),
|
||||
.connection_state_cb = BluetoothHandsfreeCallback::ConnectionState,
|
||||
.audio_state_cb = BluetoothHandsfreeCallback::AudioState,
|
||||
.vr_cmd_cb = BluetoothHandsfreeCallback::VoiceRecognition,
|
||||
.answer_call_cmd_cb = BluetoothHandsfreeCallback::AnswerCall,
|
||||
.hangup_call_cmd_cb = BluetoothHandsfreeCallback::HangupCall,
|
||||
.volume_cmd_cb = BluetoothHandsfreeCallback::Volume,
|
||||
.dial_call_cmd_cb = BluetoothHandsfreeCallback::DialCall,
|
||||
.dtmf_cmd_cb = BluetoothHandsfreeCallback::Dtmf,
|
||||
.nrec_cmd_cb = BluetoothHandsfreeCallback::NoiseReductionEchoCancellation,
|
||||
.chld_cmd_cb = BluetoothHandsfreeCallback::CallHold,
|
||||
.cnum_cmd_cb = BluetoothHandsfreeCallback::Cnum,
|
||||
.cind_cmd_cb = BluetoothHandsfreeCallback::Cind,
|
||||
.cops_cmd_cb = BluetoothHandsfreeCallback::Cops,
|
||||
.clcc_cmd_cb = BluetoothHandsfreeCallback::Clcc,
|
||||
.unknown_at_cmd_cb = BluetoothHandsfreeCallback::UnknownAt,
|
||||
.key_pressed_cmd_cb = BluetoothHandsfreeCallback::KeyPressed
|
||||
};
|
||||
|
||||
sHandsfreeNotificationHandler = aNotificationHandler;
|
||||
|
||||
bt_status_t status = mInterface->init(&sCallbacks);
|
||||
|
||||
if (aRes) {
|
||||
DispatchBluetoothHandsfreeResult(aRes,
|
||||
|
@ -193,7 +193,7 @@ class BluetoothHandsfreeInterface
|
||||
public:
|
||||
friend class BluetoothInterface;
|
||||
|
||||
void Init(bthf_callbacks_t* aCallbacks,
|
||||
void Init(BluetoothHandsfreeNotificationHandler* aNotificationHandler,
|
||||
BluetoothHandsfreeResultHandler* aRes);
|
||||
void Cleanup(BluetoothHandsfreeResultHandler* aRes);
|
||||
|
||||
|
@ -469,7 +469,9 @@ public:
|
||||
|
||||
void RunInit()
|
||||
{
|
||||
mInterface->Init(&sBluetoothHfpCallbacks, this);
|
||||
BluetoothHfpManager* hfpManager = BluetoothHfpManager::Get();
|
||||
|
||||
mInterface->Init(hfpManager, this);
|
||||
}
|
||||
|
||||
private:
|
||||
|
Loading…
Reference in New Issue
Block a user