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

Side by Side Diff: device/bluetooth/bluez/bluetooth_remote_gatt_characteristic_bluez.h

Issue 2728623004: Fix getting notified twice after subscribe to notifications and call readValue (Closed)
Patch Set: fixed device unittests Created 3 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_BLUEZ_BLUETOOTH_REMOTE_GATT_CHARACTERISTIC_BLUEZ_H_ 5 #ifndef DEVICE_BLUETOOTH_BLUEZ_BLUETOOTH_REMOTE_GATT_CHARACTERISTIC_BLUEZ_H_
6 #define DEVICE_BLUETOOTH_BLUEZ_BLUETOOTH_REMOTE_GATT_CHARACTERISTIC_BLUEZ_H_ 6 #define DEVICE_BLUETOOTH_BLUEZ_BLUETOOTH_REMOTE_GATT_CHARACTERISTIC_BLUEZ_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 #include <map> 10 #include <map>
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 std::vector<device::BluetoothRemoteGattDescriptor*> GetDescriptors() 56 std::vector<device::BluetoothRemoteGattDescriptor*> GetDescriptors()
57 const override; 57 const override;
58 device::BluetoothRemoteGattDescriptor* GetDescriptor( 58 device::BluetoothRemoteGattDescriptor* GetDescriptor(
59 const std::string& identifier) const override; 59 const std::string& identifier) const override;
60 void ReadRemoteCharacteristic(const ValueCallback& callback, 60 void ReadRemoteCharacteristic(const ValueCallback& callback,
61 const ErrorCallback& error_callback) override; 61 const ErrorCallback& error_callback) override;
62 void WriteRemoteCharacteristic(const std::vector<uint8_t>& value, 62 void WriteRemoteCharacteristic(const std::vector<uint8_t>& value,
63 const base::Closure& callback, 63 const base::Closure& callback,
64 const ErrorCallback& error_callback) override; 64 const ErrorCallback& error_callback) override;
65 65
66 bool characteristic_value_read_in_progress() {
67 return characteristic_value_read_in_progress_;
68 }
69
70 void set_characteristic_value_read_in_progress(bool in_progress) {
71 characteristic_value_read_in_progress_ = in_progress;
72 }
73
66 protected: 74 protected:
67 void SubscribeToNotifications( 75 void SubscribeToNotifications(
68 device::BluetoothRemoteGattDescriptor* ccc_descriptor, 76 device::BluetoothRemoteGattDescriptor* ccc_descriptor,
69 const base::Closure& callback, 77 const base::Closure& callback,
70 const ErrorCallback& error_callback) override; 78 const ErrorCallback& error_callback) override;
71 void UnsubscribeFromNotifications( 79 void UnsubscribeFromNotifications(
72 device::BluetoothRemoteGattDescriptor* ccc_descriptor, 80 device::BluetoothRemoteGattDescriptor* ccc_descriptor,
73 const base::Closure& callback, 81 const base::Closure& callback,
74 const ErrorCallback& error_callback) override; 82 const ErrorCallback& error_callback) override;
75 83
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
126 134
127 // Mapping from GATT descriptor object paths to descriptor objects owned by 135 // Mapping from GATT descriptor object paths to descriptor objects owned by
128 // this characteristic. Since the BlueZ implementation uses object paths 136 // this characteristic. Since the BlueZ implementation uses object paths
129 // as unique identifiers, we also use this mapping to return descriptors by 137 // as unique identifiers, we also use this mapping to return descriptors by
130 // identifier. 138 // identifier.
131 DescriptorMap descriptors_; 139 DescriptorMap descriptors_;
132 140
133 // The GATT service this GATT characteristic belongs to. 141 // The GATT service this GATT characteristic belongs to.
134 BluetoothRemoteGattServiceBlueZ* service_; 142 BluetoothRemoteGattServiceBlueZ* service_;
135 143
144 // True if a gatt read request is in progress.
145 bool characteristic_value_read_in_progress_;
146
136 // Note: This should remain the last member so it'll be destroyed and 147 // Note: This should remain the last member so it'll be destroyed and
137 // invalidate its weak pointers before any other members are destroyed. 148 // invalidate its weak pointers before any other members are destroyed.
138 base::WeakPtrFactory<BluetoothRemoteGattCharacteristicBlueZ> 149 base::WeakPtrFactory<BluetoothRemoteGattCharacteristicBlueZ>
139 weak_ptr_factory_; 150 weak_ptr_factory_;
140 151
141 DISALLOW_COPY_AND_ASSIGN(BluetoothRemoteGattCharacteristicBlueZ); 152 DISALLOW_COPY_AND_ASSIGN(BluetoothRemoteGattCharacteristicBlueZ);
142 }; 153 };
143 154
144 } // namespace bluez 155 } // namespace bluez
145 156
146 #endif // DEVICE_BLUETOOTH_BLUEZ_BLUETOOTH_REMOTE_GATT_CHARACTERISTIC_BLUEZ_H_ 157 #endif // DEVICE_BLUETOOTH_BLUEZ_BLUETOOTH_REMOTE_GATT_CHARACTERISTIC_BLUEZ_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698