| OLD | NEW |
| 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_SERVICE_SERVICE_PROVIDER_IMPL_H_ | 5 #ifndef DEVICE_BLUETOOTH_DBUS_BLUETOOTH_GATT_SERVICE_SERVICE_PROVIDER_IMPL_H_ |
| 6 #define DEVICE_BLUETOOTH_DBUS_BLUETOOTH_GATT_SERVICE_SERVICE_PROVIDER_IMPL_H_ | 6 #define DEVICE_BLUETOOTH_DBUS_BLUETOOTH_GATT_SERVICE_SERVICE_PROVIDER_IMPL_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 namespace bluez { | 21 namespace bluez { |
| 22 | 22 |
| 23 // The BluetoothGattServiceServiceProvider implementation used in production. | 23 // The BluetoothGattServiceServiceProvider implementation used in production. |
| 24 class DEVICE_BLUETOOTH_EXPORT BluetoothGattServiceServiceProviderImpl | 24 class DEVICE_BLUETOOTH_EXPORT BluetoothGattServiceServiceProviderImpl |
| 25 : public BluetoothGattServiceServiceProvider { | 25 : public BluetoothGattServiceServiceProvider { |
| 26 public: | 26 public: |
| 27 BluetoothGattServiceServiceProviderImpl( | 27 BluetoothGattServiceServiceProviderImpl( |
| 28 dbus::Bus* bus, | 28 dbus::Bus* bus, |
| 29 const dbus::ObjectPath& object_path, | 29 const dbus::ObjectPath& object_path, |
| 30 const std::string& uuid, | 30 const std::string& uuid, |
| 31 bool is_primary, |
| 31 const std::vector<dbus::ObjectPath>& includes); | 32 const std::vector<dbus::ObjectPath>& includes); |
| 32 | 33 |
| 33 ~BluetoothGattServiceServiceProviderImpl() override; | 34 ~BluetoothGattServiceServiceProviderImpl() override; |
| 34 | 35 |
| 35 // For testing. | 36 // For testing. |
| 36 BluetoothGattServiceServiceProviderImpl(const dbus::ObjectPath& object_path, | 37 BluetoothGattServiceServiceProviderImpl(const dbus::ObjectPath& object_path, |
| 37 const std::string& uuid); | 38 const std::string& uuid, |
| 39 bool is_primary); |
| 38 | 40 |
| 39 private: | 41 private: |
| 40 // Returns true if the current thread is on the origin thread. | 42 // Returns true if the current thread is on the origin thread. |
| 41 bool OnOriginThread(); | 43 bool OnOriginThread(); |
| 42 | 44 |
| 43 // 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 |
| 44 // the service. | 46 // the service. |
| 45 void Get(dbus::MethodCall* method_call, | 47 void Get(dbus::MethodCall* method_call, |
| 46 dbus::ExportedObject::ResponseSender response_sender); | 48 dbus::ExportedObject::ResponseSender response_sender); |
| 47 | 49 |
| (...skipping 15 matching lines...) Expand all Loading... |
| 63 bool success); | 65 bool success); |
| 64 | 66 |
| 65 const dbus::ObjectPath& object_path() const override; | 67 const dbus::ObjectPath& object_path() const override; |
| 66 | 68 |
| 67 // Origin thread (i.e. the UI thread in production). | 69 // Origin thread (i.e. the UI thread in production). |
| 68 base::PlatformThreadId origin_thread_id_; | 70 base::PlatformThreadId origin_thread_id_; |
| 69 | 71 |
| 70 // 128-bit service UUID of this object. | 72 // 128-bit service UUID of this object. |
| 71 std::string uuid_; | 73 std::string uuid_; |
| 72 | 74 |
| 75 // Flag indicating that this is a primary service. |
| 76 bool is_primary_; |
| 77 |
| 73 // List of object paths that represent other exported GATT services that are | 78 // List of object paths that represent other exported GATT services that are |
| 74 // included from this service. | 79 // included from this service. |
| 75 std::vector<dbus::ObjectPath> includes_; | 80 std::vector<dbus::ObjectPath> includes_; |
| 76 | 81 |
| 77 // D-Bus bus object is exported on, not owned by this object and must | 82 // D-Bus bus object is exported on, not owned by this object and must |
| 78 // outlive it. | 83 // outlive it. |
| 79 dbus::Bus* bus_; | 84 dbus::Bus* bus_; |
| 80 | 85 |
| 81 // D-Bus object path of object we are exporting, kept so we can unregister | 86 // D-Bus object path of object we are exporting, kept so we can unregister |
| 82 // again in our destructor. | 87 // again in our destructor. |
| 83 dbus::ObjectPath object_path_; | 88 dbus::ObjectPath object_path_; |
| 84 | 89 |
| 85 // D-Bus object we are exporting, owned by this object. | 90 // D-Bus object we are exporting, owned by this object. |
| 86 scoped_refptr<dbus::ExportedObject> exported_object_; | 91 scoped_refptr<dbus::ExportedObject> exported_object_; |
| 87 | 92 |
| 88 // Weak pointer factory for generating 'this' pointers that might live longer | 93 // Weak pointer factory for generating 'this' pointers that might live longer |
| 89 // than we do. | 94 // than we do. |
| 90 // Note: This should remain the last member so it'll be destroyed and | 95 // Note: This should remain the last member so it'll be destroyed and |
| 91 // invalidate its weak pointers before any other members are destroyed. | 96 // invalidate its weak pointers before any other members are destroyed. |
| 92 base::WeakPtrFactory<BluetoothGattServiceServiceProviderImpl> | 97 base::WeakPtrFactory<BluetoothGattServiceServiceProviderImpl> |
| 93 weak_ptr_factory_; | 98 weak_ptr_factory_; |
| 94 | 99 |
| 95 DISALLOW_COPY_AND_ASSIGN(BluetoothGattServiceServiceProviderImpl); | 100 DISALLOW_COPY_AND_ASSIGN(BluetoothGattServiceServiceProviderImpl); |
| 96 }; | 101 }; |
| 97 | 102 |
| 98 } // namespace bluez | 103 } // namespace bluez |
| 99 | 104 |
| 100 #endif // DEVICE_BLUETOOTH_DBUS_BLUETOOTH_GATT_SERVICE_SERVICE_PROVIDER_IMPL_H_ | 105 #endif // DEVICE_BLUETOOTH_DBUS_BLUETOOTH_GATT_SERVICE_SERVICE_PROVIDER_IMPL_H_ |
| OLD | NEW |