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.BluetoothDevice; | 10 import android.bluetooth.BluetoothDevice; |
11 import android.bluetooth.le.BluetoothLeScanner; | 11 import android.bluetooth.le.BluetoothLeScanner; |
12 import android.bluetooth.le.ScanCallback; | 12 import android.bluetooth.le.ScanCallback; |
13 import android.bluetooth.le.ScanFilter; | 13 import android.bluetooth.le.ScanFilter; |
14 import android.bluetooth.le.ScanResult; | 14 import android.bluetooth.le.ScanResult; |
15 import android.bluetooth.le.ScanSettings; | 15 import android.bluetooth.le.ScanSettings; |
16 import android.content.Context; | 16 import android.content.Context; |
17 import android.content.pm.PackageManager; | 17 import android.content.pm.PackageManager; |
18 import android.os.Build; | 18 import android.os.Build; |
| 19 import android.os.ParcelUuid; |
19 | 20 |
20 import org.chromium.base.CalledByNative; | 21 import org.chromium.base.CalledByNative; |
21 import org.chromium.base.JNINamespace; | 22 import org.chromium.base.JNINamespace; |
22 import org.chromium.base.Log; | 23 import org.chromium.base.Log; |
23 | 24 |
24 import java.util.ArrayList; | 25 import java.util.ArrayList; |
25 import java.util.HashMap; | 26 import java.util.HashMap; |
26 import java.util.List; | 27 import java.util.List; |
27 | 28 |
28 /** | 29 /** |
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
201 static class ScanResultWrapper { | 202 static class ScanResultWrapper { |
202 private final ScanResult mScanResult; | 203 private final ScanResult mScanResult; |
203 | 204 |
204 public ScanResultWrapper(ScanResult scanResult) { | 205 public ScanResultWrapper(ScanResult scanResult) { |
205 mScanResult = scanResult; | 206 mScanResult = scanResult; |
206 } | 207 } |
207 | 208 |
208 public BluetoothDeviceWrapper getDevice() { | 209 public BluetoothDeviceWrapper getDevice() { |
209 return new BluetoothDeviceWrapper(mScanResult.getDevice()); | 210 return new BluetoothDeviceWrapper(mScanResult.getDevice()); |
210 } | 211 } |
| 212 |
| 213 public List<ParcelUuid> getScanRecord_getServiceUuids() { |
| 214 return mScanResult.getScanRecord().getServiceUuids(); |
| 215 } |
211 } | 216 } |
212 | 217 |
213 /** | 218 /** |
214 * Wraps android.bluetooth.BluetoothDevice. | 219 * Wraps android.bluetooth.BluetoothDevice. |
215 */ | 220 */ |
216 static class BluetoothDeviceWrapper { | 221 static class BluetoothDeviceWrapper { |
217 private final BluetoothDevice mDevice; | 222 private final BluetoothDevice mDevice; |
218 | 223 |
219 public BluetoothDeviceWrapper(BluetoothDevice device) { | 224 public BluetoothDeviceWrapper(BluetoothDevice device) { |
220 mDevice = device; | 225 mDevice = device; |
221 } | 226 } |
222 | 227 |
223 public String getAddress() { | 228 public String getAddress() { |
224 return mDevice.getAddress(); | 229 return mDevice.getAddress(); |
225 } | 230 } |
226 | 231 |
| 232 public int getBluetoothClass_getDeviceClass() { |
| 233 return mDevice.getBluetoothClass().getDeviceClass(); |
| 234 } |
| 235 |
| 236 public int getBondState() { |
| 237 return mDevice.getBondState(); |
| 238 } |
| 239 |
227 public String getName() { | 240 public String getName() { |
228 return mDevice.getName(); | 241 return mDevice.getName(); |
229 } | 242 } |
230 } | 243 } |
231 } | 244 } |
OLD | NEW |