зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1038645: Asynchronous |BluetoothHandsfreeInterface::DeviceStatusNotification| (under bluetooth2/), r=btian
This commit is contained in:
Родитель
d1a03f2f88
Коммит
047957b89c
|
@ -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 */
|
||||
|
||||
|
|
|
@ -1183,16 +1183,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());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче