| 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.annotation.TargetApi; | 7 import android.annotation.TargetApi; |
| 8 import android.bluetooth.BluetoothAdapter; | 8 import android.bluetooth.BluetoothAdapter; |
| 9 import android.bluetooth.le.ScanSettings; | 9 import android.bluetooth.le.ScanSettings; |
| 10 import android.content.BroadcastReceiver; | 10 import android.content.BroadcastReceiver; |
| (...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 248 if (uuids == null) { | 248 if (uuids == null) { |
| 249 uuid_strings = new String[] {}; | 249 uuid_strings = new String[] {}; |
| 250 } else { | 250 } else { |
| 251 uuid_strings = new String[uuids.size()]; | 251 uuid_strings = new String[uuids.size()]; |
| 252 for (int i = 0; i < uuids.size(); i++) { | 252 for (int i = 0; i < uuids.size(); i++) { |
| 253 uuid_strings[i] = uuids.get(i).toString(); | 253 uuid_strings[i] = uuids.get(i).toString(); |
| 254 } | 254 } |
| 255 } | 255 } |
| 256 | 256 |
| 257 nativeCreateOrUpdateDeviceOnScan(mNativeBluetoothAdapterAndroid, | 257 nativeCreateOrUpdateDeviceOnScan(mNativeBluetoothAdapterAndroid, |
| 258 result.getDevice().getAddress(), result.getDevice(), uuid_st
rings); | 258 result.getDevice().getAddress(), result.getDevice(), result.
getRssi(), |
| 259 uuid_strings, result.getScanRecord_getTxPowerLevel()); |
| 259 } | 260 } |
| 260 | 261 |
| 261 @Override | 262 @Override |
| 262 public void onScanFailed(int errorCode) { | 263 public void onScanFailed(int errorCode) { |
| 263 Log.w(TAG, "onScanFailed: %d", errorCode); | 264 Log.w(TAG, "onScanFailed: %d", errorCode); |
| 264 nativeOnScanFailed(mNativeBluetoothAdapterAndroid); | 265 nativeOnScanFailed(mNativeBluetoothAdapterAndroid); |
| 265 } | 266 } |
| 266 } | 267 } |
| 267 | 268 |
| 268 @Override | 269 @Override |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 308 // BluetoothAdapterAndroid C++ methods declared for access from java: | 309 // BluetoothAdapterAndroid C++ methods declared for access from java: |
| 309 | 310 |
| 310 // Binds to BluetoothAdapterAndroid::OnScanFailed. | 311 // Binds to BluetoothAdapterAndroid::OnScanFailed. |
| 311 private native void nativeOnScanFailed(long nativeBluetoothAdapterAndroid); | 312 private native void nativeOnScanFailed(long nativeBluetoothAdapterAndroid); |
| 312 | 313 |
| 313 // Binds to BluetoothAdapterAndroid::CreateOrUpdateDeviceOnScan. | 314 // Binds to BluetoothAdapterAndroid::CreateOrUpdateDeviceOnScan. |
| 314 // 'Object' type must be used for |bluetoothDeviceWrapper| because inner cla
ss | 315 // 'Object' type must be used for |bluetoothDeviceWrapper| because inner cla
ss |
| 315 // Wrappers.BluetoothDeviceWrapper reference is not handled by jni_generator
.py JavaToJni. | 316 // Wrappers.BluetoothDeviceWrapper reference is not handled by jni_generator
.py JavaToJni. |
| 316 // http://crbug.com/505554 | 317 // http://crbug.com/505554 |
| 317 private native void nativeCreateOrUpdateDeviceOnScan(long nativeBluetoothAda
pterAndroid, | 318 private native void nativeCreateOrUpdateDeviceOnScan(long nativeBluetoothAda
pterAndroid, |
| 318 String address, Object bluetoothDeviceWrapper, String[] advertisedUu
ids); | 319 String address, Object bluetoothDeviceWrapper, int rssi, String[] ad
vertisedUuids, |
| 320 int txPower); |
| 319 | 321 |
| 320 // Binds to BluetoothAdapterAndroid::nativeOnAdapterStateChanged | 322 // Binds to BluetoothAdapterAndroid::nativeOnAdapterStateChanged |
| 321 private native void nativeOnAdapterStateChanged( | 323 private native void nativeOnAdapterStateChanged( |
| 322 long nativeBluetoothAdapterAndroid, boolean powered); | 324 long nativeBluetoothAdapterAndroid, boolean powered); |
| 323 } | 325 } |
| OLD | NEW |