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

Side by Side Diff: device/bluetooth/bluetooth_remote_gatt_descriptor_android.h

Issue 1712593002: bluetooth: android: Confirm the notify session after the descriptor has been written. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address Vincent's comments Created 4 years, 9 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
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 #ifndef DEVICE_BLUETOOTH_BLUETOOTH_REMOTE_GATT_DESCRIPTOR_ANDROID_H_ 5 #ifndef DEVICE_BLUETOOTH_BLUETOOTH_REMOTE_GATT_DESCRIPTOR_ANDROID_H_
6 #define DEVICE_BLUETOOTH_BLUETOOTH_REMOTE_GATT_DESCRIPTOR_ANDROID_H_ 6 #define DEVICE_BLUETOOTH_BLUETOOTH_REMOTE_GATT_DESCRIPTOR_ANDROID_H_
7 7
8 #include "base/android/jni_android.h" 8 #include "base/android/jni_android.h"
9 #include "base/macros.h" 9 #include "base/macros.h"
10 #include "device/bluetooth/bluetooth_gatt_descriptor.h" 10 #include "device/bluetooth/bluetooth_gatt_descriptor.h"
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 bool IsLocal() const override; 43 bool IsLocal() const override;
44 const std::vector<uint8_t>& GetValue() const override; 44 const std::vector<uint8_t>& GetValue() const override;
45 BluetoothGattCharacteristic* GetCharacteristic() const override; 45 BluetoothGattCharacteristic* GetCharacteristic() const override;
46 BluetoothGattCharacteristic::Permissions GetPermissions() const override; 46 BluetoothGattCharacteristic::Permissions GetPermissions() const override;
47 void ReadRemoteDescriptor(const ValueCallback& callback, 47 void ReadRemoteDescriptor(const ValueCallback& callback,
48 const ErrorCallback& error_callback) override; 48 const ErrorCallback& error_callback) override;
49 void WriteRemoteDescriptor(const std::vector<uint8_t>& new_value, 49 void WriteRemoteDescriptor(const std::vector<uint8_t>& new_value,
50 const base::Closure& callback, 50 const base::Closure& callback,
51 const ErrorCallback& error_callback) override; 51 const ErrorCallback& error_callback) override;
52 52
53 // Called when Read operation completes.
54 void OnRead(JNIEnv* env,
55 const base::android::JavaParamRef<jobject>& jcaller,
56 int32_t status,
57 const base::android::JavaParamRef<jbyteArray>& value);
58
59 // Called when Write operation completes.
60 void OnWrite(JNIEnv* env,
61 const base::android::JavaParamRef<jobject>& jcaller,
62 int32_t status);
63
53 private: 64 private:
54 BluetoothRemoteGattDescriptorAndroid(const std::string& instanceId); 65 BluetoothRemoteGattDescriptorAndroid(const std::string& instanceId);
55 66
56 // Java object 67 // Java object
57 // org.chromium.device.bluetooth.ChromeBluetoothRemoteGattDescriptor. 68 // org.chromium.device.bluetooth.ChromeBluetoothRemoteGattDescriptor.
58 base::android::ScopedJavaGlobalRef<jobject> j_descriptor_; 69 base::android::ScopedJavaGlobalRef<jobject> j_descriptor_;
59 70
60 // Adapter unique instance ID. 71 // Adapter unique instance ID.
61 std::string instance_id_; 72 std::string instance_id_;
62 73
74 // ReadRemoteCharacteristic callbacks and pending state.
75 bool read_pending_ = false;
76 ValueCallback read_callback_;
77 ErrorCallback read_error_callback_;
78
79 // WriteRemoteCharacteristic callbacks and pending state.
80 bool write_pending_ = false;
81 base::Closure write_callback_;
82 ErrorCallback write_error_callback_;
83
84 std::vector<uint8_t> value_;
85
63 DISALLOW_COPY_AND_ASSIGN(BluetoothRemoteGattDescriptorAndroid); 86 DISALLOW_COPY_AND_ASSIGN(BluetoothRemoteGattDescriptorAndroid);
64 }; 87 };
65 88
66 } // namespace device 89 } // namespace device
67 90
68 #endif // DEVICE_BLUETOOTH_BLUETOOTH_REMOTE_GATT_DESCRIPTOR_ANDROID_H_ 91 #endif // DEVICE_BLUETOOTH_BLUETOOTH_REMOTE_GATT_DESCRIPTOR_ANDROID_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698