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

Side by Side Diff: device/bluetooth/dbus/bluetooth_gatt_descriptor_service_provider_impl.h

Issue 1954643002: DBus support for attribute properties and permissions. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@register_and_events
Patch Set: Created 4 years, 7 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_DBUS_BLUETOOTH_GATT_DESCRIPTOR_SERVICE_PROVIDER_IMPL_H_ 5 #ifndef DEVICE_BLUETOOTH_DBUS_BLUETOOTH_GATT_DESCRIPTOR_SERVICE_PROVIDER_IMPL_H_
6 #define DEVICE_BLUETOOTH_DBUS_BLUETOOTH_GATT_DESCRIPTOR_SERVICE_PROVIDER_IMPL_H_ 6 #define DEVICE_BLUETOOTH_DBUS_BLUETOOTH_GATT_DESCRIPTOR_SERVICE_PROVIDER_IMPL_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
(...skipping 13 matching lines...) Expand all
24 24
25 // The BluetoothGattDescriptorServiceProvider implementation used in production. 25 // The BluetoothGattDescriptorServiceProvider implementation used in production.
26 class DEVICE_BLUETOOTH_EXPORT BluetoothGattDescriptorServiceProviderImpl 26 class DEVICE_BLUETOOTH_EXPORT BluetoothGattDescriptorServiceProviderImpl
27 : public BluetoothGattDescriptorServiceProvider { 27 : public BluetoothGattDescriptorServiceProvider {
28 public: 28 public:
29 BluetoothGattDescriptorServiceProviderImpl( 29 BluetoothGattDescriptorServiceProviderImpl(
30 dbus::Bus* bus, 30 dbus::Bus* bus,
31 const dbus::ObjectPath& object_path, 31 const dbus::ObjectPath& object_path,
32 std::unique_ptr<BluetoothGattAttributeValueDelegate> delegate, 32 std::unique_ptr<BluetoothGattAttributeValueDelegate> delegate,
33 const std::string& uuid, 33 const std::string& uuid,
34 const std::vector<std::string>& permissions, 34 const std::vector<std::string>& flags,
35 const dbus::ObjectPath& characteristic_path); 35 const dbus::ObjectPath& characteristic_path);
36 ~BluetoothGattDescriptorServiceProviderImpl() override; 36 ~BluetoothGattDescriptorServiceProviderImpl() override;
37 37
38 // For testing.
39 BluetoothGattDescriptorServiceProviderImpl(
40 const dbus::ObjectPath& object_path,
41 const std::string& uuid,
42 const dbus::ObjectPath& characteristic_path);
43
44 // BluetoothGattDescriptorServiceProvider override. 38 // BluetoothGattDescriptorServiceProvider override.
45 void SendValueChanged(const std::vector<uint8_t>& value) override; 39 void SendValueChanged(const std::vector<uint8_t>& value) override;
46 40
47 private: 41 private:
48 // Returns true if the current thread is on the origin thread. 42 // Returns true if the current thread is on the origin thread.
49 bool OnOriginThread(); 43 bool OnOriginThread();
50 44
51 // Called by dbus:: when the Bluetooth daemon fetches a single property of 45 // Called by dbus:: when the Bluetooth daemon fetches a single property of
52 // the descriptor. 46 // the descriptor.
53 void Get(dbus::MethodCall* method_call, 47 void Get(dbus::MethodCall* method_call,
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 dbus::ExportedObject::ResponseSender response_sender); 92 dbus::ExportedObject::ResponseSender response_sender);
99 93
100 const dbus::ObjectPath& object_path() const override; 94 const dbus::ObjectPath& object_path() const override;
101 95
102 // Origin thread (i.e. the UI thread in production). 96 // Origin thread (i.e. the UI thread in production).
103 base::PlatformThreadId origin_thread_id_; 97 base::PlatformThreadId origin_thread_id_;
104 98
105 // 128-bit descriptor UUID of this object. 99 // 128-bit descriptor UUID of this object.
106 std::string uuid_; 100 std::string uuid_;
107 101
102 // Permissions for this descriptor.
103 std::vector<std::string> flags_;
104
108 // D-Bus bus object is exported on, not owned by this object and must 105 // D-Bus bus object is exported on, not owned by this object and must
109 // outlive it. 106 // outlive it.
110 dbus::Bus* bus_; 107 dbus::Bus* bus_;
111 108
112 // Incoming methods to get and set the "Value" property are passed on to the 109 // Incoming methods to get and set the "Value" property are passed on to the
113 // delegate and callbacks passed to generate a reply. |delegate_| is generally 110 // delegate and callbacks passed to generate a reply. |delegate_| is generally
114 // the object that owns this one and must outlive it. 111 // the object that owns this one and must outlive it.
115 std::unique_ptr<BluetoothGattAttributeValueDelegate> delegate_; 112 std::unique_ptr<BluetoothGattAttributeValueDelegate> delegate_;
116 113
117 // D-Bus object path of object we are exporting, kept so we can unregister 114 // D-Bus object path of object we are exporting, kept so we can unregister
(...skipping 13 matching lines...) Expand all
131 // invalidate its weak pointers before any other members are destroyed. 128 // invalidate its weak pointers before any other members are destroyed.
132 base::WeakPtrFactory<BluetoothGattDescriptorServiceProviderImpl> 129 base::WeakPtrFactory<BluetoothGattDescriptorServiceProviderImpl>
133 weak_ptr_factory_; 130 weak_ptr_factory_;
134 131
135 DISALLOW_COPY_AND_ASSIGN(BluetoothGattDescriptorServiceProviderImpl); 132 DISALLOW_COPY_AND_ASSIGN(BluetoothGattDescriptorServiceProviderImpl);
136 }; 133 };
137 134
138 } // namespace bluez 135 } // namespace bluez
139 136
140 #endif // DEVICE_BLUETOOTH_DBUS_BLUETOOTH_GATT_DESCRIPTOR_SERVICE_PROVIDER_IMPL _H_ 137 #endif // DEVICE_BLUETOOTH_DBUS_BLUETOOTH_GATT_DESCRIPTOR_SERVICE_PROVIDER_IMPL _H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698