Bug 1038645: Asynchronous |BluetoothHandsfreeInterface::PhoneStateChange| (under bluetooth2/), r=btian

This commit is contained in:
Thomas Zimmermann 2014-07-22 13:53:29 +02:00
Родитель d83face693
Коммит f90b7b92ba
3 изменённых файлов: 27 добавлений и 11 удалений

Просмотреть файл

@ -818,13 +818,18 @@ BluetoothHandsfreeInterface::ClccResponse(
/* Phone State */ /* Phone State */
bt_status_t void
BluetoothHandsfreeInterface::PhoneStateChange(int aNumActive, int aNumHeld, BluetoothHandsfreeInterface::PhoneStateChange(int aNumActive, int aNumHeld,
bthf_call_state_t aCallSetupState, const char* aNumber, bthf_call_state_t aCallSetupState, const char* aNumber,
bthf_call_addrtype_t aType) bthf_call_addrtype_t aType, BluetoothHandsfreeResultHandler* aRes)
{ {
return mInterface->phone_state_change(aNumActive, aNumHeld, aCallSetupState, bt_status_t status = mInterface->phone_state_change(aNumActive, aNumHeld,
aNumber, aType); aCallSetupState,
aNumber, aType);
if (aRes) {
DispatchBluetoothHandsfreeResult(
aRes, &BluetoothHandsfreeResultHandler::PhoneStateChange, status);
}
} }
// //

Просмотреть файл

@ -164,10 +164,10 @@ public:
/* Phone State */ /* Phone State */
bt_status_t PhoneStateChange(int aNumActive, int aNumHeld, void PhoneStateChange(int aNumActive, int aNumHeld,
bthf_call_state_t aCallSetupState, bthf_call_state_t aCallSetupState,
const char* aNumber, const char* aNumber, bthf_call_addrtype_t aType,
bthf_call_addrtype_t aType); BluetoothHandsfreeResultHandler* aRes);
protected: protected:
BluetoothHandsfreeInterface(const bthf_interface_t* aInterface); BluetoothHandsfreeInterface(const bthf_interface_t* aInterface);

Просмотреть файл

@ -1210,6 +1210,17 @@ BluetoothHfpManager::SendResponse(bthf_at_response_t aResponseCode)
aResponseCode, 0, new AtResponseResultHandler()); aResponseCode, 0, new AtResponseResultHandler());
} }
class PhoneStateChangeResultHandler MOZ_FINAL
: public BluetoothHandsfreeResultHandler
{
public:
void OnError(bt_status_t aStatus) MOZ_OVERRIDE
{
BT_WARNING("BluetoothHandsfreeInterface::PhoneStateChange failed: %d",
(int)aStatus);
}
};
void void
BluetoothHfpManager::UpdatePhoneCIND(uint32_t aCallIndex) BluetoothHfpManager::UpdatePhoneCIND(uint32_t aCallIndex)
{ {
@ -1227,9 +1238,9 @@ BluetoothHfpManager::UpdatePhoneCIND(uint32_t aCallIndex)
aCallIndex, mCurrentCallArray[aCallIndex].mState, aCallIndex, mCurrentCallArray[aCallIndex].mState,
numActive, numHeld, callSetupState); numActive, numHeld, callSetupState);
NS_ENSURE_TRUE_VOID(BT_STATUS_SUCCESS == sBluetoothHfpInterface->PhoneStateChange(
sBluetoothHfpInterface->PhoneStateChange( numActive, numHeld, callSetupState, number.get(), type,
numActive, numHeld, callSetupState, number.get(), type)); new PhoneStateChangeResultHandler());
} }
class DeviceStatusNotificationResultHandler MOZ_FINAL class DeviceStatusNotificationResultHandler MOZ_FINAL