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

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

Issue 1974633002: Implement DBus changes needed for notifications. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
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_APPLICATION_SERVICE_PROVIDER_IMPL_H _ 5 #ifndef DEVICE_BLUETOOTH_DBUS_BLUETOOTH_GATT_APPLICATION_SERVICE_PROVIDER_IMPL_H _
6 #define DEVICE_BLUETOOTH_DBUS_BLUETOOTH_GATT_APPLICATION_SERVICE_PROVIDER_IMPL_H _ 6 #define DEVICE_BLUETOOTH_DBUS_BLUETOOTH_GATT_APPLICATION_SERVICE_PROVIDER_IMPL_H _
7 7
8 #include <map> 8 #include <map>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
(...skipping 15 matching lines...) Expand all
26 26
27 namespace bluez { 27 namespace bluez {
28 28
29 class BluetoothLocalGattServiceBlueZ; 29 class BluetoothLocalGattServiceBlueZ;
30 30
31 // The BluetoothGattApplicationServiceProvider implementation used in 31 // The BluetoothGattApplicationServiceProvider implementation used in
32 // production. 32 // production.
33 class DEVICE_BLUETOOTH_EXPORT BluetoothGattApplicationServiceProviderImpl 33 class DEVICE_BLUETOOTH_EXPORT BluetoothGattApplicationServiceProviderImpl
34 : public BluetoothGattApplicationServiceProvider { 34 : public BluetoothGattApplicationServiceProvider {
35 public: 35 public:
36 // Use nullptr for |bus| to create for testing.
36 BluetoothGattApplicationServiceProviderImpl( 37 BluetoothGattApplicationServiceProviderImpl(
37 dbus::Bus* bus, 38 dbus::Bus* bus,
38 const dbus::ObjectPath& object_path, 39 const dbus::ObjectPath& object_path,
39 const std::map<dbus::ObjectPath, BluetoothLocalGattServiceBlueZ*>& 40 const std::map<dbus::ObjectPath, BluetoothLocalGattServiceBlueZ*>&
40 services); 41 services);
41 ~BluetoothGattApplicationServiceProviderImpl() override; 42 ~BluetoothGattApplicationServiceProviderImpl() override;
42 43
43 // For testing.
44 BluetoothGattApplicationServiceProviderImpl(
45 const dbus::ObjectPath& object_path);
46
47 private: 44 private:
48 friend class BluetoothGattApplicationServiceProviderTest; 45 friend class BluetoothGattApplicationServiceProviderTest;
49 FRIEND_TEST_ALL_PREFIXES(BluetoothGattApplicationServiceProviderTest, 46 FRIEND_TEST_ALL_PREFIXES(BluetoothGattApplicationServiceProviderTest,
50 GetManagedObjects); 47 GetManagedObjects);
51 48
52 // Returns true if the current thread is on the origin thread. 49 // Returns true if the current thread is on the origin thread.
53 bool OnOriginThread(); 50 bool OnOriginThread();
54 51
55 template <typename Attribute> 52 template <typename Attribute>
56 void WriteObjectDict(dbus::MessageWriter* writer, 53 void WriteObjectDict(dbus::MessageWriter* writer,
(...skipping 20 matching lines...) Expand all
77 dbus::ExportedObject::ResponseSender response_sender); 74 dbus::ExportedObject::ResponseSender response_sender);
78 75
79 // Called by dbus:: when a method is exported. 76 // Called by dbus:: when a method is exported.
80 void OnExported(const std::string& interface_name, 77 void OnExported(const std::string& interface_name,
81 const std::string& method_name, 78 const std::string& method_name,
82 bool success); 79 bool success);
83 80
84 // Origin thread (i.e. the UI thread in production). 81 // Origin thread (i.e. the UI thread in production).
85 base::PlatformThreadId origin_thread_id_; 82 base::PlatformThreadId origin_thread_id_;
86 83
87 // List of GATT Service service providers managed by this object manager.
88 std::vector<std::unique_ptr<BluetoothGattServiceServiceProvider>>
89 service_providers_;
90 // List of GATT Characteristic service providers managed by this object
91 // manager.
92 std::vector<std::unique_ptr<BluetoothGattCharacteristicServiceProvider>>
93 characteristic_providers_;
94 // List of GATT Descriptor service providers managed by this object manager.
95 std::vector<std::unique_ptr<BluetoothGattDescriptorServiceProvider>>
96 descriptor_providers_;
97
98 // D-Bus bus object is exported on, not owned by this object and must 84 // D-Bus bus object is exported on, not owned by this object and must
99 // outlive it. 85 // outlive it.
100 dbus::Bus* bus_; 86 dbus::Bus* bus_;
101 87
102 // D-Bus object path of object we are exporting, kept so we can unregister 88 // D-Bus object path of object we are exporting, kept so we can unregister
103 // again in our destructor. 89 // again in our destructor.
104 dbus::ObjectPath object_path_; 90 dbus::ObjectPath object_path_;
105 91
106 // D-Bus object we are exporting, owned by this object. 92 // D-Bus object we are exporting, owned by this object.
107 scoped_refptr<dbus::ExportedObject> exported_object_; 93 scoped_refptr<dbus::ExportedObject> exported_object_;
108 94
109 // Weak pointer factory for generating 'this' pointers that might live longer 95 // Weak pointer factory for generating 'this' pointers that might live longer
110 // than we do. 96 // than we do.
111 // Note: This should remain the last member so it'll be destroyed and 97 // Note: This should remain the last member so it'll be destroyed and
112 // invalidate its weak pointers before any other members are destroyed. 98 // invalidate its weak pointers before any other members are destroyed.
113 base::WeakPtrFactory<BluetoothGattApplicationServiceProviderImpl> 99 base::WeakPtrFactory<BluetoothGattApplicationServiceProviderImpl>
114 weak_ptr_factory_; 100 weak_ptr_factory_;
115 101
116 DISALLOW_COPY_AND_ASSIGN(BluetoothGattApplicationServiceProviderImpl); 102 DISALLOW_COPY_AND_ASSIGN(BluetoothGattApplicationServiceProviderImpl);
117 }; 103 };
118 104
119 } // namespace bluez 105 } // namespace bluez
120 106
121 #endif // DEVICE_BLUETOOTH_DBUS_BLUETOOTH_GATT_APPLICATION_SERVICE_PROVIDER_IMP L_H_ 107 #endif // DEVICE_BLUETOOTH_DBUS_BLUETOOTH_GATT_APPLICATION_SERVICE_PROVIDER_IMP L_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698