| 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 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 124 const jstring& instanceId, | 124 const jstring& instanceId, |
| 125 jobject /* BluetoothGattCharacteristicWrapper */ | 125 jobject /* BluetoothGattCharacteristicWrapper */ |
| 126 bluetooth_gatt_characteristic_wrapper) { | 126 bluetooth_gatt_characteristic_wrapper) { |
| 127 std::string instanceIdString = | 127 std::string instanceIdString = |
| 128 base::android::ConvertJavaStringToUTF8(env, instanceId); | 128 base::android::ConvertJavaStringToUTF8(env, instanceId); |
| 129 | 129 |
| 130 DCHECK(!characteristics_.contains(instanceIdString)); | 130 DCHECK(!characteristics_.contains(instanceIdString)); |
| 131 | 131 |
| 132 characteristics_.set( | 132 characteristics_.set( |
| 133 instanceIdString, | 133 instanceIdString, |
| 134 BluetoothRemoteGattCharacteristicAndroid::Create(instanceIdString)); | 134 BluetoothRemoteGattCharacteristicAndroid::Create( |
| 135 instanceIdString, bluetooth_gatt_characteristic_wrapper)); |
| 135 } | 136 } |
| 136 | 137 |
| 137 BluetoothRemoteGattServiceAndroid::BluetoothRemoteGattServiceAndroid( | 138 BluetoothRemoteGattServiceAndroid::BluetoothRemoteGattServiceAndroid( |
| 138 BluetoothAdapterAndroid* adapter, | 139 BluetoothAdapterAndroid* adapter, |
| 139 BluetoothDeviceAndroid* device, | 140 BluetoothDeviceAndroid* device, |
| 140 const std::string& instanceId) | 141 const std::string& instanceId) |
| 141 : adapter_(adapter), device_(device), instanceId_(instanceId) {} | 142 : adapter_(adapter), device_(device), instanceId_(instanceId) {} |
| 142 | 143 |
| 143 void BluetoothRemoteGattServiceAndroid::EnsureCharacteristicsCreated() const { | 144 void BluetoothRemoteGattServiceAndroid::EnsureCharacteristicsCreated() const { |
| 144 if (!characteristics_.empty()) | 145 if (!characteristics_.empty()) |
| 145 return; | 146 return; |
| 146 | 147 |
| 147 // Java call | 148 // Java call |
| 148 Java_ChromeBluetoothRemoteGattService_ensureCharacteristicsCreated( | 149 Java_ChromeBluetoothRemoteGattService_ensureCharacteristicsCreated( |
| 149 AttachCurrentThread(), j_service_.obj()); | 150 AttachCurrentThread(), j_service_.obj()); |
| 150 } | 151 } |
| 151 | 152 |
| 152 } // namespace device | 153 } // namespace device |
| OLD | NEW |