Bug 802080 - Update connected device address, r=qdot

This commit is contained in:
Eric Chou 2012-10-31 14:07:06 +08:00
parent c68613929b
commit f73dfbb691

View File

@ -161,11 +161,7 @@ BluetoothOppManager::BluetoothOppManager() : mConnected(false)
, mPutFinal(false)
, mWaitingForConfirmationFlag(false)
{
// FIXME / Bug 800249:
// mConnectedDeviceAddress is Bluetooth address of connected device,
// we will be able to get this value after bug 800249 lands. For now,
// just assign a fake value to it.
mConnectedDeviceAddress.AssignASCII("00:00:00:00:00:00");
mConnectedDeviceAddress.AssignLiteral("00:00:00:00:00:00");
}
BluetoothOppManager::~BluetoothOppManager()
@ -347,6 +343,8 @@ BluetoothOppManager::AfterOppDisconnected()
mReadFileThread->Shutdown();
mReadFileThread = nullptr;
}
mConnectedDeviceAddress.AssignLiteral("00:00:00:00:00:00");
}
// Virtual function of class SocketConsumer
@ -959,6 +957,9 @@ BluetoothOppManager::ReceivingFileConfirmation(const nsString& aAddress,
void
BluetoothOppManager::OnConnectSuccess()
{
// Cache device address since we can't get socket address when a remote
// device disconnect with us.
GetSocketAddr(mConnectedDeviceAddress);
}
void
@ -969,4 +970,8 @@ BluetoothOppManager::OnConnectError()
void
BluetoothOppManager::OnDisconnect()
{
// It is valid for a bluetooth device which is transfering file via OPP
// closing socket without sending OBEX disconnect request first. So we
// call AfterOppDisconnected here to ensure all variables will be cleaned.
AfterOppDisconnected();
}