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 #include "device/bluetooth/bluetooth_device_android.h" | 5 #include "device/bluetooth/bluetooth_device_android.h" |
6 | 6 |
7 #include "base/android/context_utils.h" | |
8 #include "base/android/jni_android.h" | 7 #include "base/android/jni_android.h" |
9 #include "base/android/jni_string.h" | 8 #include "base/android/jni_string.h" |
10 #include "base/metrics/histogram_macros.h" | 9 #include "base/metrics/histogram_macros.h" |
11 #include "base/stl_util.h" | 10 #include "base/stl_util.h" |
12 #include "base/strings/stringprintf.h" | 11 #include "base/strings/stringprintf.h" |
13 #include "device/bluetooth/bluetooth_adapter_android.h" | 12 #include "device/bluetooth/bluetooth_adapter_android.h" |
14 #include "device/bluetooth/bluetooth_remote_gatt_service_android.h" | 13 #include "device/bluetooth/bluetooth_remote_gatt_service_android.h" |
15 #include "jni/ChromeBluetoothDevice_jni.h" | 14 #include "jni/ChromeBluetoothDevice_jni.h" |
16 | 15 |
17 using base::android::AttachCurrentThread; | 16 using base::android::AttachCurrentThread; |
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
255 BluetoothRemoteGattServiceAndroid* service_ptr = service.get(); | 254 BluetoothRemoteGattServiceAndroid* service_ptr = service.get(); |
256 gatt_services_[instance_id_string] = std::move(service); | 255 gatt_services_[instance_id_string] = std::move(service); |
257 | 256 |
258 adapter_->NotifyGattServiceAdded(service_ptr); | 257 adapter_->NotifyGattServiceAdded(service_ptr); |
259 } | 258 } |
260 | 259 |
261 BluetoothDeviceAndroid::BluetoothDeviceAndroid(BluetoothAdapterAndroid* adapter) | 260 BluetoothDeviceAndroid::BluetoothDeviceAndroid(BluetoothAdapterAndroid* adapter) |
262 : BluetoothDevice(adapter) {} | 261 : BluetoothDevice(adapter) {} |
263 | 262 |
264 void BluetoothDeviceAndroid::CreateGattConnectionImpl() { | 263 void BluetoothDeviceAndroid::CreateGattConnectionImpl() { |
265 Java_ChromeBluetoothDevice_createGattConnectionImpl( | 264 Java_ChromeBluetoothDevice_createGattConnectionImpl(AttachCurrentThread(), |
266 AttachCurrentThread(), j_device_, base::android::GetApplicationContext()); | 265 j_device_); |
267 } | 266 } |
268 | 267 |
269 void BluetoothDeviceAndroid::DisconnectGatt() { | 268 void BluetoothDeviceAndroid::DisconnectGatt() { |
270 Java_ChromeBluetoothDevice_disconnectGatt(AttachCurrentThread(), j_device_); | 269 Java_ChromeBluetoothDevice_disconnectGatt(AttachCurrentThread(), j_device_); |
271 } | 270 } |
272 | 271 |
273 } // namespace device | 272 } // namespace device |
OLD | NEW |