Bug 938529 - [bluedroid] Set BT_SCAN_MODE to Connectable after Bluetooth turned on. r=echou
authorShawn Huang <shuang@mozilla.com>
Mon, 18 Nov 2013 12:39:03 -0500
changeset 156033 75516a2a7c3ee856c29dc6439719a308108e30c3
parent 156032 699fa8832139a633f06943595cabbca948d9892e
child 156034 7384ecf6d9424d98d572bf39192f4bdaf7fc30eb
push id25667
push userkwierso@gmail.com
push dateTue, 19 Nov 2013 02:20:11 +0000
treeherdermozilla-central@f7c711424299 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersechou
bugs938529
milestone28.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 938529 - [bluedroid] Set BT_SCAN_MODE to Connectable after Bluetooth turned on. r=echou
dom/bluetooth/bluedroid/gonk/BluetoothServiceBluedroid.cpp
--- a/dom/bluetooth/bluedroid/gonk/BluetoothServiceBluedroid.cpp
+++ b/dom/bluetooth/bluedroid/gonk/BluetoothServiceBluedroid.cpp
@@ -164,16 +164,28 @@ AdapterStateChangeCallback(bt_state_t aS
 {
   MOZ_ASSERT(!NS_IsMainThread());
 
   BT_LOGD("%s, BT_STATE:%d", __FUNCTION__, aStatus);
   nsAutoString signalName;
   if (aStatus == BT_STATE_ON) {
     sIsBtEnabled = true;
     signalName = NS_LITERAL_STRING("AdapterAdded");
+    // by default bluetooth scan mode is NONE
+    bt_property_t prop;
+    prop.type = BT_PROPERTY_ADAPTER_SCAN_MODE;
+    bt_scan_mode_t mode = BT_SCAN_MODE_CONNECTABLE;
+    prop.val = (void*) &mode;
+    prop.len = sizeof(mode);
+    if (sBtInterface) {
+      int ret = sBtInterface->set_adapter_property(&prop);
+      if (ret != BT_STATUS_SUCCESS) {
+        BT_LOGR("Warning! Fail to set property to BT_SCAN_MODE_CONNECTABLE");
+      }
+    }
   } else {
     sIsBtEnabled = false;
     signalName = NS_LITERAL_STRING("Disabled");
   }
 
   BluetoothSignal signal(signalName, NS_LITERAL_STRING(KEY_MANAGER),
                          BluetoothValue(true));
   nsRefPtr<DistributeBluetoothSignalTask>