Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(387)

Side by Side Diff: device/bluetooth/android/java/src/org/chromium/device/bluetooth/Wrappers.java

Issue 1215303006: bluetooth: android: Initial BluetoothDeviceAndroid implementation. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@bta-discovery-
Patch Set: Merge TOT Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698