зеркало из https://github.com/mozilla/gecko-dev.git
Bug 830213 - Patch 3: Remove BluetoothScoManager, r=echou
This commit is contained in:
Родитель
725f4e197f
Коммит
5c04951efe
|
@ -9,7 +9,6 @@
|
||||||
#include "BluetoothHfpManager.h"
|
#include "BluetoothHfpManager.h"
|
||||||
|
|
||||||
#include "BluetoothReplyRunnable.h"
|
#include "BluetoothReplyRunnable.h"
|
||||||
#include "BluetoothScoManager.h"
|
|
||||||
#include "BluetoothService.h"
|
#include "BluetoothService.h"
|
||||||
#include "BluetoothSocket.h"
|
#include "BluetoothSocket.h"
|
||||||
#include "BluetoothUtils.h"
|
#include "BluetoothUtils.h"
|
||||||
|
@ -334,35 +333,6 @@ private:
|
||||||
int mType;
|
int mType;
|
||||||
};
|
};
|
||||||
|
|
||||||
void
|
|
||||||
OpenScoSocket(const nsAString& aDeviceAddress)
|
|
||||||
{
|
|
||||||
MOZ_ASSERT(NS_IsMainThread());
|
|
||||||
|
|
||||||
BluetoothScoManager* sco = BluetoothScoManager::Get();
|
|
||||||
if (!sco) {
|
|
||||||
NS_WARNING("BluetoothScoManager is not available!");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!sco->Connect(aDeviceAddress)) {
|
|
||||||
NS_WARNING("Failed to create a sco socket!");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
CloseScoSocket()
|
|
||||||
{
|
|
||||||
MOZ_ASSERT(NS_IsMainThread());
|
|
||||||
|
|
||||||
BluetoothScoManager* sco = BluetoothScoManager::Get();
|
|
||||||
if (!sco) {
|
|
||||||
NS_WARNING("BluetoothScoManager is not available!");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
sco->Disconnect();
|
|
||||||
}
|
|
||||||
|
|
||||||
static bool
|
static bool
|
||||||
IsValidDtmf(const char aChar) {
|
IsValidDtmf(const char aChar) {
|
||||||
// Valid DTMF: [*#0-9ABCD]
|
// Valid DTMF: [*#0-9ABCD]
|
||||||
|
@ -940,12 +910,6 @@ BluetoothHfpManager::ReceiveSocketData(BluetoothSocket* aSocket,
|
||||||
|
|
||||||
mCCWA = atCommandValues[0].EqualsLiteral("1");
|
mCCWA = atCommandValues[0].EqualsLiteral("1");
|
||||||
} else if (msg.Find("AT+CKPD") != -1) {
|
} else if (msg.Find("AT+CKPD") != -1) {
|
||||||
BluetoothScoManager* sco = BluetoothScoManager::Get();
|
|
||||||
if (!sco) {
|
|
||||||
NS_WARNING("Couldn't get BluetoothScoManager instance");
|
|
||||||
goto respond_with_ok;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!sStopSendingRingFlag) {
|
if (!sStopSendingRingFlag) {
|
||||||
// Bluetooth HSP spec 4.2.2
|
// Bluetooth HSP spec 4.2.2
|
||||||
// There is an incoming call, notify Dialer to pick up the phone call
|
// There is an incoming call, notify Dialer to pick up the phone call
|
||||||
|
@ -953,12 +917,10 @@ BluetoothHfpManager::ReceiveSocketData(BluetoothSocket* aSocket,
|
||||||
// indicating the call is answered successfully.
|
// indicating the call is answered successfully.
|
||||||
NotifyDialer(NS_LITERAL_STRING("ATA"));
|
NotifyDialer(NS_LITERAL_STRING("ATA"));
|
||||||
} else {
|
} else {
|
||||||
if (!sco->IsConnected()) {
|
if (!IsScoConnected()) {
|
||||||
// Bluetooth HSP spec 4.3
|
// Bluetooth HSP spec 4.3
|
||||||
// If there's no SCO, set up a SCO link.
|
// If there's no SCO, set up a SCO link.
|
||||||
nsAutoString address;
|
ConnectSco();
|
||||||
mSocket->GetAddress(address);
|
|
||||||
sco->Connect(address);
|
|
||||||
} else if (!mFirstCKPD) {
|
} else if (!mFirstCKPD) {
|
||||||
// Bluetooth HSP spec 4.5
|
// Bluetooth HSP spec 4.5
|
||||||
// There are two ways to release SCO: sending CHUP to dialer or closing
|
// There are two ways to release SCO: sending CHUP to dialer or closing
|
||||||
|
@ -967,7 +929,7 @@ BluetoothHfpManager::ReceiveSocketData(BluetoothSocket* aSocket,
|
||||||
if (mCurrentCallArray.Length() > 1) {
|
if (mCurrentCallArray.Length() > 1) {
|
||||||
NotifyDialer(NS_LITERAL_STRING("CHUP"));
|
NotifyDialer(NS_LITERAL_STRING("CHUP"));
|
||||||
} else {
|
} else {
|
||||||
sco->Disconnect();
|
DisconnectSco();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// Three conditions have to be matched to come in here:
|
// Three conditions have to be matched to come in here:
|
||||||
|
@ -1300,17 +1262,14 @@ BluetoothHfpManager::HandleCallStateChanged(uint32_t aCallIndex,
|
||||||
}
|
}
|
||||||
|
|
||||||
UpdateCIND(CINDType::CALLSETUP, CallSetupState::OUTGOING, aSend);
|
UpdateCIND(CINDType::CALLSETUP, CallSetupState::OUTGOING, aSend);
|
||||||
|
ConnectSco();
|
||||||
mSocket->GetAddress(address);
|
|
||||||
OpenScoSocket(address);
|
|
||||||
break;
|
break;
|
||||||
case nsITelephonyProvider::CALL_STATE_ALERTING:
|
case nsITelephonyProvider::CALL_STATE_ALERTING:
|
||||||
UpdateCIND(CINDType::CALLSETUP, CallSetupState::OUTGOING_ALERTING, aSend);
|
UpdateCIND(CINDType::CALLSETUP, CallSetupState::OUTGOING_ALERTING, aSend);
|
||||||
|
|
||||||
// If there's an ongoing call when the headset is just connected, we have
|
// If there's an ongoing call when the headset is just connected, we have
|
||||||
// to open a sco socket here.
|
// to open a sco socket here.
|
||||||
mSocket->GetAddress(address);
|
ConnectSco();
|
||||||
OpenScoSocket(address);
|
|
||||||
break;
|
break;
|
||||||
case nsITelephonyProvider::CALL_STATE_CONNECTED:
|
case nsITelephonyProvider::CALL_STATE_CONNECTED:
|
||||||
mCurrentCallIndex = aCallIndex;
|
mCurrentCallIndex = aCallIndex;
|
||||||
|
@ -1319,9 +1278,7 @@ BluetoothHfpManager::HandleCallStateChanged(uint32_t aCallIndex,
|
||||||
case nsITelephonyProvider::CALL_STATE_DISCONNECTED:
|
case nsITelephonyProvider::CALL_STATE_DISCONNECTED:
|
||||||
// Incoming call, no break
|
// Incoming call, no break
|
||||||
sStopSendingRingFlag = true;
|
sStopSendingRingFlag = true;
|
||||||
|
ConnectSco();
|
||||||
mSocket->GetAddress(address);
|
|
||||||
OpenScoSocket(address);
|
|
||||||
case nsITelephonyProvider::CALL_STATE_ALERTING:
|
case nsITelephonyProvider::CALL_STATE_ALERTING:
|
||||||
// Outgoing call
|
// Outgoing call
|
||||||
UpdateCIND(CINDType::CALL, CallState::IN_PROGRESS, aSend);
|
UpdateCIND(CINDType::CALL, CallState::IN_PROGRESS, aSend);
|
||||||
|
@ -1391,7 +1348,7 @@ BluetoothHfpManager::HandleCallStateChanged(uint32_t aCallIndex,
|
||||||
|
|
||||||
// There is no call, close Sco and clear mCurrentCallArray
|
// There is no call, close Sco and clear mCurrentCallArray
|
||||||
if (index == callArrayLength) {
|
if (index == callArrayLength) {
|
||||||
CloseScoSocket();
|
DisconnectSco();
|
||||||
ResetCallArray();
|
ResetCallArray();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,293 +0,0 @@
|
||||||
/* -*- 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/. */
|
|
||||||
|
|
||||||
#include "base/basictypes.h"
|
|
||||||
|
|
||||||
#include "BluetoothScoManager.h"
|
|
||||||
|
|
||||||
#include "BluetoothReplyRunnable.h"
|
|
||||||
#include "BluetoothService.h"
|
|
||||||
#include "BluetoothSocket.h"
|
|
||||||
#include "BluetoothUtils.h"
|
|
||||||
|
|
||||||
#include "mozilla/Services.h"
|
|
||||||
#include "mozilla/StaticPtr.h"
|
|
||||||
#include "mozilla/dom/bluetooth/BluetoothTypes.h"
|
|
||||||
#include "nsContentUtils.h"
|
|
||||||
#include "nsIAudioManager.h"
|
|
||||||
#include "nsIObserverService.h"
|
|
||||||
|
|
||||||
#define BLUETOOTH_SCO_STATUS_CHANGED "bluetooth-sco-status-changed"
|
|
||||||
|
|
||||||
using namespace mozilla;
|
|
||||||
using namespace mozilla::ipc;
|
|
||||||
USING_BLUETOOTH_NAMESPACE
|
|
||||||
|
|
||||||
class mozilla::dom::bluetooth::BluetoothScoManagerObserver : public nsIObserver
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
NS_DECL_ISUPPORTS
|
|
||||||
NS_DECL_NSIOBSERVER
|
|
||||||
|
|
||||||
BluetoothScoManagerObserver()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
bool Init()
|
|
||||||
{
|
|
||||||
nsCOMPtr<nsIObserverService> obs = services::GetObserverService();
|
|
||||||
MOZ_ASSERT(obs);
|
|
||||||
|
|
||||||
if (NS_FAILED(obs->AddObserver(this, NS_XPCOM_SHUTDOWN_OBSERVER_ID, false))) {
|
|
||||||
NS_WARNING("Failed to add shutdown observer!");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool Shutdown()
|
|
||||||
{
|
|
||||||
nsCOMPtr<nsIObserverService> obs = services::GetObserverService();
|
|
||||||
if (!obs ||
|
|
||||||
(NS_FAILED(obs->RemoveObserver(this, NS_XPCOM_SHUTDOWN_OBSERVER_ID)))) {
|
|
||||||
NS_WARNING("Can't unregister observers!");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
~BluetoothScoManagerObserver()
|
|
||||||
{
|
|
||||||
Shutdown();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
void
|
|
||||||
BluetoothScoManager::NotifyAudioManager(const nsAString& aAddress)
|
|
||||||
{
|
|
||||||
MOZ_ASSERT(NS_IsMainThread());
|
|
||||||
|
|
||||||
nsCOMPtr<nsIObserverService> obs =
|
|
||||||
do_GetService("@mozilla.org/observer-service;1");
|
|
||||||
NS_ENSURE_TRUE_VOID(obs);
|
|
||||||
|
|
||||||
const PRUnichar* addr =
|
|
||||||
aAddress.IsEmpty() ? nullptr : aAddress.BeginReading();
|
|
||||||
|
|
||||||
if (NS_FAILED(obs->NotifyObservers(nullptr,
|
|
||||||
BLUETOOTH_SCO_STATUS_CHANGED,
|
|
||||||
addr))) {
|
|
||||||
NS_WARNING("Failed to notify bluetooth-sco-status-changed observsers!");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
NS_IMPL_ISUPPORTS1(BluetoothScoManagerObserver, nsIObserver)
|
|
||||||
|
|
||||||
namespace {
|
|
||||||
StaticAutoPtr<BluetoothScoManager> gBluetoothScoManager;
|
|
||||||
StaticRefPtr<BluetoothScoManagerObserver> sScoObserver;
|
|
||||||
bool gInShutdown = false;
|
|
||||||
} // anonymous namespace
|
|
||||||
|
|
||||||
NS_IMETHODIMP
|
|
||||||
BluetoothScoManagerObserver::Observe(nsISupports* aSubject,
|
|
||||||
const char* aTopic,
|
|
||||||
const PRUnichar* aData)
|
|
||||||
{
|
|
||||||
MOZ_ASSERT(gBluetoothScoManager);
|
|
||||||
if (!strcmp(aTopic, NS_XPCOM_SHUTDOWN_OBSERVER_ID)) {
|
|
||||||
return gBluetoothScoManager->HandleShutdown();
|
|
||||||
}
|
|
||||||
|
|
||||||
MOZ_ASSERT(false, "BluetoothScoManager got unexpected topic!");
|
|
||||||
return NS_ERROR_UNEXPECTED;
|
|
||||||
}
|
|
||||||
|
|
||||||
BluetoothScoManager::BluetoothScoManager()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
bool
|
|
||||||
BluetoothScoManager::Init()
|
|
||||||
{
|
|
||||||
mSocket = new BluetoothSocket(this,
|
|
||||||
BluetoothSocketType::SCO,
|
|
||||||
true,
|
|
||||||
false);
|
|
||||||
mPrevSocketStatus = mSocket->GetConnectionStatus();
|
|
||||||
|
|
||||||
sScoObserver = new BluetoothScoManagerObserver();
|
|
||||||
if (!sScoObserver->Init()) {
|
|
||||||
NS_WARNING("Cannot set up SCO observers!");
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
BluetoothScoManager::~BluetoothScoManager()
|
|
||||||
{
|
|
||||||
Cleanup();
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
BluetoothScoManager::Cleanup()
|
|
||||||
{
|
|
||||||
sScoObserver->Shutdown();
|
|
||||||
sScoObserver = nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
//static
|
|
||||||
BluetoothScoManager*
|
|
||||||
BluetoothScoManager::Get()
|
|
||||||
{
|
|
||||||
MOZ_ASSERT(NS_IsMainThread());
|
|
||||||
|
|
||||||
// If we already exist, exit early
|
|
||||||
if (gBluetoothScoManager) {
|
|
||||||
return gBluetoothScoManager;
|
|
||||||
}
|
|
||||||
|
|
||||||
// If we're in shutdown, don't create a new instance
|
|
||||||
if (gInShutdown) {
|
|
||||||
NS_WARNING("BluetoothScoManager can't be created during shutdown");
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Create new instance, register, return
|
|
||||||
BluetoothScoManager* manager = new BluetoothScoManager();
|
|
||||||
NS_ENSURE_TRUE(manager->Init(), nullptr);
|
|
||||||
|
|
||||||
gBluetoothScoManager = manager;
|
|
||||||
return gBluetoothScoManager;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Virtual function of class SocketConsumer
|
|
||||||
void
|
|
||||||
BluetoothScoManager::ReceiveSocketData(BluetoothSocket* aSocket,
|
|
||||||
nsAutoPtr<UnixSocketRawData>& aMessage)
|
|
||||||
{
|
|
||||||
// SCO socket do nothing here
|
|
||||||
MOZ_NOT_REACHED("This should never be called!");
|
|
||||||
}
|
|
||||||
|
|
||||||
nsresult
|
|
||||||
BluetoothScoManager::HandleShutdown()
|
|
||||||
{
|
|
||||||
MOZ_ASSERT(NS_IsMainThread());
|
|
||||||
gInShutdown = true;
|
|
||||||
mSocket->Disconnect();
|
|
||||||
gBluetoothScoManager = nullptr;
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool
|
|
||||||
BluetoothScoManager::Connect(const nsAString& aDeviceAddress)
|
|
||||||
{
|
|
||||||
MOZ_ASSERT(NS_IsMainThread());
|
|
||||||
|
|
||||||
if (gInShutdown) {
|
|
||||||
MOZ_ASSERT(false, "Connect called while in shutdown!");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
SocketConnectionStatus status = mSocket->GetConnectionStatus();
|
|
||||||
if (status == SocketConnectionStatus::SOCKET_CONNECTED ||
|
|
||||||
status == SocketConnectionStatus::SOCKET_CONNECTING) {
|
|
||||||
NS_WARNING("SCO connection exists or is being established");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
mSocket->Disconnect();
|
|
||||||
|
|
||||||
BluetoothService* bs = BluetoothService::Get();
|
|
||||||
NS_ENSURE_TRUE(bs, false);
|
|
||||||
|
|
||||||
nsresult rv = bs->GetScoSocket(aDeviceAddress,
|
|
||||||
true,
|
|
||||||
false,
|
|
||||||
mSocket);
|
|
||||||
|
|
||||||
return NS_FAILED(rv) ? false : true;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool
|
|
||||||
BluetoothScoManager::Listen()
|
|
||||||
{
|
|
||||||
MOZ_ASSERT(NS_IsMainThread());
|
|
||||||
|
|
||||||
if (gInShutdown) {
|
|
||||||
MOZ_ASSERT(false, "Listen called while in shutdown!");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (mSocket->GetConnectionStatus() ==
|
|
||||||
SocketConnectionStatus::SOCKET_LISTENING) {
|
|
||||||
NS_WARNING("BluetoothScoManager has been already listening");
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
mSocket->Disconnect();
|
|
||||||
|
|
||||||
if (!mSocket->Listen(-1)) {
|
|
||||||
NS_WARNING("[SCO] Can't listen on socket!");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
mPrevSocketStatus = mSocket->GetConnectionStatus();
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
BluetoothScoManager::Disconnect()
|
|
||||||
{
|
|
||||||
mSocket->Disconnect();
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
BluetoothScoManager::OnConnectSuccess(BluetoothSocket* aSocket)
|
|
||||||
{
|
|
||||||
MOZ_ASSERT(aSocket == mSocket);
|
|
||||||
|
|
||||||
nsString address;
|
|
||||||
mSocket->GetAddress(address);
|
|
||||||
NotifyAudioManager(address);
|
|
||||||
|
|
||||||
mPrevSocketStatus = mSocket->GetConnectionStatus();
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
BluetoothScoManager::OnConnectError(BluetoothSocket* aSocket)
|
|
||||||
{
|
|
||||||
MOZ_ASSERT(aSocket == mSocket);
|
|
||||||
|
|
||||||
mSocket->Disconnect();
|
|
||||||
mPrevSocketStatus = mSocket->GetConnectionStatus();
|
|
||||||
Listen();
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
BluetoothScoManager::OnDisconnect(BluetoothSocket* aSocket)
|
|
||||||
{
|
|
||||||
MOZ_ASSERT(aSocket == mSocket);
|
|
||||||
|
|
||||||
if (mPrevSocketStatus == SocketConnectionStatus::SOCKET_CONNECTED) {
|
|
||||||
Listen();
|
|
||||||
|
|
||||||
nsString address = NS_LITERAL_STRING("");
|
|
||||||
NotifyAudioManager(address);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
bool
|
|
||||||
BluetoothScoManager::IsConnected()
|
|
||||||
{
|
|
||||||
if (mSocket) {
|
|
||||||
return mSocket->GetConnectionStatus() ==
|
|
||||||
SocketConnectionStatus::SOCKET_CONNECTED;
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
|
@ -1,52 +0,0 @@
|
||||||
/* -*- 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"
|
|
||||||
#include "BluetoothSocketObserver.h"
|
|
||||||
#include "nsIObserver.h"
|
|
||||||
|
|
||||||
BEGIN_BLUETOOTH_NAMESPACE
|
|
||||||
|
|
||||||
class BluetoothReplyRunnable;
|
|
||||||
class BluetoothScoManagerObserver;
|
|
||||||
class BluetoothSocket;
|
|
||||||
|
|
||||||
class BluetoothScoManager : public BluetoothSocketObserver
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
static BluetoothScoManager* Get();
|
|
||||||
~BluetoothScoManager();
|
|
||||||
|
|
||||||
virtual void ReceiveSocketData(
|
|
||||||
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;
|
|
||||||
|
|
||||||
bool Connect(const nsAString& aDeviceObjectPath);
|
|
||||||
void Disconnect();
|
|
||||||
bool Listen();
|
|
||||||
bool IsConnected();
|
|
||||||
|
|
||||||
private:
|
|
||||||
friend class BluetoothScoManagerObserver;
|
|
||||||
BluetoothScoManager();
|
|
||||||
bool Init();
|
|
||||||
void Cleanup();
|
|
||||||
nsresult HandleShutdown();
|
|
||||||
void NotifyAudioManager(const nsAString& aAddress);
|
|
||||||
|
|
||||||
SocketConnectionStatus mPrevSocketStatus;
|
|
||||||
nsRefPtr<BluetoothSocket> mSocket;
|
|
||||||
};
|
|
||||||
|
|
||||||
END_BLUETOOTH_NAMESPACE
|
|
||||||
|
|
||||||
#endif
|
|
|
@ -44,7 +44,6 @@ CPPSRCS += \
|
||||||
BluetoothHfpManager.cpp \
|
BluetoothHfpManager.cpp \
|
||||||
BluetoothOppManager.cpp \
|
BluetoothOppManager.cpp \
|
||||||
ObexBase.cpp \
|
ObexBase.cpp \
|
||||||
BluetoothScoManager.cpp \
|
|
||||||
BluetoothUuid.cpp \
|
BluetoothUuid.cpp \
|
||||||
BluetoothSocket.cpp \
|
BluetoothSocket.cpp \
|
||||||
$(NULL)
|
$(NULL)
|
||||||
|
|
|
@ -21,7 +21,6 @@
|
||||||
#include "BluetoothHfpManager.h"
|
#include "BluetoothHfpManager.h"
|
||||||
#include "BluetoothOppManager.h"
|
#include "BluetoothOppManager.h"
|
||||||
#include "BluetoothReplyRunnable.h"
|
#include "BluetoothReplyRunnable.h"
|
||||||
#include "BluetoothScoManager.h"
|
|
||||||
#include "BluetoothUnixSocketConnector.h"
|
#include "BluetoothUnixSocketConnector.h"
|
||||||
#include "BluetoothUtils.h"
|
#include "BluetoothUtils.h"
|
||||||
#include "BluetoothUuid.h"
|
#include "BluetoothUuid.h"
|
||||||
|
@ -838,12 +837,6 @@ public:
|
||||||
return NS_ERROR_FAILURE;
|
return NS_ERROR_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
BluetoothScoManager* sco = BluetoothScoManager::Get();
|
|
||||||
if (!sco || !sco->Listen()) {
|
|
||||||
NS_WARNING("Failed to start listening for BluetoothScoManager!");
|
|
||||||
return NS_ERROR_FAILURE;
|
|
||||||
}
|
|
||||||
|
|
||||||
BluetoothOppManager* opp = BluetoothOppManager::Get();
|
BluetoothOppManager* opp = BluetoothOppManager::Get();
|
||||||
if (!opp || !opp->Listen()) {
|
if (!opp || !opp->Listen()) {
|
||||||
NS_WARNING("Failed to start listening for BluetoothOppManager!");
|
NS_WARNING("Failed to start listening for BluetoothOppManager!");
|
||||||
|
@ -854,31 +847,6 @@ public:
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
class ShutdownProfileManagersRunnable : public nsRunnable
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
NS_IMETHOD
|
|
||||||
Run()
|
|
||||||
{
|
|
||||||
BluetoothHfpManager* hfp = BluetoothHfpManager::Get();
|
|
||||||
if (hfp) {
|
|
||||||
hfp->Disconnect();
|
|
||||||
}
|
|
||||||
|
|
||||||
BluetoothOppManager* opp = BluetoothOppManager::Get();
|
|
||||||
if (opp) {
|
|
||||||
opp->Disconnect();
|
|
||||||
}
|
|
||||||
|
|
||||||
BluetoothScoManager* sco = BluetoothScoManager::Get();
|
|
||||||
if (sco) {
|
|
||||||
sco->Disconnect();
|
|
||||||
}
|
|
||||||
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
class PrepareAdapterRunnable : public nsRunnable
|
class PrepareAdapterRunnable : public nsRunnable
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
Загрузка…
Ссылка в новой задаче