Bug 1095487: Add Blueooth A2DP support when using daemon backend, r=shuang

This commit is contained in:
Thomas Zimmermann 2014-12-11 10:53:14 +01:00
parent 84cfd20bbb
commit e81f7a7fc6
2 changed files with 24 additions and 2 deletions

View File

@ -5,6 +5,7 @@
* You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "BluetoothDaemonInterface.h"
#include "BluetoothDaemonA2dpInterface.h"
#include "BluetoothDaemonHandsfreeInterface.h"
#include "BluetoothDaemonHelpers.h"
#include "BluetoothDaemonSetupInterface.h"
@ -1361,6 +1362,7 @@ class BluetoothDaemonProtocol MOZ_FINAL
, public BluetoothDaemonCoreModule
, public BluetoothDaemonSocketModule
, public BluetoothDaemonHandsfreeModule
, public BluetoothDaemonA2dpModule
{
public:
BluetoothDaemonProtocol(BluetoothDaemonConnection* aConnection);
@ -1394,6 +1396,8 @@ private:
BluetoothDaemonPDU& aPDU, void* aUserData);
void HandleHandsfreeSvc(const BluetoothDaemonPDUHeader& aHeader,
BluetoothDaemonPDU& aPDU, void* aUserData);
void HandleA2dpSvc(const BluetoothDaemonPDUHeader& aHeader,
BluetoothDaemonPDU& aPDU, void* aUserData);
BluetoothDaemonConnection* mConnection;
nsTArray<void*> mUserDataQ;
@ -1462,6 +1466,14 @@ BluetoothDaemonProtocol::HandleHandsfreeSvc(
BluetoothDaemonHandsfreeModule::HandleSvc(aHeader, aPDU, aUserData);
}
void
BluetoothDaemonProtocol::HandleA2dpSvc(
const BluetoothDaemonPDUHeader& aHeader, BluetoothDaemonPDU& aPDU,
void* aUserData)
{
BluetoothDaemonA2dpModule::HandleSvc(aHeader, aPDU, aUserData);
}
void
BluetoothDaemonProtocol::Handle(BluetoothDaemonPDU& aPDU)
{
@ -1473,7 +1485,9 @@ BluetoothDaemonProtocol::Handle(BluetoothDaemonPDU& aPDU)
INIT_ARRAY_AT(0x03, nullptr), // HID host
INIT_ARRAY_AT(0x04, nullptr), // PAN
INIT_ARRAY_AT(BluetoothDaemonHandsfreeModule::SERVICE_ID,
&BluetoothDaemonProtocol::HandleHandsfreeSvc)
&BluetoothDaemonProtocol::HandleHandsfreeSvc),
INIT_ARRAY_AT(BluetoothDaemonA2dpModule::SERVICE_ID,
&BluetoothDaemonProtocol::HandleA2dpSvc)
};
BluetoothDaemonPDUHeader header;
@ -2053,7 +2067,13 @@ BluetoothDaemonInterface::GetBluetoothHandsfreeInterface()
BluetoothA2dpInterface*
BluetoothDaemonInterface::GetBluetoothA2dpInterface()
{
return nullptr;
if (mA2dpInterface) {
return mA2dpInterface;
}
mA2dpInterface = new BluetoothDaemonA2dpInterface(mProtocol);
return mA2dpInterface;
}
BluetoothAvrcpInterface*

View File

@ -12,6 +12,7 @@
BEGIN_BLUETOOTH_NAMESPACE
class BluetoothDaemonChannel;
class BluetoothDaemonA2dpInterface;
class BluetoothDaemonHandsfreeInterface;
class BluetoothDaemonProtocol;
class BluetoothDaemonSocketInterface;
@ -127,6 +128,7 @@ private:
nsAutoPtr<BluetoothDaemonSocketInterface> mSocketInterface;
nsAutoPtr<BluetoothDaemonHandsfreeInterface> mHandsfreeInterface;
nsAutoPtr<BluetoothDaemonA2dpInterface> mA2dpInterface;
};
END_BLUETOOTH_NAMESPACE