Bug 1048915: Use Bluetooth Core notifications, r=shuang

This patch connects backend and Gecko side of the notification
code. Gecko will now receive notifications instead of Bluedroid
callbacks.
This commit is contained in:
Thomas Zimmermann 2014-08-14 18:12:52 +02:00
parent 4c463fc757
commit 6131bf3961
3 changed files with 26 additions and 4 deletions

View File

@ -3031,10 +3031,28 @@ BluetoothInterface::~BluetoothInterface()
{ }
void
BluetoothInterface::Init(bt_callbacks_t* aCallbacks,
BluetoothInterface::Init(BluetoothNotificationHandler* aNotificationHandler,
BluetoothResultHandler* aRes)
{
int status = mInterface->init(aCallbacks);
static bt_callbacks_t sBluetoothCallbacks = {
sizeof(sBluetoothCallbacks),
.adapter_state_changed_cb = BluetoothCallback::AdapterStateChanged,
.adapter_properties_cb = BluetoothCallback::AdapterProperties,
.remote_device_properties_cb = BluetoothCallback::RemoteDeviceProperties,
.device_found_cb = BluetoothCallback::DeviceFound,
.discovery_state_changed_cb= BluetoothCallback::DiscoveryStateChanged,
.pin_request_cb = BluetoothCallback::PinRequest,
.ssp_request_cb = BluetoothCallback::SspRequest,
.bond_state_changed_cb = BluetoothCallback::BondStateChanged,
.acl_state_changed_cb = BluetoothCallback::AclStateChanged,
.thread_evt_cb = BluetoothCallback::ThreadEvt,
.dut_mode_recv_cb = BluetoothCallback::DutModeRecv,
.le_test_mode_cb = BluetoothCallback::LeTestMode
};
sNotificationHandler = aNotificationHandler;
int status = mInterface->init(&sBluetoothCallbacks);
if (aRes) {
DispatchBluetoothResult(aRes, &BluetoothResultHandler::Init,
@ -3051,6 +3069,8 @@ BluetoothInterface::Cleanup(BluetoothResultHandler* aRes)
DispatchBluetoothResult(aRes, &BluetoothResultHandler::Cleanup,
STATUS_SUCCESS);
}
sNotificationHandler = nullptr;
}
void

View File

@ -419,7 +419,8 @@ class BluetoothInterface
public:
static BluetoothInterface* GetInstance();
void Init(bt_callbacks_t* aCallbacks, BluetoothResultHandler* aRes);
void Init(BluetoothNotificationHandler* aNotificationHandler,
BluetoothResultHandler* aRes);
void Cleanup(BluetoothResultHandler* aRes);
void Enable(BluetoothResultHandler* aRes);

View File

@ -951,7 +951,8 @@ StartGonkBluetooth()
return NS_OK;
}
sBtInterface->Init(&sBluetoothCallbacks, new InitResultHandler());
sBtInterface->Init(reinterpret_cast<BluetoothServiceBluedroid*>(bs),
new InitResultHandler());
return NS_OK;
}