Bug 1029389: Asynchronous |BluetoothHandsfreeInterface::PhoneStateChange|, r=shuang

This commit is contained in:
Thomas Zimmermann 2014-07-15 10:56:55 +02:00
Родитель 60420f7ec0
Коммит 28f818c2ea
3 изменённых файлов: 27 добавлений и 11 удалений

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

@ -818,13 +818,18 @@ BluetoothHandsfreeInterface::ClccResponse(
/* Phone State */
bt_status_t
void
BluetoothHandsfreeInterface::PhoneStateChange(int aNumActive, int aNumHeld,
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,
aNumber, aType);
bt_status_t status = mInterface->phone_state_change(aNumActive, aNumHeld,
aCallSetupState,
aNumber, aType);
if (aRes) {
DispatchBluetoothHandsfreeResult(
aRes, &BluetoothHandsfreeResultHandler::PhoneStateChange, status);
}
}
//

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

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

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

@ -1204,6 +1204,17 @@ BluetoothHfpManager::SendResponse(bthf_at_response_t aResponseCode)
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
BluetoothHfpManager::UpdatePhoneCIND(uint32_t aCallIndex)
{
@ -1221,9 +1232,9 @@ BluetoothHfpManager::UpdatePhoneCIND(uint32_t aCallIndex)
aCallIndex, mCurrentCallArray[aCallIndex].mState,
numActive, numHeld, callSetupState);
NS_ENSURE_TRUE_VOID(BT_STATUS_SUCCESS ==
sBluetoothHfpInterface->PhoneStateChange(
numActive, numHeld, callSetupState, number.get(), type));
sBluetoothHfpInterface->PhoneStateChange(
numActive, numHeld, callSetupState, number.get(), type,
new PhoneStateChangeResultHandler());
}
class DeviceStatusNotificationResultHandler MOZ_FINAL