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

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

Issue 1779083002: bluetooth: Test & make StartNotifySession reentrant. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@bta-notify-followup-descriptors-
Patch Set: addressed ortuno 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 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 <queue>
11
12 #include "base/android/jni_android.h" 10 #include "base/android/jni_android.h"
13 #include "base/containers/scoped_ptr_hash_map.h" 11 #include "base/containers/scoped_ptr_hash_map.h"
14 #include "base/macros.h" 12 #include "base/macros.h"
15 #include "device/bluetooth/bluetooth_gatt_characteristic.h" 13 #include "device/bluetooth/bluetooth_gatt_characteristic.h"
16 14
17 namespace device { 15 namespace device {
18 16
19 class BluetoothAdapterAndroid; 17 class BluetoothAdapterAndroid;
20 class BluetoothRemoteGattDescriptorAndroid; 18 class BluetoothRemoteGattDescriptorAndroid;
21 class BluetoothRemoteGattServiceAndroid; 19 class BluetoothRemoteGattServiceAndroid;
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 // Java object 125 // Java object
128 // org.chromium.device.bluetooth.ChromeBluetoothRemoteGattCharacteristic. 126 // org.chromium.device.bluetooth.ChromeBluetoothRemoteGattCharacteristic.
129 base::android::ScopedJavaGlobalRef<jobject> j_characteristic_; 127 base::android::ScopedJavaGlobalRef<jobject> j_characteristic_;
130 128
131 // Adapter unique instance ID. 129 // Adapter unique instance ID.
132 std::string instance_id_; 130 std::string instance_id_;
133 131
134 // StartNotifySession callbacks and pending state. 132 // StartNotifySession callbacks and pending state.
135 typedef std::pair<NotifySessionCallback, ErrorCallback> 133 typedef std::pair<NotifySessionCallback, ErrorCallback>
136 PendingStartNotifyCall; 134 PendingStartNotifyCall;
137 std::queue<PendingStartNotifyCall> pending_start_notify_calls_; 135 std::vector<PendingStartNotifyCall> pending_start_notify_calls_;
138 136
139 // ReadRemoteCharacteristic callbacks and pending state. 137 // ReadRemoteCharacteristic callbacks and pending state.
140 bool read_pending_ = false; 138 bool read_pending_ = false;
141 ValueCallback read_callback_; 139 ValueCallback read_callback_;
142 ErrorCallback read_error_callback_; 140 ErrorCallback read_error_callback_;
143 141
144 // WriteRemoteCharacteristic callbacks and pending state. 142 // WriteRemoteCharacteristic callbacks and pending state.
145 bool write_pending_ = false; 143 bool write_pending_ = false;
146 base::Closure write_callback_; 144 base::Closure write_callback_;
147 ErrorCallback write_error_callback_; 145 ErrorCallback write_error_callback_;
148 146
149 std::vector<uint8_t> value_; 147 std::vector<uint8_t> value_;
150 148
151 // Map of descriptors, keyed by descriptor identifier. 149 // Map of descriptors, keyed by descriptor identifier.
152 base::ScopedPtrHashMap<std::string, 150 base::ScopedPtrHashMap<std::string,
153 scoped_ptr<BluetoothRemoteGattDescriptorAndroid>> 151 scoped_ptr<BluetoothRemoteGattDescriptorAndroid>>
154 descriptors_; 152 descriptors_;
155 153
156 DISALLOW_COPY_AND_ASSIGN(BluetoothRemoteGattCharacteristicAndroid); 154 DISALLOW_COPY_AND_ASSIGN(BluetoothRemoteGattCharacteristicAndroid);
157 }; 155 };
158 156
159 } // namespace device 157 } // namespace device
160 158
161 #endif // DEVICE_BLUETOOTH_BLUETOOTH_REMOTE_GATT_CHARACTERISTIC_ANDROID_H_ 159 #endif // DEVICE_BLUETOOTH_BLUETOOTH_REMOTE_GATT_CHARACTERISTIC_ANDROID_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698