| 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 |
| 11 #include <base/macros.h> | 11 #include "base/macros.h" |
| 12 #include <base/memory/ref_counted.h> | 12 #include "base/memory/ref_counted.h" |
| 13 #include <base/memory/weak_ptr.h> | 13 #include "base/memory/weak_ptr.h" |
| 14 #include <base/threading/platform_thread.h> | 14 #include "base/threading/platform_thread.h" |
| 15 #include <dbus/bus.h> | 15 #include "dbus/bus.h" |
| 16 #include <dbus/exported_object.h> | 16 #include "dbus/exported_object.h" |
| 17 #include <dbus/message.h> | 17 #include "dbus/message.h" |
| 18 #include <dbus/object_path.h> | 18 #include "dbus/object_path.h" |
| 19 #include <device/bluetooth/dbus/bluetooth_gatt_service_service_provider.h> | 19 #include "device/bluetooth/bluetooth_export.h" |
| 20 #include "device/bluetooth/dbus/bluetooth_gatt_service_service_provider.h" |
| 20 | 21 |
| 21 namespace bluez { | 22 namespace bluez { |
| 22 | 23 |
| 23 // The BluetoothGattServiceServiceProvider implementation used in production. | 24 // The BluetoothGattServiceServiceProvider implementation used in production. |
| 24 class DEVICE_BLUETOOTH_EXPORT BluetoothGattServiceServiceProviderImpl | 25 class DEVICE_BLUETOOTH_EXPORT BluetoothGattServiceServiceProviderImpl |
| 25 : public BluetoothGattServiceServiceProvider { | 26 : public BluetoothGattServiceServiceProvider { |
| 26 public: | 27 public: |
| 27 BluetoothGattServiceServiceProviderImpl( | 28 BluetoothGattServiceServiceProviderImpl( |
| 28 dbus::Bus* bus, | 29 dbus::Bus* bus, |
| 29 const dbus::ObjectPath& object_path, | 30 const dbus::ObjectPath& object_path, |
| 30 const std::string& uuid, | 31 const std::string& uuid, |
| 31 bool is_primary, | 32 bool is_primary, |
| 32 const std::vector<dbus::ObjectPath>& includes); | 33 const std::vector<dbus::ObjectPath>& includes); |
| 33 | 34 |
| 34 ~BluetoothGattServiceServiceProviderImpl() override; | 35 ~BluetoothGattServiceServiceProviderImpl() override; |
| 35 | 36 |
| 36 // For testing. | |
| 37 BluetoothGattServiceServiceProviderImpl(const dbus::ObjectPath& object_path, | |
| 38 const std::string& uuid, | |
| 39 bool is_primary); | |
| 40 | |
| 41 private: | 37 private: |
| 42 // Returns true if the current thread is on the origin thread. | 38 // Returns true if the current thread is on the origin thread. |
| 43 bool OnOriginThread(); | 39 bool OnOriginThread(); |
| 44 | 40 |
| 45 // Called by dbus:: when the Bluetooth daemon fetches a single property of | 41 // Called by dbus:: when the Bluetooth daemon fetches a single property of |
| 46 // the service. | 42 // the service. |
| 47 void Get(dbus::MethodCall* method_call, | 43 void Get(dbus::MethodCall* method_call, |
| 48 dbus::ExportedObject::ResponseSender response_sender); | 44 dbus::ExportedObject::ResponseSender response_sender); |
| 49 | 45 |
| 50 // Called by dbus:: when the Bluetooth daemon sets a single property of the | 46 // Called by dbus:: when the Bluetooth daemon sets a single property of the |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 96 // invalidate its weak pointers before any other members are destroyed. | 92 // invalidate its weak pointers before any other members are destroyed. |
| 97 base::WeakPtrFactory<BluetoothGattServiceServiceProviderImpl> | 93 base::WeakPtrFactory<BluetoothGattServiceServiceProviderImpl> |
| 98 weak_ptr_factory_; | 94 weak_ptr_factory_; |
| 99 | 95 |
| 100 DISALLOW_COPY_AND_ASSIGN(BluetoothGattServiceServiceProviderImpl); | 96 DISALLOW_COPY_AND_ASSIGN(BluetoothGattServiceServiceProviderImpl); |
| 101 }; | 97 }; |
| 102 | 98 |
| 103 } // namespace bluez | 99 } // namespace bluez |
| 104 | 100 |
| 105 #endif // DEVICE_BLUETOOTH_DBUS_BLUETOOTH_GATT_SERVICE_SERVICE_PROVIDER_IMPL_H_ | 101 #endif // DEVICE_BLUETOOTH_DBUS_BLUETOOTH_GATT_SERVICE_SERVICE_PROVIDER_IMPL_H_ |
| OLD | NEW |