| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_service_android.h" | 5 #include "device/bluetooth/bluetooth_remote_gatt_service_android.h" |
| 6 | 6 |
| 7 #include "base/android/jni_android.h" | 7 #include "base/android/jni_android.h" |
| 8 #include "base/android/jni_string.h" | 8 #include "base/android/jni_string.h" |
| 9 #include "device/bluetooth/bluetooth_adapter_android.h" | 9 #include "device/bluetooth/bluetooth_adapter_android.h" |
| 10 #include "device/bluetooth/bluetooth_device_android.h" | 10 #include "device/bluetooth/bluetooth_device_android.h" |
| (...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 185 const JavaParamRef< | 185 const JavaParamRef< |
| 186 jobject>& /* ChromeBluetoothDevice */ chrome_bluetooth_device) { | 186 jobject>& /* ChromeBluetoothDevice */ chrome_bluetooth_device) { |
| 187 std::string instance_id_string = | 187 std::string instance_id_string = |
| 188 base::android::ConvertJavaStringToUTF8(env, instance_id); | 188 base::android::ConvertJavaStringToUTF8(env, instance_id); |
| 189 | 189 |
| 190 DCHECK(!characteristics_.contains(instance_id_string)); | 190 DCHECK(!characteristics_.contains(instance_id_string)); |
| 191 | 191 |
| 192 characteristics_.set( | 192 characteristics_.set( |
| 193 instance_id_string, | 193 instance_id_string, |
| 194 BluetoothRemoteGattCharacteristicAndroid::Create( | 194 BluetoothRemoteGattCharacteristicAndroid::Create( |
| 195 instance_id_string, bluetooth_gatt_characteristic_wrapper, | 195 adapter_, instance_id_string, bluetooth_gatt_characteristic_wrapper, |
| 196 chrome_bluetooth_device)); | 196 chrome_bluetooth_device)); |
| 197 } | 197 } |
| 198 | 198 |
| 199 BluetoothRemoteGattServiceAndroid::BluetoothRemoteGattServiceAndroid( | 199 BluetoothRemoteGattServiceAndroid::BluetoothRemoteGattServiceAndroid( |
| 200 BluetoothAdapterAndroid* adapter, | 200 BluetoothAdapterAndroid* adapter, |
| 201 BluetoothDeviceAndroid* device, | 201 BluetoothDeviceAndroid* device, |
| 202 const std::string& instance_id) | 202 const std::string& instance_id) |
| 203 : adapter_(adapter), device_(device), instance_id_(instance_id) {} | 203 : adapter_(adapter), device_(device), instance_id_(instance_id) {} |
| 204 | 204 |
| 205 void BluetoothRemoteGattServiceAndroid::EnsureCharacteristicsCreated() const { | 205 void BluetoothRemoteGattServiceAndroid::EnsureCharacteristicsCreated() const { |
| 206 if (!characteristics_.empty()) | 206 if (!characteristics_.empty()) |
| 207 return; | 207 return; |
| 208 | 208 |
| 209 // Java call | 209 // Java call |
| 210 Java_ChromeBluetoothRemoteGattService_ensureCharacteristicsCreated( | 210 Java_ChromeBluetoothRemoteGattService_createCharacteristics( |
| 211 AttachCurrentThread(), j_service_.obj()); | 211 AttachCurrentThread(), j_service_.obj()); |
| 212 } | 212 } |
| 213 | 213 |
| 214 } // namespace device | 214 } // namespace device |
| OLD | NEW |