Bug 1163499 - Part 5: Support GATT profile when using Bluetooth daemon. r=tzimmermann

This commit is contained in:
Jocelyn Liu 2015-05-27 00:05:00 -04:00
parent 72f11918ec
commit e55bd11620
2 changed files with 24 additions and 2 deletions

View File

@ -11,6 +11,7 @@
#include "BluetoothDaemonA2dpInterface.h"
#include "BluetoothDaemonAvrcpInterface.h"
#include "BluetoothDaemonConnector.h"
#include "BluetoothDaemonGattInterface.h"
#include "BluetoothDaemonHandsfreeInterface.h"
#include "BluetoothDaemonHelpers.h"
#include "BluetoothDaemonSetupInterface.h"
@ -1433,6 +1434,7 @@ class BluetoothDaemonProtocol final
, public BluetoothDaemonHandsfreeModule
, public BluetoothDaemonA2dpModule
, public BluetoothDaemonAvrcpModule
, public BluetoothDaemonGattModule
{
public:
BluetoothDaemonProtocol();
@ -1472,6 +1474,8 @@ private:
BluetoothDaemonPDU& aPDU, void* aUserData);
void HandleAvrcpSvc(const BluetoothDaemonPDUHeader& aHeader,
BluetoothDaemonPDU& aPDU, void* aUserData);
void HandleGattSvc(const BluetoothDaemonPDUHeader& aHeader,
BluetoothDaemonPDU& aPDU, void* aUserData);
BluetoothDaemonConnection* mConnection;
nsTArray<void*> mUserDataQ;
@ -1570,6 +1574,14 @@ BluetoothDaemonProtocol::HandleAvrcpSvc(
BluetoothDaemonAvrcpModule::HandleSvc(aHeader, aPDU, aUserData);
}
void
BluetoothDaemonProtocol::HandleGattSvc(
const BluetoothDaemonPDUHeader& aHeader, BluetoothDaemonPDU& aPDU,
void* aUserData)
{
BluetoothDaemonGattModule::HandleSvc(aHeader, aPDU, aUserData);
}
void
BluetoothDaemonProtocol::Handle(BluetoothDaemonPDU& aPDU)
{
@ -1586,7 +1598,9 @@ BluetoothDaemonProtocol::Handle(BluetoothDaemonPDU& aPDU)
&BluetoothDaemonProtocol::HandleA2dpSvc),
INIT_ARRAY_AT(0x07, nullptr), // Health
INIT_ARRAY_AT(BluetoothDaemonAvrcpModule::SERVICE_ID,
&BluetoothDaemonProtocol::HandleAvrcpSvc)
&BluetoothDaemonProtocol::HandleAvrcpSvc),
INIT_ARRAY_AT(BluetoothDaemonGattModule::SERVICE_ID,
&BluetoothDaemonProtocol::HandleGattSvc)
};
BluetoothDaemonPDUHeader header;
@ -2298,7 +2312,13 @@ BluetoothDaemonInterface::GetBluetoothAvrcpInterface()
BluetoothGattInterface*
BluetoothDaemonInterface::GetBluetoothGattInterface()
{
return nullptr;
if (mGattInterface) {
return mGattInterface;
}
mGattInterface = new BluetoothDaemonGattInterface(mProtocol);
return mGattInterface;
}
// |BluetoothDaemonConnectionConsumer|, |ListenSocketConsumer|

View File

@ -24,6 +24,7 @@ BEGIN_BLUETOOTH_NAMESPACE
class BluetoothDaemonA2dpInterface;
class BluetoothDaemonAvrcpInterface;
class BluetoothDaemonGattInterface;
class BluetoothDaemonHandsfreeInterface;
class BluetoothDaemonProtocol;
class BluetoothDaemonSocketInterface;
@ -165,6 +166,7 @@ private:
nsAutoPtr<BluetoothDaemonHandsfreeInterface> mHandsfreeInterface;
nsAutoPtr<BluetoothDaemonA2dpInterface> mA2dpInterface;
nsAutoPtr<BluetoothDaemonAvrcpInterface> mAvrcpInterface;
nsAutoPtr<BluetoothDaemonGattInterface> mGattInterface;
};
END_BLUETOOTH_NAMESPACE