Bug 1050126: Convert Bluetooth A2DP data types in |BluetoothA2dpInterface| (under bluetooth2/), r=btian

With this patch |BluetoothA2dpInterface| is responsible for converting all
Bluetooth data types to Bluedroid types. All callers have been adapted.
This commit is contained in:
Thomas Zimmermann 2014-08-15 13:41:19 +02:00
parent 95f487bc6c
commit f5815c691d
3 changed files with 22 additions and 14 deletions

View File

@ -844,10 +844,7 @@ BluetoothA2dpManager::Connect(const nsAString& aDeviceAddress,
return;
}
bt_bdaddr_t remoteAddress;
StringToBdAddressType(aDeviceAddress, &remoteAddress);
sBtA2dpInterface->Connect(&remoteAddress, new ConnectResultHandler());
sBtA2dpInterface->Connect(aDeviceAddress, new ConnectResultHandler());
}
void
@ -901,10 +898,7 @@ BluetoothA2dpManager::Disconnect(BluetoothProfileController* aController)
return;
}
bt_bdaddr_t remoteAddress;
StringToBdAddressType(mDeviceAddress, &remoteAddress);
sBtA2dpInterface->Disconnect(&remoteAddress, new DisconnectResultHandler());
sBtA2dpInterface->Disconnect(mDeviceAddress, new DisconnectResultHandler());
}
void

View File

@ -1382,10 +1382,17 @@ BluetoothA2dpInterface::Cleanup(BluetoothA2dpResultHandler* aRes)
}
void
BluetoothA2dpInterface::Connect(bt_bdaddr_t *aBdAddr,
BluetoothA2dpInterface::Connect(const nsAString& aBdAddr,
BluetoothA2dpResultHandler* aRes)
{
bt_status_t status = mInterface->connect(aBdAddr);
bt_status_t status;
bt_bdaddr_t bdAddr;
if (NS_SUCCEEDED(Convert(aBdAddr, bdAddr))) {
status = mInterface->connect(&bdAddr);
} else {
status = BT_STATUS_PARM_INVALID;
}
if (aRes) {
DispatchBluetoothA2dpResult(aRes, &BluetoothA2dpResultHandler::Connect,
@ -1394,10 +1401,17 @@ BluetoothA2dpInterface::Connect(bt_bdaddr_t *aBdAddr,
}
void
BluetoothA2dpInterface::Disconnect(bt_bdaddr_t *aBdAddr,
BluetoothA2dpInterface::Disconnect(const nsAString& aBdAddr,
BluetoothA2dpResultHandler* aRes)
{
bt_status_t status = mInterface->disconnect(aBdAddr);
bt_status_t status;
bt_bdaddr_t bdAddr;
if (NS_SUCCEEDED(Convert(aBdAddr, bdAddr))) {
status = mInterface->disconnect(&bdAddr);
} else {
status = BT_STATUS_PARM_INVALID;
}
if (aRes) {
DispatchBluetoothA2dpResult(aRes, &BluetoothA2dpResultHandler::Disconnect,

View File

@ -216,9 +216,9 @@ public:
BluetoothA2dpResultHandler* aRes);
void Cleanup(BluetoothA2dpResultHandler* aRes);
void Connect(bt_bdaddr_t *aBdAddr,
void Connect(const nsAString& aBdAddr,
BluetoothA2dpResultHandler* aRes);
void Disconnect(bt_bdaddr_t *aBdAddr,
void Disconnect(const nsAString& aBdAddr,
BluetoothA2dpResultHandler* aRes);
protected: