| 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_remote_gatt_characteristic_android.h" | 5 #include "device/bluetooth/bluetooth_remote_gatt_characteristic_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 "base/bind.h" | 10 #include "base/bind.h" |
| 11 #include "base/logging.h" | 11 #include "base/logging.h" |
| 12 #include "base/message_loop/message_loop.h" | 12 #include "base/message_loop/message_loop.h" |
| 13 #include "device/bluetooth/bluetooth_gatt_notify_session_android.h" | 13 #include "device/bluetooth/bluetooth_gatt_notify_session_android.h" |
| 14 #include "device/bluetooth/bluetooth_remote_gatt_service_android.h" | 14 #include "device/bluetooth/bluetooth_remote_gatt_service_android.h" |
| 15 #include "jni/ChromeBluetoothRemoteGattCharacteristic_jni.h" | 15 #include "jni/ChromeBluetoothRemoteGattCharacteristic_jni.h" |
| 16 | 16 |
| 17 using base::android::AttachCurrentThread; | 17 using base::android::AttachCurrentThread; |
| 18 | 18 |
| 19 namespace device { | 19 namespace device { |
| 20 | 20 |
| 21 // static | 21 // static |
| 22 scoped_ptr<BluetoothRemoteGattCharacteristicAndroid> | 22 scoped_ptr<BluetoothRemoteGattCharacteristicAndroid> |
| 23 BluetoothRemoteGattCharacteristicAndroid::Create( | 23 BluetoothRemoteGattCharacteristicAndroid::Create( |
| 24 const std::string& instanceId, | 24 const std::string& instance_id, |
| 25 jobject /* BluetoothGattCharacteristicWrapper */ | 25 jobject /* BluetoothGattCharacteristicWrapper */ |
| 26 bluetooth_gatt_characteristic_wrapper, | 26 bluetooth_gatt_characteristic_wrapper, |
| 27 jobject /* ChromeBluetoothDevice */ chrome_bluetooth_device) { | 27 jobject /* ChromeBluetoothDevice */ chrome_bluetooth_device) { |
| 28 scoped_ptr<BluetoothRemoteGattCharacteristicAndroid> characteristic( | 28 scoped_ptr<BluetoothRemoteGattCharacteristicAndroid> characteristic( |
| 29 new BluetoothRemoteGattCharacteristicAndroid(instanceId)); | 29 new BluetoothRemoteGattCharacteristicAndroid(instance_id)); |
| 30 | 30 |
| 31 characteristic->j_characteristic_.Reset( | 31 characteristic->j_characteristic_.Reset( |
| 32 Java_ChromeBluetoothRemoteGattCharacteristic_create( | 32 Java_ChromeBluetoothRemoteGattCharacteristic_create( |
| 33 AttachCurrentThread(), | 33 AttachCurrentThread(), |
| 34 reinterpret_cast<intptr_t>(characteristic.get()), | 34 reinterpret_cast<intptr_t>(characteristic.get()), |
| 35 bluetooth_gatt_characteristic_wrapper, chrome_bluetooth_device)); | 35 bluetooth_gatt_characteristic_wrapper, chrome_bluetooth_device)); |
| 36 | 36 |
| 37 return characteristic; | 37 return characteristic; |
| 38 } | 38 } |
| 39 | 39 |
| (...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 229 if (status == 0 // android.bluetooth.BluetoothGatt.GATT_SUCCESS | 229 if (status == 0 // android.bluetooth.BluetoothGatt.GATT_SUCCESS |
| 230 && !write_callback.is_null()) { | 230 && !write_callback.is_null()) { |
| 231 write_callback.Run(); | 231 write_callback.Run(); |
| 232 } else if (!write_error_callback.is_null()) { | 232 } else if (!write_error_callback.is_null()) { |
| 233 write_error_callback.Run( | 233 write_error_callback.Run( |
| 234 BluetoothRemoteGattServiceAndroid::GetGattErrorCode(status)); | 234 BluetoothRemoteGattServiceAndroid::GetGattErrorCode(status)); |
| 235 } | 235 } |
| 236 } | 236 } |
| 237 | 237 |
| 238 BluetoothRemoteGattCharacteristicAndroid:: | 238 BluetoothRemoteGattCharacteristicAndroid:: |
| 239 BluetoothRemoteGattCharacteristicAndroid(const std::string& instanceId) | 239 BluetoothRemoteGattCharacteristicAndroid(const std::string& instance_id) |
| 240 : instance_id_(instanceId) {} | 240 : instance_id_(instance_id) {} |
| 241 | 241 |
| 242 } // namespace device | 242 } // namespace device |
| OLD | NEW |