Bug 948337 - create BluetoothHfpManagerBase for audio manager access

This commit is contained in:
Ben Tian 2014-01-13 13:58:43 +08:00
parent 8d36cf0bd0
commit 0e05b3a258
5 changed files with 38 additions and 22 deletions

View File

@ -0,0 +1,29 @@
/* -*- Mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; tab-width: 40 -*- */
/* vim: set ts=2 et sw=2 tw=80: */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef mozilla_dom_bluetooth_bluetoothhfpmanagerbase_h__
#define mozilla_dom_bluetooth_bluetoothhfpmanagerbase_h__
#include "BluetoothProfileManagerBase.h"
BEGIN_BLUETOOTH_NAMESPACE
class BluetoothHfpManagerBase : public BluetoothProfileManagerBase
{
public:
/**
* Returns true if Sco is connected.
*/
virtual bool IsScoConnected() = 0;
};
#define BT_DECL_HFP_MGR_BASE \
BT_DECL_PROFILE_MGR_BASE \
virtual bool IsScoConnected() MOZ_OVERRIDE;
END_BLUETOOTH_NAMESPACE
#endif //#ifndef mozilla_dom_bluetooth_bluetoothhfpmanagerbase_h__

View File

@ -11,7 +11,7 @@
#include <hardware/bt_hf.h>
#include "BluetoothCommon.h"
#include "BluetoothProfileManagerBase.h"
#include "BluetoothHfpManagerBase.h"
#include "BluetoothRilListener.h"
#include "BluetoothSocketObserver.h"
#include "mozilla/ipc/UnixSocket.h"
@ -71,13 +71,13 @@ public:
bthf_call_addrtype_t mType;
};
class BluetoothHfpManager : public BluetoothProfileManagerBase
class BluetoothHfpManager : public BluetoothHfpManagerBase
, public BatteryObserver
{
public:
NS_DECL_ISUPPORTS
NS_DECL_NSIOBSERVER
BT_DECL_PROFILE_MGR_BASE
BT_DECL_HFP_MGR_BASE
virtual void GetName(nsACString& aName)
{
aName.AssignLiteral("HFP/HSP");
@ -88,7 +88,6 @@ public:
bool ConnectSco();
bool DisconnectSco();
bool IsScoConnected();
/**
* @param aSend A boolean indicates whether we need to notify headset or not

View File

@ -8,7 +8,7 @@
#define mozilla_dom_bluetooth_bluetoothhfpmanager_h__
#include "BluetoothCommon.h"
#include "BluetoothProfileManagerBase.h"
#include "BluetoothHfpManagerBase.h"
#ifdef MOZ_B2G_RIL
#include "BluetoothRilListener.h"
#endif
@ -75,13 +75,13 @@ public:
#endif // MOZ_B2G_RIL
class BluetoothHfpManager : public BluetoothSocketObserver
, public BluetoothProfileManagerBase
, public BluetoothHfpManagerBase
, public BatteryObserver
{
public:
NS_DECL_ISUPPORTS
NS_DECL_NSIOBSERVER
BT_DECL_PROFILE_MGR_BASE
BT_DECL_HFP_MGR_BASE
virtual void GetName(nsACString& aName)
{
aName.AssignLiteral("HFP/HSP");
@ -114,7 +114,6 @@ public:
bool ConnectSco(BluetoothReplyRunnable* aRunnable = nullptr);
bool DisconnectSco();
bool ListenSco();
bool IsScoConnected();
#ifdef MOZ_B2G_RIL
/**

View File

@ -31,8 +31,7 @@
#include "base/message_loop.h"
#include "BluetoothCommon.h"
#include "BluetoothProfileManagerBase.h"
#include "BluetoothHfpManager.h"
#include "BluetoothHfpManagerBase.h"
#include "nsJSUtils.h"
#include "nsCxPusher.h"
@ -230,8 +229,8 @@ AudioManager::HandleBluetoothStatusChanged(nsISupports* aSubject,
#ifdef MOZ_B2G_BT
bool status;
if (!strcmp(aTopic, BLUETOOTH_SCO_STATUS_CHANGED_ID)) {
BluetoothHfpManager* hfp =
static_cast<BluetoothHfpManager*>(aSubject);
BluetoothHfpManagerBase* hfp =
static_cast<BluetoothHfpManagerBase*>(aSubject);
status = hfp->IsScoConnected();
} else {
BluetoothProfileManagerBase* profile =

View File

@ -100,16 +100,6 @@ if CONFIG['MOZ_NFC']:
'nfc_worker.js',
]
# include different BluetoothHfpManager.h under dom/bluetooth/
if CONFIG['MOZ_B2G_BT_BLUEZ']:
LOCAL_INCLUDES += [
'/dom/bluetooth/bluez',
]
elif CONFIG['MOZ_B2G_BT_BLUEDROID']:
LOCAL_INCLUDES += [
'/dom/bluetooth/bluedroid',
]
FAIL_ON_WARNINGS = True
include('/ipc/chromium/chromium-config.mozbuild')