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

Side by Side Diff: chromeos/dbus/bluetooth_gatt_characteristic_client.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
« no previous file with comments | « no previous file | chromeos/dbus/bluetooth_gatt_characteristic_client.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 CHROMEOS_DBUS_BLUETOOTH_GATT_CHARACTERISTIC_CLIENT_H_ 5 #ifndef CHROMEOS_DBUS_BLUETOOTH_GATT_CHARACTERISTIC_CLIENT_H_
6 #define CHROMEOS_DBUS_BLUETOOTH_GATT_CHARACTERISTIC_CLIENT_H_ 6 #define CHROMEOS_DBUS_BLUETOOTH_GATT_CHARACTERISTIC_CLIENT_H_
7 7
8 #include <string> 8 #include <string>
9 #include <vector>
9 10
10 #include "base/basictypes.h" 11 #include "base/basictypes.h"
11 #include "base/callback.h" 12 #include "base/callback.h"
12 #include "chromeos/chromeos_export.h" 13 #include "chromeos/chromeos_export.h"
13 #include "chromeos/dbus/dbus_client.h" 14 #include "chromeos/dbus/dbus_client.h"
14 #include "dbus/object_path.h" 15 #include "dbus/object_path.h"
15 #include "dbus/property.h" 16 #include "dbus/property.h"
16 17
17 namespace chromeos { 18 namespace chromeos {
18 19
19 // BluetoothGattCharacteristicClient is used to communicate with remote GATT 20 // BluetoothGattCharacteristicClient is used to communicate with remote GATT
20 // characteristic objects exposed by the Bluetooth daemon. 21 // characteristic objects exposed by the Bluetooth daemon.
21 class CHROMEOS_EXPORT BluetoothGattCharacteristicClient : public DBusClient { 22 class CHROMEOS_EXPORT BluetoothGattCharacteristicClient : public DBusClient {
22 public: 23 public:
23 // Structure of properties associated with GATT characteristics. 24 // Structure of properties associated with GATT characteristics.
24 struct Properties : public dbus::PropertySet { 25 struct Properties : public dbus::PropertySet {
25 // The 128-bit characteristic UUID. [read-only] 26 // The 128-bit characteristic UUID. [read-only]
26 dbus::Property<std::string> uuid; 27 dbus::Property<std::string> uuid;
27 28
28 // Object path of the GATT service the characteristic belongs to. 29 // Object path of the GATT service the characteristic belongs to.
29 // [read-only] 30 // [read-only]
30 dbus::Property<dbus::ObjectPath> service; 31 dbus::Property<dbus::ObjectPath> service;
31 32
33 // The cached value of the characteristic. This property gets updated only
34 // after a successful read request and when a notification or indication is
35 // received. [read-only]
36 dbus::Property<std::vector<uint8_t>> value;
37
32 // Whether or not this characteristic is currently sending ValueUpdated 38 // Whether or not this characteristic is currently sending ValueUpdated
33 // signals. [read-only] 39 // signals. [read-only]
34 dbus::Property<bool> notifying; 40 dbus::Property<bool> notifying;
35 41
36 // List of flags representing the GATT "Characteristic Properties bit field" 42 // List of flags representing the GATT "Characteristic Properties bit field"
37 // and properties read from the GATT "Characteristic Extended Properties" 43 // and properties read from the GATT "Characteristic Extended Properties"
38 // descriptor bit field. [read-only, optional] 44 // descriptor bit field. [read-only, optional]
39 dbus::Property<std::vector<std::string> > flags; 45 dbus::Property<std::vector<std::string>> flags;
40 46
41 // Array of object paths representing the descriptors of this 47 // Array of object paths representing the descriptors of this
42 // characteristic. [read-only] 48 // characteristic. [read-only]
43 dbus::Property<std::vector<dbus::ObjectPath> > descriptors; 49 dbus::Property<std::vector<dbus::ObjectPath>> descriptors;
44 50
45 Properties(dbus::ObjectProxy* object_proxy, 51 Properties(dbus::ObjectProxy* object_proxy,
46 const std::string& interface_name, 52 const std::string& interface_name,
47 const PropertyChangedCallback& callback); 53 const PropertyChangedCallback& callback);
48 ~Properties() override; 54 ~Properties() override;
49 }; 55 };
50 56
51 // Interface for observing changes from a remote GATT characteristic. 57 // Interface for observing changes from a remote GATT characteristic.
52 class Observer { 58 class Observer {
53 public: 59 public:
54 virtual ~Observer() {} 60 virtual ~Observer() {}
55 61
56 // Called when the GATT characteristic with object path |object_path| is 62 // Called when the GATT characteristic with object path |object_path| is
57 // added to the system. 63 // added to the system.
58 virtual void GattCharacteristicAdded(const dbus::ObjectPath& object_path) {} 64 virtual void GattCharacteristicAdded(const dbus::ObjectPath& object_path) {}
59 65
60 // Called when the GATT characteristic with object path |object_path| is 66 // Called when the GATT characteristic with object path |object_path| is
61 // removed from the system. 67 // removed from the system.
62 virtual void GattCharacteristicRemoved( 68 virtual void GattCharacteristicRemoved(
63 const dbus::ObjectPath& object_path) {} 69 const dbus::ObjectPath& object_path) {}
64 70
65 // Called when the GATT characteristic with object path |object_path| has a 71 // Called when the GATT characteristic with object path |object_path| has a
66 // change in the value of the property named |property_name|. 72 // change in the value of the property named |property_name|.
67 virtual void GattCharacteristicPropertyChanged( 73 virtual void GattCharacteristicPropertyChanged(
68 const dbus::ObjectPath& object_path, 74 const dbus::ObjectPath& object_path,
69 const std::string& property_name) {} 75 const std::string& property_name) {}
70
71 // Called when a "ValueUpdated" signal is received from the remote GATT
72 // characteristic with object path |object_path| with characteristic value
73 // |value|.
74 virtual void GattCharacteristicValueUpdated(
75 const dbus::ObjectPath& object_path,
76 const std::vector<uint8>& value) {}
77 }; 76 };
78 77
79 // Callbacks used to report the result of asynchronous methods. 78 // Callbacks used to report the result of asynchronous methods.
80 typedef base::Callback<void(const std::string& error_name, 79 typedef base::Callback<void(const std::string& error_name,
81 const std::string& error_message)> ErrorCallback; 80 const std::string& error_message)> ErrorCallback;
82 typedef base::Callback<void(const std::vector<uint8>& value)> ValueCallback; 81 typedef base::Callback<void(const std::vector<uint8>& value)> ValueCallback;
83 82
84 ~BluetoothGattCharacteristicClient() override; 83 ~BluetoothGattCharacteristicClient() override;
85 84
86 // Adds and removes observers for events on all remote GATT characteristics. 85 // Adds and removes observers for events on all remote GATT characteristics.
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 protected: 134 protected:
136 BluetoothGattCharacteristicClient(); 135 BluetoothGattCharacteristicClient();
137 136
138 private: 137 private:
139 DISALLOW_COPY_AND_ASSIGN(BluetoothGattCharacteristicClient); 138 DISALLOW_COPY_AND_ASSIGN(BluetoothGattCharacteristicClient);
140 }; 139 };
141 140
142 } // namespace chromeos 141 } // namespace chromeos
143 142
144 #endif // CHROMEOS_DBUS_BLUETOOTH_GATT_CHARACTERISTIC_CLIENT_H_ 143 #endif // CHROMEOS_DBUS_BLUETOOTH_GATT_CHARACTERISTIC_CLIENT_H_
OLDNEW
« no previous file with comments | « no previous file | chromeos/dbus/bluetooth_gatt_characteristic_client.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698