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; |
(...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
297 | 297 |
298 BluetoothGattWrapper(BluetoothGatt gatt, BluetoothDeviceWrapper deviceWr
apper) { | 298 BluetoothGattWrapper(BluetoothGatt gatt, BluetoothDeviceWrapper deviceWr
apper) { |
299 mGatt = gatt; | 299 mGatt = gatt; |
300 mDeviceWrapper = deviceWrapper; | 300 mDeviceWrapper = deviceWrapper; |
301 } | 301 } |
302 | 302 |
303 public void disconnect() { | 303 public void disconnect() { |
304 mGatt.disconnect(); | 304 mGatt.disconnect(); |
305 } | 305 } |
306 | 306 |
| 307 public void close() { |
| 308 mGatt.close(); |
| 309 } |
| 310 |
307 public void discoverServices() { | 311 public void discoverServices() { |
308 mGatt.discoverServices(); | 312 mGatt.discoverServices(); |
309 } | 313 } |
310 | 314 |
311 public List<BluetoothGattServiceWrapper> getServices() { | 315 public List<BluetoothGattServiceWrapper> getServices() { |
312 List<BluetoothGattService> services = mGatt.getServices(); | 316 List<BluetoothGattService> services = mGatt.getServices(); |
313 ArrayList<BluetoothGattServiceWrapper> servicesWrapped = | 317 ArrayList<BluetoothGattServiceWrapper> servicesWrapped = |
314 new ArrayList<BluetoothGattServiceWrapper>(services.size()); | 318 new ArrayList<BluetoothGattServiceWrapper>(services.size()); |
315 for (BluetoothGattService service : services) { | 319 for (BluetoothGattService service : services) { |
316 servicesWrapped.add(new BluetoothGattServiceWrapper(service, mDe
viceWrapper)); | 320 servicesWrapped.add(new BluetoothGattServiceWrapper(service, mDe
viceWrapper)); |
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
532 | 536 |
533 public byte[] getValue() { | 537 public byte[] getValue() { |
534 return mDescriptor.getValue(); | 538 return mDescriptor.getValue(); |
535 } | 539 } |
536 | 540 |
537 public boolean setValue(byte[] value) { | 541 public boolean setValue(byte[] value) { |
538 return mDescriptor.setValue(value); | 542 return mDescriptor.setValue(value); |
539 } | 543 } |
540 } | 544 } |
541 } | 545 } |
OLD | NEW |