Bug 880610: Part1-Add build flag to support both bluez/bluedroid stacks, r=glandium

This commit is contained in:
Shawn Huang 2013-10-23 14:12:24 +08:00
parent dbd7c7b2a0
commit 8edfdaf15d
7 changed files with 31 additions and 10 deletions

View File

@ -222,6 +222,7 @@ if test -n "$gonkdir" ; then
15)
GONK_INCLUDES="-I$gonkdir/frameworks/base/opengl/include -I$gonkdir/frameworks/base/native/include -I$gonkdir/frameworks/base/include -I$gonkdir/frameworks/base/services/camera -I$gonkdir/frameworks/base/include/media/stagefright -I$gonkdir/frameworks/base/include/media/stagefright/openmax -I$gonkdir/frameworks/base/media/libstagefright/rtsp -I$gonkdir/frameworks/base/media/libstagefright/include -I$gonkdir/external/dbus -I$gonkdir/external/bluetooth/bluez/lib -I$gonkdir/dalvik/libnativehelper/include/nativehelper"
MOZ_B2G_BT=1
MOZ_B2G_BT_BLUEZ=1
MOZ_B2G_CAMERA=1
MOZ_OMX_DECODER=1
AC_SUBST(MOZ_OMX_DECODER)
@ -230,9 +231,15 @@ if test -n "$gonkdir" ; then
17|18)
GONK_INCLUDES="-I$gonkdir/frameworks/native/include -I$gonkdir/frameworks/av/include -I$gonkdir/frameworks/av/include/media -I$gonkdir/frameworks/av/include/camera -I$gonkdir/frameworks/native/include/media/openmax -I$gonkdir/frameworks/av/media/libstagefright/include"
if test -d "$gonkdir/external/bluetooth/bluez"; then
GONK_INCLUDES+=" -I$gonkdir/external/dbus -I$gonkdir/external/bluetooth/bluez/lib"
GONK_INCLUDES="$GONK_INCLUDES -I$gonkdir/external/dbus -I$gonkdir/external/bluetooth/bluez/lib"
MOZ_B2G_BT=1
MOZ_B2G_BT_BLUEZ=1
fi
if test -d "$gonkdir/external/bluetooth/bluedroid"; then
MOZ_B2G_BT=1
MOZ_B2G_BT_BLUEDROID=1
fi
MOZ_B2G_CAMERA=1
MOZ_OMX_DECODER=1
AC_SUBST(MOZ_OMX_DECODER)
@ -7301,6 +7308,8 @@ if test -n "$MOZ_B2G_BT"; then
AC_DEFINE(MOZ_B2G_BT)
fi
AC_SUBST(MOZ_B2G_BT)
AC_SUBST(MOZ_B2G_BT_BLUEZ)
AC_SUBST(MOZ_B2G_BT_BLUEDROID)
dnl ========================================================
dnl = Enable Pico Speech Synthesis (Gonk usually)

View File

@ -44,7 +44,9 @@
#if defined(MOZ_B2G_BT)
# if defined(MOZ_BLUETOOTH_GONK)
# include "BluetoothGonkService.h"
#ifndef MOZ_B2G_BT_BLUEDROID
#include "BluetoothGonkService.h"
#endif
# elif defined(MOZ_BLUETOOTH_DBUS)
# include "BluetoothDBusService.h"
# else
@ -304,9 +306,13 @@ BluetoothService::Create()
#endif
#if defined(MOZ_BLUETOOTH_GONK)
#ifndef MOZ_B2G_BT_BLUEDROID
return new BluetoothGonkService();
#endif
#elif defined(MOZ_BLUETOOTH_DBUS)
#ifdef MOZ_B2G_BT_BLUEZ
return new BluetoothDBusService();
#endif
#endif
BT_WARNING("No platform support for bluetooth!");
return nullptr;

View File

@ -36,6 +36,14 @@ DEFINES += -DMOZ_BLUETOOTH_DBUS
endif
endif
ifdef MOZ_B2G_BT_BLUEZ
DEFINES += -DMOZ_B2G_BT_BLUEZ
endif
ifdef MOZ_B2G_BT_BLUEDROID
DEFINES += -DMOZ_B2G_BT_BLUEDROID
endif
# Add VPATH to LOCAL_INCLUDES so we are going to include the correct backend
# subdirectory.
LOCAL_INCLUDES += $(VPATH:%=-I%)

View File

@ -24,6 +24,9 @@ BEGIN_BLUETOOTH_NAMESPACE
class BluetoothDBusService : public BluetoothService
{
public:
BluetoothDBusService();
~BluetoothDBusService();
bool IsReady();
virtual nsresult StartInternal() MOZ_OVERRIDE;
@ -168,11 +171,6 @@ public:
virtual nsresult
SendInputMessage(const nsAString& aDeviceAddresses,
const nsAString& aMessage) MOZ_OVERRIDE;
protected:
BluetoothDBusService();
~BluetoothDBusService();
private:
/**
* For DBus Control method of "UpdateNotification", event id should be

View File

@ -52,7 +52,7 @@ if CONFIG['MOZ_B2G_BT']:
'BluetoothRilListener.cpp',
]
if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'gonk':
if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'gonk' and CONFIG['MOZ_B2G_BT_BLUEZ']:
CPP_SOURCES += [
'linux/BluetoothDBusService.cpp',
'gonk/BluetoothGonkService.cpp',

View File

@ -14,7 +14,7 @@ DIRS += [
if CONFIG['MOZ_B2G_RIL']:
DIRS += ['ril']
if CONFIG['MOZ_B2G_BT']:
if CONFIG['MOZ_B2G_BT_BLUEZ']:
DIRS += ['dbus']
if CONFIG['MOZ_B2G_RIL'] or CONFIG['MOZ_B2G_BT']:

View File

@ -89,7 +89,7 @@ ifdef MOZ_B2G_RIL #{
STATIC_LIBS += mozril_s
endif #}
ifdef MOZ_B2G_BT #{
ifdef MOZ_B2G_BT_BLUEZ #{
STATIC_LIBS += mozdbus_s
ifeq (gonk,$(MOZ_WIDGET_TOOLKIT))
OS_LIBS += -ldbus