2012-09-29 02:39:05 -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_bluetoothscomanager_h__
|
|
|
|
#define mozilla_dom_bluetooth_bluetoothscomanager_h__
|
|
|
|
|
|
|
|
#include "BluetoothCommon.h"
|
2013-04-04 17:54:43 -07:00
|
|
|
#include "BluetoothSocketObserver.h"
|
2012-10-02 20:27:36 -07:00
|
|
|
#include "nsIObserver.h"
|
2012-09-29 02:39:05 -07:00
|
|
|
|
|
|
|
BEGIN_BLUETOOTH_NAMESPACE
|
|
|
|
|
|
|
|
class BluetoothReplyRunnable;
|
2012-10-05 17:11:24 -07:00
|
|
|
class BluetoothScoManagerObserver;
|
2013-04-04 17:54:43 -07:00
|
|
|
class BluetoothSocket;
|
2012-09-29 02:39:05 -07:00
|
|
|
|
2013-04-04 17:54:43 -07:00
|
|
|
class BluetoothScoManager : public BluetoothSocketObserver
|
2012-09-29 02:39:05 -07:00
|
|
|
{
|
|
|
|
public:
|
2013-04-04 17:54:43 -07:00
|
|
|
static BluetoothScoManager* Get();
|
2012-09-29 02:39:05 -07:00
|
|
|
~BluetoothScoManager();
|
|
|
|
|
2013-04-04 17:54:43 -07:00
|
|
|
virtual void ReceiveSocketData(
|
2013-04-04 17:55:55 -07:00
|
|
|
BluetoothSocket* aSocket,
|
|
|
|
nsAutoPtr<mozilla::ipc::UnixSocketRawData>& aMessage) MOZ_OVERRIDE;
|
|
|
|
virtual void OnConnectSuccess(BluetoothSocket* aSocket) MOZ_OVERRIDE;
|
|
|
|
virtual void OnConnectError(BluetoothSocket* aSocket) MOZ_OVERRIDE;
|
|
|
|
virtual void OnDisconnect(BluetoothSocket* aSocket) MOZ_OVERRIDE;
|
2012-09-29 02:39:05 -07:00
|
|
|
|
|
|
|
bool Connect(const nsAString& aDeviceObjectPath);
|
|
|
|
void Disconnect();
|
2012-10-26 02:48:47 -07:00
|
|
|
bool Listen();
|
2013-04-19 02:08:06 -07:00
|
|
|
bool IsConnected();
|
2012-09-29 02:39:05 -07:00
|
|
|
|
|
|
|
private:
|
2012-10-05 17:11:24 -07:00
|
|
|
friend class BluetoothScoManagerObserver;
|
2012-09-29 02:39:05 -07:00
|
|
|
BluetoothScoManager();
|
2012-10-02 20:27:36 -07:00
|
|
|
bool Init();
|
|
|
|
void Cleanup();
|
|
|
|
nsresult HandleShutdown();
|
2012-10-22 03:34:15 -07:00
|
|
|
void NotifyAudioManager(const nsAString& aAddress);
|
2012-10-26 02:48:47 -07:00
|
|
|
|
2013-04-04 17:56:16 -07:00
|
|
|
SocketConnectionStatus mPrevSocketStatus;
|
2013-04-04 17:54:43 -07:00
|
|
|
nsRefPtr<BluetoothSocket> mSocket;
|
2012-09-29 02:39:05 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
END_BLUETOOTH_NAMESPACE
|
|
|
|
|
|
|
|
#endif
|