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

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

Issue 788193004: chromeos/dbus: Update Bluetooth GATT API clients to upstream definition (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase & tbr Created 5 years, 10 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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_CHROMEOS_H_ 5 #ifndef DEVICE_BLUETOOTH_BLUETOOTH_REMOTE_GATT_CHARACTERISTIC_CHROMEOS_H_
6 #define DEVICE_BLUETOOTH_BLUETOOTH_REMOTE_GATT_CHARACTERISTIC_CHROMEOS_H_ 6 #define DEVICE_BLUETOOTH_BLUETOOTH_REMOTE_GATT_CHARACTERISTIC_CHROMEOS_H_
7 7
8 #include <map> 8 #include <map>
9 #include <queue> 9 #include <queue>
10 #include <string> 10 #include <string>
11 #include <utility> 11 #include <utility>
12 #include <vector> 12 #include <vector>
13 13
14 #include "base/memory/weak_ptr.h" 14 #include "base/memory/weak_ptr.h"
15 #include "chromeos/dbus/bluetooth_gatt_characteristic_client.h"
16 #include "chromeos/dbus/bluetooth_gatt_descriptor_client.h" 15 #include "chromeos/dbus/bluetooth_gatt_descriptor_client.h"
17 #include "dbus/object_path.h" 16 #include "dbus/object_path.h"
18 #include "device/bluetooth/bluetooth_gatt_characteristic.h" 17 #include "device/bluetooth/bluetooth_gatt_characteristic.h"
19 #include "device/bluetooth/bluetooth_uuid.h" 18 #include "device/bluetooth/bluetooth_uuid.h"
20 19
21 namespace device { 20 namespace device {
22 21
23 class BluetoothGattDescriptor; 22 class BluetoothGattDescriptor;
24 class BluetoothGattService; 23 class BluetoothGattService;
25 24
26 } // namespace device 25 } // namespace device
27 26
28 namespace chromeos { 27 namespace chromeos {
29 28
30 class BluetoothRemoteGattDescriptorChromeOS; 29 class BluetoothRemoteGattDescriptorChromeOS;
31 class BluetoothRemoteGattServiceChromeOS; 30 class BluetoothRemoteGattServiceChromeOS;
32 31
33 // The BluetoothRemoteGattCharacteristicChromeOS class implements 32 // The BluetoothRemoteGattCharacteristicChromeOS class implements
34 // BluetoothGattCharacteristic for remote GATT characteristics on the Chrome OS 33 // BluetoothGattCharacteristic for remote GATT characteristics on the Chrome OS
35 // platform. 34 // platform.
36 class BluetoothRemoteGattCharacteristicChromeOS 35 class BluetoothRemoteGattCharacteristicChromeOS
37 : public device::BluetoothGattCharacteristic, 36 : public device::BluetoothGattCharacteristic,
38 public BluetoothGattCharacteristicClient::Observer,
39 public BluetoothGattDescriptorClient::Observer { 37 public BluetoothGattDescriptorClient::Observer {
40 public: 38 public:
41 // device::BluetoothGattCharacteristic overrides. 39 // device::BluetoothGattCharacteristic overrides.
42 std::string GetIdentifier() const override; 40 std::string GetIdentifier() const override;
43 device::BluetoothUUID GetUUID() const override; 41 device::BluetoothUUID GetUUID() const override;
44 bool IsLocal() const override; 42 bool IsLocal() const override;
45 const std::vector<uint8>& GetValue() const override; 43 const std::vector<uint8>& GetValue() const override;
46 device::BluetoothGattService* GetService() const override; 44 device::BluetoothGattService* GetService() const override;
47 Properties GetProperties() const override; 45 Properties GetProperties() const override;
48 Permissions GetPermissions() const override; 46 Permissions GetPermissions() const override;
(...skipping 21 matching lines...) Expand all
70 const dbus::ObjectPath& object_path() const { return object_path_; } 68 const dbus::ObjectPath& object_path() const { return object_path_; }
71 69
72 private: 70 private:
73 friend class BluetoothRemoteGattServiceChromeOS; 71 friend class BluetoothRemoteGattServiceChromeOS;
74 72
75 BluetoothRemoteGattCharacteristicChromeOS( 73 BluetoothRemoteGattCharacteristicChromeOS(
76 BluetoothRemoteGattServiceChromeOS* service, 74 BluetoothRemoteGattServiceChromeOS* service,
77 const dbus::ObjectPath& object_path); 75 const dbus::ObjectPath& object_path);
78 ~BluetoothRemoteGattCharacteristicChromeOS() override; 76 ~BluetoothRemoteGattCharacteristicChromeOS() override;
79 77
80 // BluetoothGattCharacteristicClient::Observer overrides.
81 void GattCharacteristicValueUpdated(const dbus::ObjectPath& object_path,
82 const std::vector<uint8>& value) override;
83
84 // BluetoothGattDescriptorClient::Observer overrides. 78 // BluetoothGattDescriptorClient::Observer overrides.
85 void GattDescriptorAdded(const dbus::ObjectPath& object_path) override; 79 void GattDescriptorAdded(const dbus::ObjectPath& object_path) override;
86 void GattDescriptorRemoved(const dbus::ObjectPath& object_path) override; 80 void GattDescriptorRemoved(const dbus::ObjectPath& object_path) override;
87 81 void GattDescriptorPropertyChanged(const dbus::ObjectPath& object_path,
88 // Called by dbus:: on successful completion of a request to read 82 const std::string& property_name) override;
89 // the characteristic value.
90 void OnValueSuccess(const ValueCallback& callback,
91 const std::vector<uint8>& value);
92 83
93 // Called by dbus:: on unsuccessful completion of a request to read or write 84 // Called by dbus:: on unsuccessful completion of a request to read or write
94 // the characteristic value. 85 // the characteristic value.
95 void OnError(const ErrorCallback& error_callback, 86 void OnError(const ErrorCallback& error_callback,
96 const std::string& error_name, 87 const std::string& error_name,
97 const std::string& error_message); 88 const std::string& error_message);
98 89
99 // Called by dbus:: on successful completion of a request to start 90 // Called by dbus:: on successful completion of a request to start
100 // notifications. 91 // notifications.
101 void OnStartNotifySuccess(const NotifySessionCallback& callback); 92 void OnStartNotifySuccess(const NotifySessionCallback& callback);
(...skipping 16 matching lines...) Expand all
118 109
119 // Calls StartNotifySession for each queued request. 110 // Calls StartNotifySession for each queued request.
120 void ProcessStartNotifyQueue(); 111 void ProcessStartNotifyQueue();
121 112
122 // Object path of the D-Bus characteristic object. 113 // Object path of the D-Bus characteristic object.
123 dbus::ObjectPath object_path_; 114 dbus::ObjectPath object_path_;
124 115
125 // The GATT service this GATT characteristic belongs to. 116 // The GATT service this GATT characteristic belongs to.
126 BluetoothRemoteGattServiceChromeOS* service_; 117 BluetoothRemoteGattServiceChromeOS* service_;
127 118
128 // The cached characteristic value based on the most recent read or
129 // notification.
130 std::vector<uint8> cached_value_;
131
132 // The total number of currently active value update sessions. 119 // The total number of currently active value update sessions.
133 size_t num_notify_sessions_; 120 size_t num_notify_sessions_;
134 121
135 // Calls to StartNotifySession that are pending. This can happen during the 122 // Calls to StartNotifySession that are pending. This can happen during the
136 // first remote call to start notifications. 123 // first remote call to start notifications.
137 typedef std::pair<NotifySessionCallback, ErrorCallback> 124 typedef std::pair<NotifySessionCallback, ErrorCallback>
138 PendingStartNotifyCall; 125 PendingStartNotifyCall;
139 std::queue<PendingStartNotifyCall> pending_start_notify_calls_; 126 std::queue<PendingStartNotifyCall> pending_start_notify_calls_;
140 127
141 // True, if a Start or Stop notify call to bluetoothd is currently pending. 128 // True, if a Start or Stop notify call to bluetoothd is currently pending.
(...skipping 11 matching lines...) Expand all
153 // invalidate its weak pointers before any other members are destroyed. 140 // invalidate its weak pointers before any other members are destroyed.
154 base::WeakPtrFactory<BluetoothRemoteGattCharacteristicChromeOS> 141 base::WeakPtrFactory<BluetoothRemoteGattCharacteristicChromeOS>
155 weak_ptr_factory_; 142 weak_ptr_factory_;
156 143
157 DISALLOW_COPY_AND_ASSIGN(BluetoothRemoteGattCharacteristicChromeOS); 144 DISALLOW_COPY_AND_ASSIGN(BluetoothRemoteGattCharacteristicChromeOS);
158 }; 145 };
159 146
160 } // namespace chromeos 147 } // namespace chromeos
161 148
162 #endif // DEVICE_BLUETOOTH_BLUETOOTH_REMOTE_GATT_CHARACTERISTIC_CHROMEOS_H_ 149 #endif // DEVICE_BLUETOOTH_BLUETOOTH_REMOTE_GATT_CHARACTERISTIC_CHROMEOS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698