synchronized (mObject) {
if (getState() == BluetoothAdapter.STATE_TURNING_ON &&
mScanMode == BluetoothAdapter.SCAN_MODE_NONE) {
- setScanMode(AbstractionLayer.BT_SCAN_MODE_CONNECTABLE);
+ /* mDiscoverableTimeout is part of the
+ adapterPropertyChangedCallback received before
+ onBluetoothReady */
+ if (mDiscoverableTimeout != 0)
+ setScanMode(AbstractionLayer.BT_SCAN_MODE_CONNECTABLE);
+ else /* if timeout == never (0) at startup */
+ setScanMode(AbstractionLayer.BT_SCAN_MODE_CONNECTABLE_DISCOVERABLE);
+ /* though not always required, this keeps NV up-to date on first-boot after flash */
+ setDiscoverableTimeout(mDiscoverableTimeout);
}
}
}
intent.putExtra(BluetoothDevice.EXTRA_NAME, device.mName);
intent.addFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY_BEFORE_BOOT);
mContext.sendBroadcast(intent, mAdapterService.BLUETOOTH_PERM);
- debugLog("Remote Device ame is: " + device.mName);
+ debugLog("Remote Device name is: " + device.mName);
break;
case AbstractionLayer.BT_PROPERTY_REMOTE_FRIENDLY_NAME:
// TODO(BT) is null device.mAlias a valid senario?