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

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

Issue 2826383002: bluetooth: Make in progress errors consistent across android
Patch Set: Fix windows Created 3 years, 8 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 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 #ifndef DEVICE_BLUETOOTH_BLUETOOTH_REMOTE_GATT_CHARACTERISTIC_ANDROID_H_ 5 #ifndef DEVICE_BLUETOOTH_BLUETOOTH_REMOTE_GATT_CHARACTERISTIC_ANDROID_H_
6 #define DEVICE_BLUETOOTH_BLUETOOTH_REMOTE_GATT_CHARACTERISTIC_ANDROID_H_ 6 #define DEVICE_BLUETOOTH_BLUETOOTH_REMOTE_GATT_CHARACTERISTIC_ANDROID_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <memory> 10 #include <memory>
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 // BluetoothRemoteGattCharacteristic interface: 57 // BluetoothRemoteGattCharacteristic interface:
58 std::string GetIdentifier() const override; 58 std::string GetIdentifier() const override;
59 BluetoothUUID GetUUID() const override; 59 BluetoothUUID GetUUID() const override;
60 const std::vector<uint8_t>& GetValue() const override; 60 const std::vector<uint8_t>& GetValue() const override;
61 BluetoothRemoteGattService* GetService() const override; 61 BluetoothRemoteGattService* GetService() const override;
62 Properties GetProperties() const override; 62 Properties GetProperties() const override;
63 Permissions GetPermissions() const override; 63 Permissions GetPermissions() const override;
64 std::vector<BluetoothRemoteGattDescriptor*> GetDescriptors() const override; 64 std::vector<BluetoothRemoteGattDescriptor*> GetDescriptors() const override;
65 BluetoothRemoteGattDescriptor* GetDescriptor( 65 BluetoothRemoteGattDescriptor* GetDescriptor(
66 const std::string& identifier) const override; 66 const std::string& identifier) const override;
67 void ReadRemoteCharacteristic(const ValueCallback& callback, 67 void ReadRemoteCharacteristicImpl(
68 const ErrorCallback& error_callback) override; 68 const ValueCallback& callback,
69 void WriteRemoteCharacteristic(const std::vector<uint8_t>& value, 69 const ErrorCallback& error_callback) override;
70 const base::Closure& callback, 70 void WriteRemoteCharacteristicImpl(
71 const ErrorCallback& error_callback) override; 71 const std::vector<uint8_t>& value,
72 const base::Closure& callback,
73 const ErrorCallback& error_callback) override;
72 74
73 // Called when value changed event occurs. 75 // Called when value changed event occurs.
74 void OnChanged(JNIEnv* env, 76 void OnChanged(JNIEnv* env,
75 const base::android::JavaParamRef<jobject>& jcaller, 77 const base::android::JavaParamRef<jobject>& jcaller,
76 const base::android::JavaParamRef<jbyteArray>& value); 78 const base::android::JavaParamRef<jbyteArray>& value);
77 79
78 // Called when Read operation completes. 80 // Called when Read operation completes.
79 void OnRead(JNIEnv* env, 81 void OnRead(JNIEnv* env,
80 const base::android::JavaParamRef<jobject>& jcaller, 82 const base::android::JavaParamRef<jobject>& jcaller,
81 int32_t status, 83 int32_t status,
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 BluetoothRemoteGattServiceAndroid* service_; 125 BluetoothRemoteGattServiceAndroid* service_;
124 126
125 // Java object 127 // Java object
126 // org.chromium.device.bluetooth.ChromeBluetoothRemoteGattCharacteristic. 128 // org.chromium.device.bluetooth.ChromeBluetoothRemoteGattCharacteristic.
127 base::android::ScopedJavaGlobalRef<jobject> j_characteristic_; 129 base::android::ScopedJavaGlobalRef<jobject> j_characteristic_;
128 130
129 // Adapter unique instance ID. 131 // Adapter unique instance ID.
130 std::string instance_id_; 132 std::string instance_id_;
131 133
132 // ReadRemoteCharacteristic callbacks and pending state. 134 // ReadRemoteCharacteristic callbacks and pending state.
133 bool read_pending_ = false;
134 ValueCallback read_callback_; 135 ValueCallback read_callback_;
135 ErrorCallback read_error_callback_; 136 ErrorCallback read_error_callback_;
136 137
137 // WriteRemoteCharacteristic callbacks and pending state. 138 // WriteRemoteCharacteristic callbacks and pending state.
138 bool write_pending_ = false;
139 base::Closure write_callback_; 139 base::Closure write_callback_;
140 ErrorCallback write_error_callback_; 140 ErrorCallback write_error_callback_;
141 141
142 std::vector<uint8_t> value_; 142 std::vector<uint8_t> value_;
143 143
144 // Map of descriptors, keyed by descriptor identifier. 144 // Map of descriptors, keyed by descriptor identifier.
145 std::unordered_map<std::string, 145 std::unordered_map<std::string,
146 std::unique_ptr<BluetoothRemoteGattDescriptorAndroid>> 146 std::unique_ptr<BluetoothRemoteGattDescriptorAndroid>>
147 descriptors_; 147 descriptors_;
148 148
149 DISALLOW_COPY_AND_ASSIGN(BluetoothRemoteGattCharacteristicAndroid); 149 DISALLOW_COPY_AND_ASSIGN(BluetoothRemoteGattCharacteristicAndroid);
150 }; 150 };
151 151
152 } // namespace device 152 } // namespace device
153 153
154 #endif // DEVICE_BLUETOOTH_BLUETOOTH_REMOTE_GATT_CHARACTERISTIC_ANDROID_H_ 154 #endif // DEVICE_BLUETOOTH_BLUETOOTH_REMOTE_GATT_CHARACTERISTIC_ANDROID_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698