Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(642)

Side by Side Diff: device/bluetooth/bluetooth_remote_gatt_characteristic_android.cc

Issue 2085293002: bluetooth: Call GattCharacteristicValueChanged after a read succeeds (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@my-origin
Patch Set: Use a lambda to check that GattCharacteristicValueChanged has been called Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | device/bluetooth/bluetooth_remote_gatt_characteristic_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 <memory> 7 #include <memory>
8 8
9 #include "base/android/jni_android.h" 9 #include "base/android/jni_android.h"
10 #include "base/android/jni_array.h" 10 #include "base/android/jni_array.h"
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after
277 277
278 // Clear callbacks before calling to avoid reentrancy issues. 278 // Clear callbacks before calling to avoid reentrancy issues.
279 ValueCallback read_callback = read_callback_; 279 ValueCallback read_callback = read_callback_;
280 ErrorCallback read_error_callback = read_error_callback_; 280 ErrorCallback read_error_callback = read_error_callback_;
281 read_callback_.Reset(); 281 read_callback_.Reset();
282 read_error_callback_.Reset(); 282 read_error_callback_.Reset();
283 283
284 if (status == 0 // android.bluetooth.BluetoothGatt.GATT_SUCCESS 284 if (status == 0 // android.bluetooth.BluetoothGatt.GATT_SUCCESS
285 && !read_callback.is_null()) { 285 && !read_callback.is_null()) {
286 base::android::JavaByteArrayToByteVector(env, value, &value_); 286 base::android::JavaByteArrayToByteVector(env, value, &value_);
287 adapter_->NotifyGattCharacteristicValueChanged(this, value_);
287 read_callback.Run(value_); 288 read_callback.Run(value_);
288 // TODO(https://crbug.com/545682): Call GattCharacteristicValueChanged.
289 } else if (!read_error_callback.is_null()) { 289 } else if (!read_error_callback.is_null()) {
290 read_error_callback.Run( 290 read_error_callback.Run(
291 BluetoothRemoteGattServiceAndroid::GetGattErrorCode(status)); 291 BluetoothRemoteGattServiceAndroid::GetGattErrorCode(status));
292 } 292 }
293 } 293 }
294 294
295 void BluetoothRemoteGattCharacteristicAndroid::OnWrite( 295 void BluetoothRemoteGattCharacteristicAndroid::OnWrite(
296 JNIEnv* env, 296 JNIEnv* env,
297 const JavaParamRef<jobject>& jcaller, 297 const JavaParamRef<jobject>& jcaller,
298 int32_t status) { 298 int32_t status) {
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
343 void BluetoothRemoteGattCharacteristicAndroid::EnsureDescriptorsCreated() 343 void BluetoothRemoteGattCharacteristicAndroid::EnsureDescriptorsCreated()
344 const { 344 const {
345 if (!descriptors_.empty()) 345 if (!descriptors_.empty())
346 return; 346 return;
347 347
348 Java_ChromeBluetoothRemoteGattCharacteristic_createDescriptors( 348 Java_ChromeBluetoothRemoteGattCharacteristic_createDescriptors(
349 AttachCurrentThread(), j_characteristic_.obj()); 349 AttachCurrentThread(), j_characteristic_.obj());
350 } 350 }
351 351
352 } // namespace device 352 } // namespace device
OLDNEW
« no previous file with comments | « no previous file | device/bluetooth/bluetooth_remote_gatt_characteristic_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698