| 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/jni_android.h" | 7 #include "base/android/jni_android.h" |
| 8 #include "base/android/jni_array.h" | 8 #include "base/android/jni_array.h" |
| 9 #include "base/android/jni_string.h" | 9 #include "base/android/jni_string.h" |
| 10 #include "device/bluetooth/bluetooth_adapter_android.h" |
| 10 #include "jni/ChromeBluetoothDevice_jni.h" | 11 #include "jni/ChromeBluetoothDevice_jni.h" |
| 11 | 12 |
| 12 using base::android::AttachCurrentThread; | 13 using base::android::AttachCurrentThread; |
| 13 using base::android::AppendJavaStringArrayToStringVector; | 14 using base::android::AppendJavaStringArrayToStringVector; |
| 14 | 15 |
| 15 namespace device { | 16 namespace device { |
| 16 | 17 |
| 17 BluetoothDeviceAndroid* BluetoothDeviceAndroid::Create( | 18 BluetoothDeviceAndroid* BluetoothDeviceAndroid::Create( |
| 19 BluetoothAdapterAndroid* adapter, |
| 18 jobject bluetooth_device_wrapper) { // Java Type: bluetoothDeviceWrapper | 20 jobject bluetooth_device_wrapper) { // Java Type: bluetoothDeviceWrapper |
| 19 BluetoothDeviceAndroid* device = new BluetoothDeviceAndroid(); | 21 BluetoothDeviceAndroid* device = new BluetoothDeviceAndroid(adapter); |
| 20 | 22 |
| 21 device->j_device_.Reset(Java_ChromeBluetoothDevice_create( | 23 device->j_device_.Reset(Java_ChromeBluetoothDevice_create( |
| 22 AttachCurrentThread(), bluetooth_device_wrapper)); | 24 AttachCurrentThread(), bluetooth_device_wrapper)); |
| 23 | 25 |
| 24 return device; | 26 return device; |
| 25 } | 27 } |
| 26 | 28 |
| 27 BluetoothDeviceAndroid::~BluetoothDeviceAndroid() { | 29 BluetoothDeviceAndroid::~BluetoothDeviceAndroid() { |
| 28 } | 30 } |
| 29 | 31 |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 182 const ConnectToServiceErrorCallback& error_callback) { | 184 const ConnectToServiceErrorCallback& error_callback) { |
| 183 NOTIMPLEMENTED(); | 185 NOTIMPLEMENTED(); |
| 184 } | 186 } |
| 185 | 187 |
| 186 void BluetoothDeviceAndroid::CreateGattConnection( | 188 void BluetoothDeviceAndroid::CreateGattConnection( |
| 187 const GattConnectionCallback& callback, | 189 const GattConnectionCallback& callback, |
| 188 const ConnectErrorCallback& error_callback) { | 190 const ConnectErrorCallback& error_callback) { |
| 189 NOTIMPLEMENTED(); | 191 NOTIMPLEMENTED(); |
| 190 } | 192 } |
| 191 | 193 |
| 192 BluetoothDeviceAndroid::BluetoothDeviceAndroid() { | 194 BluetoothDeviceAndroid::BluetoothDeviceAndroid(BluetoothAdapterAndroid* adapter) |
| 193 } | 195 : BluetoothDevice(adapter) {} |
| 194 | 196 |
| 195 std::string BluetoothDeviceAndroid::GetDeviceName() const { | 197 std::string BluetoothDeviceAndroid::GetDeviceName() const { |
| 196 return ConvertJavaStringToUTF8(Java_ChromeBluetoothDevice_getDeviceName( | 198 return ConvertJavaStringToUTF8(Java_ChromeBluetoothDevice_getDeviceName( |
| 197 AttachCurrentThread(), j_device_.obj())); | 199 AttachCurrentThread(), j_device_.obj())); |
| 198 } | 200 } |
| 199 | 201 |
| 200 } // namespace device | 202 } // namespace device |
| OLD | NEW |