Bug 1073548: Add support for Bluetooth daemon backend, r=shawnjohnjr

This commit is contained in:
Thomas Zimmermann 2014-11-03 13:03:49 +01:00
parent bc0c254790
commit b9ed87eae9
2 changed files with 20 additions and 4 deletions

View File

@ -8,6 +8,9 @@
#ifdef MOZ_B2G_BT_BLUEDROID #ifdef MOZ_B2G_BT_BLUEDROID
#include "BluetoothHALInterface.h" #include "BluetoothHALInterface.h"
#endif #endif
#ifdef MOZ_B2G_BT_DAEMON
#include "BluetoothDaemonInterface.h"
#endif
BEGIN_BLUETOOTH_NAMESPACE BEGIN_BLUETOOTH_NAMESPACE
@ -89,15 +92,19 @@ BluetoothInterface*
BluetoothInterface::GetInstance() BluetoothInterface::GetInstance()
{ {
/* Here's where we decide which implementation to use. Currently /* Here's where we decide which implementation to use. Currently
* there is only Bluedroid, but others are possible. Having multiple * there is only Bluedroid and the Bluetooth daemon, but others are
* interfaces built-in and selecting the correct one at runtime could * possible. Having multiple interfaces built-in and selecting the
* also be an option. * correct one at runtime could also be an option.
*/ */
#ifdef MOZ_B2G_BT_BLUEDROID #ifdef MOZ_B2G_BT_BLUEDROID
return BluetoothHALInterface::GetInstance(); return BluetoothHALInterface::GetInstance();
#else
#ifdef MOZ_B2G_BT_DAEMON
return BluetoothDaemonInterface::GetInstance();
#else #else
return nullptr; return nullptr;
#endif #endif
#endif
} }
BluetoothInterface::BluetoothInterface() BluetoothInterface::BluetoothInterface()

View File

@ -53,6 +53,13 @@
/** /**
* B2G bluedroid: * B2G bluedroid:
* MOZ_B2G_BT and MOZ_B2G_BT_BLUEDROID are both defined; * MOZ_B2G_BT and MOZ_B2G_BT_BLUEDROID are both defined;
* MOZ_B2G_BLUEZ or MOZ_B2G_DAEMON are not defined.
*/
#include "BluetoothServiceBluedroid.h"
#elif defined(MOZ_B2G_BT_DAEMON)
/**
* B2G Bluetooth daemon:
* MOZ_B2G_BT, MOZ_B2G_BLUEDROID and MOZ_B2G_BT_DAEMON are defined;
* MOZ_B2G_BLUEZ is not defined. * MOZ_B2G_BLUEZ is not defined.
*/ */
#include "BluetoothServiceBluedroid.h" #include "BluetoothServiceBluedroid.h"
@ -249,6 +256,8 @@ BluetoothService::Create()
return new BluetoothDBusService(); return new BluetoothDBusService();
#elif defined(MOZ_B2G_BT_BLUEDROID) #elif defined(MOZ_B2G_BT_BLUEDROID)
return new BluetoothServiceBluedroid(); return new BluetoothServiceBluedroid();
#elif defined(MOZ_B2G_BT_DAEMON)
return new BluetoothServiceBluedroid();
#endif #endif
#elif defined(MOZ_BLUETOOTH_DBUS) #elif defined(MOZ_BLUETOOTH_DBUS)
return new BluetoothDBusService(); return new BluetoothDBusService();
@ -582,7 +591,7 @@ BluetoothService::HandleSettingsChanged(nsISupports* aSubject)
MOZ_ASSERT(false, "Expecting a boolean for 'bluetooth.debugging.enabled'!"); MOZ_ASSERT(false, "Expecting a boolean for 'bluetooth.debugging.enabled'!");
return NS_ERROR_UNEXPECTED; return NS_ERROR_UNEXPECTED;
} }
SWITCH_BT_DEBUG(setting.mValue.toBoolean()); SWITCH_BT_DEBUG(setting.mValue.toBoolean());
return NS_OK; return NS_OK;