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 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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(), result.
getRssi(), | 258 result.getDevice().getAddress(), result.getDevice(), result.
getRssi(), |
259 uuid_strings, result.getScanRecord_getTxPowerLevel()); | 259 result.getScanRecord_getDeviceName(), uuid_strings, |
| 260 result.getScanRecord_getTxPowerLevel()); |
260 } | 261 } |
261 | 262 |
262 @Override | 263 @Override |
263 public void onScanFailed(int errorCode) { | 264 public void onScanFailed(int errorCode) { |
264 Log.w(TAG, "onScanFailed: %d", errorCode); | 265 Log.w(TAG, "onScanFailed: %d", errorCode); |
265 nativeOnScanFailed(mNativeBluetoothAdapterAndroid); | 266 nativeOnScanFailed(mNativeBluetoothAdapterAndroid); |
266 } | 267 } |
267 } | 268 } |
268 | 269 |
269 @Override | 270 @Override |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
309 // BluetoothAdapterAndroid C++ methods declared for access from java: | 310 // BluetoothAdapterAndroid C++ methods declared for access from java: |
310 | 311 |
311 // Binds to BluetoothAdapterAndroid::OnScanFailed. | 312 // Binds to BluetoothAdapterAndroid::OnScanFailed. |
312 private native void nativeOnScanFailed(long nativeBluetoothAdapterAndroid); | 313 private native void nativeOnScanFailed(long nativeBluetoothAdapterAndroid); |
313 | 314 |
314 // Binds to BluetoothAdapterAndroid::CreateOrUpdateDeviceOnScan. | 315 // Binds to BluetoothAdapterAndroid::CreateOrUpdateDeviceOnScan. |
315 // 'Object' type must be used for |bluetoothDeviceWrapper| because inner cla
ss | 316 // 'Object' type must be used for |bluetoothDeviceWrapper| because inner cla
ss |
316 // Wrappers.BluetoothDeviceWrapper reference is not handled by jni_generator
.py JavaToJni. | 317 // Wrappers.BluetoothDeviceWrapper reference is not handled by jni_generator
.py JavaToJni. |
317 // http://crbug.com/505554 | 318 // http://crbug.com/505554 |
318 private native void nativeCreateOrUpdateDeviceOnScan(long nativeBluetoothAda
pterAndroid, | 319 private native void nativeCreateOrUpdateDeviceOnScan(long nativeBluetoothAda
pterAndroid, |
319 String address, Object bluetoothDeviceWrapper, int rssi, String[] ad
vertisedUuids, | 320 String address, Object bluetoothDeviceWrapper, int rssi, String adve
rtisedName, |
320 int txPower); | 321 String[] advertisedUuids, int txPower); |
321 | 322 |
322 // Binds to BluetoothAdapterAndroid::nativeOnAdapterStateChanged | 323 // Binds to BluetoothAdapterAndroid::nativeOnAdapterStateChanged |
323 private native void nativeOnAdapterStateChanged( | 324 private native void nativeOnAdapterStateChanged( |
324 long nativeBluetoothAdapterAndroid, boolean powered); | 325 long nativeBluetoothAdapterAndroid, boolean powered); |
325 } | 326 } |
OLD | NEW |