2013-06-08 08:24:29 -07:00
|
|
|
/* -*- 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_bluetootha2dpmanager_h__
|
|
|
|
#define mozilla_dom_bluetooth_bluetootha2dpmanager_h__
|
|
|
|
|
|
|
|
#include "BluetoothCommon.h"
|
2013-06-08 08:26:01 -07:00
|
|
|
#include "BluetoothProfileManagerBase.h"
|
2013-06-08 08:24:29 -07:00
|
|
|
|
|
|
|
BEGIN_BLUETOOTH_NAMESPACE
|
|
|
|
|
|
|
|
enum SinkState {
|
|
|
|
SINK_DISCONNECTED = 1,
|
|
|
|
SINK_CONNECTING,
|
|
|
|
SINK_CONNECTED,
|
|
|
|
SINK_PLAYING,
|
|
|
|
SINK_DISCONNECTING
|
|
|
|
};
|
|
|
|
|
|
|
|
class BluetoothA2dpManagerObserver;
|
|
|
|
class BluetoothValue;
|
|
|
|
class BluetoothSocket;
|
|
|
|
|
2013-06-08 08:26:01 -07:00
|
|
|
class BluetoothA2dpManager : public BluetoothProfileManagerBase
|
2013-06-08 08:24:29 -07:00
|
|
|
{
|
|
|
|
public:
|
2013-06-08 08:26:01 -07:00
|
|
|
NS_DECL_ISUPPORTS
|
|
|
|
|
2013-06-08 08:24:29 -07:00
|
|
|
static BluetoothA2dpManager* Get();
|
|
|
|
~BluetoothA2dpManager();
|
|
|
|
|
|
|
|
bool Connect(const nsAString& aDeviceAddress);
|
|
|
|
void Disconnect();
|
|
|
|
void HandleSinkPropertyChanged(const BluetoothSignal& aSignal);
|
|
|
|
nsresult HandleShutdown();
|
|
|
|
|
2013-06-08 08:26:01 -07:00
|
|
|
virtual void OnGetServiceChannel(const nsAString& aDeviceAddress,
|
|
|
|
const nsAString& aServiceUuid,
|
|
|
|
int aChannel) MOZ_OVERRIDE;
|
2013-06-08 08:26:28 -07:00
|
|
|
virtual void OnUpdateSdpRecords(const nsAString& aDeviceAddress) MOZ_OVERRIDE;
|
2013-06-08 08:26:01 -07:00
|
|
|
virtual void GetAddress(nsAString& aDeviceAddress) MOZ_OVERRIDE;
|
|
|
|
|
2013-06-08 08:24:29 -07:00
|
|
|
private:
|
|
|
|
BluetoothA2dpManager();
|
|
|
|
bool Init();
|
|
|
|
void Cleanup();
|
|
|
|
|
2013-06-08 08:25:41 -07:00
|
|
|
void HandleSinkStateChanged(SinkState aState);
|
|
|
|
|
2013-06-08 08:26:01 -07:00
|
|
|
void NotifyStatusChanged();
|
|
|
|
void NotifyAudioManager();
|
|
|
|
|
2013-06-08 08:24:29 -07:00
|
|
|
bool mConnected;
|
|
|
|
bool mPlaying;
|
|
|
|
nsString mDeviceAddress;
|
|
|
|
SinkState mSinkState;
|
|
|
|
};
|
|
|
|
|
|
|
|
END_BLUETOOTH_NAMESPACE
|
|
|
|
|
|
|
|
#endif
|