OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 package org.chromium.device.bluetooth; | 5 package org.chromium.device.bluetooth; |
6 | 6 |
7 import android.Manifest; | 7 import android.Manifest; |
8 import android.annotation.TargetApi; | 8 import android.annotation.TargetApi; |
9 import android.bluetooth.BluetoothAdapter; | 9 import android.bluetooth.BluetoothAdapter; |
10 import android.bluetooth.le.ScanSettings; | 10 import android.bluetooth.le.ScanSettings; |
(...skipping 16 matching lines...) Expand all Loading... |
27 * device::BluetoothAdapter. | 27 * device::BluetoothAdapter. |
28 * | 28 * |
29 * Lifetime is controlled by device::BluetoothAdapterAndroid. | 29 * Lifetime is controlled by device::BluetoothAdapterAndroid. |
30 */ | 30 */ |
31 @JNINamespace("device") | 31 @JNINamespace("device") |
32 @TargetApi(Build.VERSION_CODES.LOLLIPOP) | 32 @TargetApi(Build.VERSION_CODES.LOLLIPOP) |
33 final class ChromeBluetoothAdapter extends BroadcastReceiver { | 33 final class ChromeBluetoothAdapter extends BroadcastReceiver { |
34 private static final String TAG = "Bluetooth"; | 34 private static final String TAG = "Bluetooth"; |
35 | 35 |
36 private long mNativeBluetoothAdapterAndroid; | 36 private long mNativeBluetoothAdapterAndroid; |
37 private Wrappers.BluetoothAdapterWrapper mAdapter; | 37 // mAdapter is final to ensure registerReceiver is followed by unregisterRec
eiver. |
| 38 private final Wrappers.BluetoothAdapterWrapper mAdapter; |
38 private int mNumDiscoverySessions; | 39 private int mNumDiscoverySessions; |
39 private ScanCallback mScanCallback; | 40 private ScanCallback mScanCallback; |
40 | 41 |
41 // -------------------------------------------------------------------------
-------------------- | 42 // -------------------------------------------------------------------------
-------------------- |
42 // Construction and handler for C++ object destruction. | 43 // Construction and handler for C++ object destruction. |
43 | 44 |
44 /** | 45 /** |
45 * Constructs a ChromeBluetoothAdapter. | 46 * Constructs a ChromeBluetoothAdapter. |
46 * @param nativeBluetoothAdapterAndroid Is the associated C++ | 47 * @param nativeBluetoothAdapterAndroid Is the associated C++ |
47 * BluetoothAdapterAndroid pointer valu
e. | 48 * BluetoothAdapterAndroid pointer valu
e. |
(...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
343 // 'Object' type must be used for |bluetoothDeviceWrapper| because inner cla
ss | 344 // 'Object' type must be used for |bluetoothDeviceWrapper| because inner cla
ss |
344 // Wrappers.BluetoothDeviceWrapper reference is not handled by jni_generator
.py JavaToJni. | 345 // Wrappers.BluetoothDeviceWrapper reference is not handled by jni_generator
.py JavaToJni. |
345 // http://crbug.com/505554 | 346 // http://crbug.com/505554 |
346 private native void nativeCreateOrUpdateDeviceOnScan(long nativeBluetoothAda
pterAndroid, | 347 private native void nativeCreateOrUpdateDeviceOnScan(long nativeBluetoothAda
pterAndroid, |
347 String address, Object bluetoothDeviceWrapper, List<ParcelUuid> adve
rtisedUuids); | 348 String address, Object bluetoothDeviceWrapper, List<ParcelUuid> adve
rtisedUuids); |
348 | 349 |
349 // Binds to BluetoothAdapterAndroid::nativeOnAdapterStateChanged | 350 // Binds to BluetoothAdapterAndroid::nativeOnAdapterStateChanged |
350 private native void nativeOnAdapterStateChanged( | 351 private native void nativeOnAdapterStateChanged( |
351 long nativeBluetoothAdapterAndroid, boolean powered); | 352 long nativeBluetoothAdapterAndroid, boolean powered); |
352 } | 353 } |
OLD | NEW |