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

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

Issue 2051333004: Implement BluetoothGattNotifySession::Stop on Android, 2nd attempt (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address new review comments Created 4 years, 4 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>
11 #include <queue> 11 #include <queue>
12 #include <string> 12 #include <string>
13 #include <utility> 13 #include <utility>
14 #include <vector> 14 #include <vector>
15 15
16 #include "base/callback_forward.h" 16 #include "base/callback_forward.h"
17 #include "base/macros.h" 17 #include "base/macros.h"
18 #include "base/memory/weak_ptr.h" 18 #include "base/memory/weak_ptr.h"
19 #include "dbus/object_path.h" 19 #include "dbus/object_path.h"
20 #include "device/bluetooth/bluetooth_gatt_characteristic.h" 20 #include "device/bluetooth/bluetooth_remote_gatt_characteristic.h"
21 #include "device/bluetooth/bluetooth_remote_gatt_service.h" 21 #include "device/bluetooth/bluetooth_remote_gatt_service.h"
22 #include "device/bluetooth/bluetooth_uuid.h" 22 #include "device/bluetooth/bluetooth_uuid.h"
23 #include "device/bluetooth/bluez/bluetooth_gatt_characteristic_bluez.h" 23 #include "device/bluetooth/bluez/bluetooth_gatt_characteristic_bluez.h"
24 #include "device/bluetooth/dbus/bluetooth_gatt_descriptor_client.h" 24 #include "device/bluetooth/dbus/bluetooth_gatt_descriptor_client.h"
25 25
26 namespace device { 26 namespace device {
27 27
28 class BluetoothRemoteGattDescriptor; 28 class BluetoothRemoteGattDescriptor;
29 class BluetoothRemoteGattService; 29 class BluetoothRemoteGattService;
30 30
(...skipping 21 matching lines...) Expand all
52 // device::BluetoothRemoteGattCharacteristic overrides. 52 // device::BluetoothRemoteGattCharacteristic overrides.
53 const std::vector<uint8_t>& GetValue() const override; 53 const std::vector<uint8_t>& GetValue() const override;
54 device::BluetoothRemoteGattService* GetService() const override; 54 device::BluetoothRemoteGattService* GetService() const override;
55 bool IsNotifying() const override; 55 bool IsNotifying() const override;
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 StartNotifySession(const NotifySessionCallback& callback, 60 void StartNotifySession(const NotifySessionCallback& callback,
61 const ErrorCallback& error_callback) override; 61 const ErrorCallback& error_callback) override;
62 // Removes one value update session and invokes |callback| on completion. This
63 // decrements the session reference count by 1 and if the number reaches 0,
64 // makes a call to the subsystem to stop notifications from this
65 // characteristic.
66 void StopNotifySession(device::BluetoothGattNotifySession* session,
67 const base::Closure& callback) override;
62 void ReadRemoteCharacteristic(const ValueCallback& callback, 68 void ReadRemoteCharacteristic(const ValueCallback& callback,
63 const ErrorCallback& error_callback) override; 69 const ErrorCallback& error_callback) override;
64 void WriteRemoteCharacteristic(const std::vector<uint8_t>& new_value, 70 void WriteRemoteCharacteristic(const std::vector<uint8_t>& new_value,
65 const base::Closure& callback, 71 const base::Closure& callback,
66 const ErrorCallback& error_callback) override; 72 const ErrorCallback& error_callback) override;
67 73
68 // Removes one value update session and invokes |callback| on completion. This 74 protected:
69 // decrements the session reference count by 1 and if the number reaches 0, 75 void SubscribeToNotifications(
70 // makes a call to the subsystem to stop notifications from this 76 device::BluetoothRemoteGattDescriptor* ccc_descriptor,
71 // characteristic. 77 const base::Closure& callback,
72 void RemoveNotifySession(const base::Closure& callback); 78 const ErrorCallback& error_callback) override;
79 void UnsubscribeFromNotifications(
80 device::BluetoothRemoteGattDescriptor* ccc_descriptor,
81 const base::Closure& callback,
82 const ErrorCallback& error_callback) override;
73 83
74 private: 84 private:
75 friend class BluetoothRemoteGattServiceBlueZ; 85 friend class BluetoothRemoteGattServiceBlueZ;
76 86
77 using PendingStartNotifyCall = 87 using PendingStartNotifyCall =
78 std::pair<NotifySessionCallback, ErrorCallback>; 88 std::pair<NotifySessionCallback, ErrorCallback>;
79 89
80 BluetoothRemoteGattCharacteristicBlueZ( 90 BluetoothRemoteGattCharacteristicBlueZ(
81 BluetoothRemoteGattServiceBlueZ* service, 91 BluetoothRemoteGattServiceBlueZ* service,
82 const dbus::ObjectPath& object_path); 92 const dbus::ObjectPath& object_path);
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 // invalidate its weak pointers before any other members are destroyed. 155 // invalidate its weak pointers before any other members are destroyed.
146 base::WeakPtrFactory<BluetoothRemoteGattCharacteristicBlueZ> 156 base::WeakPtrFactory<BluetoothRemoteGattCharacteristicBlueZ>
147 weak_ptr_factory_; 157 weak_ptr_factory_;
148 158
149 DISALLOW_COPY_AND_ASSIGN(BluetoothRemoteGattCharacteristicBlueZ); 159 DISALLOW_COPY_AND_ASSIGN(BluetoothRemoteGattCharacteristicBlueZ);
150 }; 160 };
151 161
152 } // namespace bluez 162 } // namespace bluez
153 163
154 #endif // DEVICE_BLUETOOTH_BLUEZ_BLUETOOTH_REMOTE_GATT_CHARACTERISTIC_BLUEZ_H_ 164 #endif // DEVICE_BLUETOOTH_BLUEZ_BLUETOOTH_REMOTE_GATT_CHARACTERISTIC_BLUEZ_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698