Bug 851046: Patch 9 - Small misc fixes; r=mrbkap

This commit is contained in:
Eric Chou 2013-04-04 17:56:16 -07:00
parent 2d0a7c72d4
commit 1b7aa14ffc
6 changed files with 20 additions and 22 deletions

View File

@ -397,7 +397,7 @@ BluetoothHfpManager::Init()
BluetoothSocketType::RFCOMM,
true,
true);
mSocketStatus = mSocket->GetConnectionStatus();
mPrevSocketStatus = mSocket->GetConnectionStatus();
sHfpObserver = new BluetoothHfpManagerObserver();
if (!sHfpObserver->Init()) {
@ -461,7 +461,6 @@ BluetoothHfpManager::Get()
// Create new instance, register, return
BluetoothHfpManager* manager = new BluetoothHfpManager();
NS_ENSURE_TRUE(manager, nullptr);
NS_ENSURE_TRUE(manager->Init(), nullptr);
gBluetoothHfpManager = manager;
@ -1002,7 +1001,7 @@ BluetoothHfpManager::Listen()
return false;
}
mSocketStatus = mSocket->GetConnectionStatus();
mPrevSocketStatus = mSocket->GetConnectionStatus();
return true;
}
@ -1027,7 +1026,7 @@ BluetoothHfpManager::SendLine(const char* aMessage)
bool
BluetoothHfpManager::SendCommand(const char* aCommand, uint8_t aValue)
{
if (mSocketStatus != SocketConnectionStatus::SOCKET_CONNECTED) {
if (mPrevSocketStatus != SocketConnectionStatus::SOCKET_CONNECTED) {
return false;
}
@ -1327,7 +1326,7 @@ BluetoothHfpManager::OnConnectSuccess(BluetoothSocket* aSocket)
// Cache device path for NotifySettings() since we can't get socket address
// when a headset disconnect with us
mSocket->GetAddress(mDevicePath);
mSocketStatus = mSocket->GetConnectionStatus();
mPrevSocketStatus = mSocket->GetConnectionStatus();
NotifySettings();
}
@ -1358,10 +1357,10 @@ BluetoothHfpManager::OnDisconnect(BluetoothSocket* aSocket)
// When we close a connected socket, then restart listening again and
// notify Settings app.
if (mSocketStatus == SocketConnectionStatus::SOCKET_CONNECTED) {
if (mPrevSocketStatus == SocketConnectionStatus::SOCKET_CONNECTED) {
Listen();
NotifySettings();
} else if (mSocketStatus == SocketConnectionStatus::SOCKET_CONNECTING) {
} else if (mPrevSocketStatus == SocketConnectionStatus::SOCKET_CONNECTING) {
NS_WARNING("BluetoothHfpManager got unexpected socket status!");
}

View File

@ -114,7 +114,7 @@ private:
nsString mDevicePath;
nsString mMsisdn;
nsString mOperatorName;
enum SocketConnectionStatus mSocketStatus;
SocketConnectionStatus mPrevSocketStatus;
nsTArray<Call> mCurrentCallArray;
nsAutoPtr<BluetoothTelephonyListener> mListener;

View File

@ -235,7 +235,7 @@ BluetoothOppManager::BluetoothOppManager() : mConnected(false)
BluetoothSocketType::RFCOMM,
true,
true);
mSocketStatus = mSocket->GetConnectionStatus();
mPrevSocketStatus = mSocket->GetConnectionStatus();
}
BluetoothOppManager::~BluetoothOppManager()
@ -327,7 +327,7 @@ BluetoothOppManager::Listen()
return false;
}
mSocketStatus = mSocket->GetConnectionStatus();
mPrevSocketStatus = mSocket->GetConnectionStatus();
return true;
}
@ -1319,7 +1319,7 @@ BluetoothOppManager::OnConnectSuccess(BluetoothSocket* aSocket)
// Cache device address since we can't get socket address when a remote
// device disconnect with us.
mSocket->GetAddress(mConnectedDeviceAddress);
mSocketStatus = mSocket->GetConnectionStatus();
mPrevSocketStatus = mSocket->GetConnectionStatus();
}
void
@ -1339,7 +1339,7 @@ BluetoothOppManager::OnConnectError(BluetoothSocket* aSocket)
}
mSocket->Disconnect();
mSocketStatus = mSocket->GetConnectionStatus();
mPrevSocketStatus = mSocket->GetConnectionStatus();
Listen();
}
@ -1355,7 +1355,7 @@ BluetoothOppManager::OnDisconnect(BluetoothSocket* aSocket)
* and notify the transfer has been completed (but failed). We also call
* AfterOppDisconnected here to ensure all variables will be cleaned.
*/
if (mSocketStatus == SocketConnectionStatus::SOCKET_CONNECTED) {
if (mPrevSocketStatus == SocketConnectionStatus::SOCKET_CONNECTED) {
if (mTransferMode) {
if (!mSuccessFlag) {
DeleteReceivedFile();
@ -1376,7 +1376,7 @@ BluetoothOppManager::OnDisconnect(BluetoothSocket* aSocket)
}
Listen();
} else if (mSocketStatus == SocketConnectionStatus::SOCKET_CONNECTING) {
} else if (mPrevSocketStatus == SocketConnectionStatus::SOCKET_CONNECTING) {
NS_WARNING("BluetoothOppManager got unexpected socket status!");
}

View File

@ -106,7 +106,7 @@ private:
/**
* RFCOMM socket status.
*/
enum mozilla::ipc::SocketConnectionStatus mSocketStatus;
mozilla::ipc::SocketConnectionStatus mPrevSocketStatus;
/**
* OBEX session status.

View File

@ -124,7 +124,7 @@ BluetoothScoManager::Init()
BluetoothSocketType::SCO,
true,
false);
mSocketStatus = mSocket->GetConnectionStatus();
mPrevSocketStatus = mSocket->GetConnectionStatus();
sScoObserver = new BluetoothScoManagerObserver();
if (!sScoObserver->Init()) {
@ -164,7 +164,6 @@ BluetoothScoManager::Get()
// Create new instance, register, return
BluetoothScoManager* manager = new BluetoothScoManager();
NS_ENSURE_TRUE(manager, nullptr);
NS_ENSURE_TRUE(manager->Init(), nullptr);
gBluetoothScoManager = manager;
@ -245,7 +244,7 @@ BluetoothScoManager::Listen()
return false;
}
mSocketStatus = mSocket->GetConnectionStatus();
mPrevSocketStatus = mSocket->GetConnectionStatus();
return true;
}
@ -264,7 +263,7 @@ BluetoothScoManager::OnConnectSuccess(BluetoothSocket* aSocket)
mSocket->GetAddress(address);
NotifyAudioManager(address);
mSocketStatus = mSocket->GetConnectionStatus();
mPrevSocketStatus = mSocket->GetConnectionStatus();
}
void
@ -273,7 +272,7 @@ BluetoothScoManager::OnConnectError(BluetoothSocket* aSocket)
MOZ_ASSERT(aSocket == mSocket);
mSocket->Disconnect();
mSocketStatus = mSocket->GetConnectionStatus();
mPrevSocketStatus = mSocket->GetConnectionStatus();
Listen();
}
@ -282,7 +281,7 @@ BluetoothScoManager::OnDisconnect(BluetoothSocket* aSocket)
{
MOZ_ASSERT(aSocket == mSocket);
if (mSocketStatus == SocketConnectionStatus::SOCKET_CONNECTED) {
if (mPrevSocketStatus == SocketConnectionStatus::SOCKET_CONNECTED) {
Listen();
nsString address = NS_LITERAL_STRING("");

View File

@ -42,7 +42,7 @@ private:
nsresult HandleShutdown();
void NotifyAudioManager(const nsAString& aAddress);
enum SocketConnectionStatus mSocketStatus;
SocketConnectionStatus mPrevSocketStatus;
nsRefPtr<BluetoothSocket> mSocket;
};