зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1029389: Asynchronous |BluetoothHandsfreeInterface::DeviceStatusNotification|, r=shuang
This commit is contained in:
Родитель
47c0f745d8
Коммит
478bf400c9
|
@ -734,13 +734,19 @@ BluetoothHandsfreeInterface::VolumeControl(
|
|||
|
||||
/* Device status */
|
||||
|
||||
bt_status_t
|
||||
void
|
||||
BluetoothHandsfreeInterface::DeviceStatusNotification(
|
||||
bthf_network_state_t aNtkState, bthf_service_type_t aSvcType, int aSignal,
|
||||
int aBattChg)
|
||||
int aBattChg, BluetoothHandsfreeResultHandler* aRes)
|
||||
{
|
||||
return mInterface->device_status_notification(aNtkState, aSvcType, aSignal,
|
||||
aBattChg);
|
||||
bt_status_t status = mInterface->device_status_notification(
|
||||
aNtkState, aSvcType, aSignal, aBattChg);
|
||||
|
||||
if (aRes) {
|
||||
DispatchBluetoothHandsfreeResult(
|
||||
aRes, &BluetoothHandsfreeResultHandler::DeviceStatusNotification,
|
||||
status);
|
||||
}
|
||||
}
|
||||
|
||||
/* Responses */
|
||||
|
|
|
@ -139,9 +139,10 @@ public:
|
|||
|
||||
/* Device status */
|
||||
|
||||
bt_status_t DeviceStatusNotification(bthf_network_state_t aNtkState,
|
||||
bthf_service_type_t aSvcType,
|
||||
int aSignal, int aBattChg);
|
||||
void DeviceStatusNotification(bthf_network_state_t aNtkState,
|
||||
bthf_service_type_t aSvcType,
|
||||
int aSignal, int aBattChg,
|
||||
BluetoothHandsfreeResultHandler* aRes);
|
||||
|
||||
/* Responses */
|
||||
|
||||
|
|
|
@ -1177,16 +1177,27 @@ BluetoothHfpManager::UpdatePhoneCIND(uint32_t aCallIndex)
|
|||
numActive, numHeld, callSetupState, number.get(), type));
|
||||
}
|
||||
|
||||
class DeviceStatusNotificationResultHandler MOZ_FINAL
|
||||
: public BluetoothHandsfreeResultHandler
|
||||
{
|
||||
public:
|
||||
void OnError(bt_status_t aStatus) MOZ_OVERRIDE
|
||||
{
|
||||
BT_WARNING(
|
||||
"BluetoothHandsfreeInterface::DeviceStatusNotification failed: %d",
|
||||
(int)aStatus);
|
||||
}
|
||||
};
|
||||
|
||||
void
|
||||
BluetoothHfpManager::UpdateDeviceCIND()
|
||||
{
|
||||
if (sBluetoothHfpInterface) {
|
||||
NS_ENSURE_TRUE_VOID(BT_STATUS_SUCCESS ==
|
||||
sBluetoothHfpInterface->DeviceStatusNotification(
|
||||
(bthf_network_state_t) mService,
|
||||
(bthf_service_type_t) mRoam,
|
||||
mSignal,
|
||||
mBattChg));
|
||||
sBluetoothHfpInterface->DeviceStatusNotification(
|
||||
(bthf_network_state_t) mService,
|
||||
(bthf_service_type_t) mRoam,
|
||||
mSignal,
|
||||
mBattChg, new DeviceStatusNotificationResultHandler());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче