Index: device/bluetooth/dbus/fake_bluetooth_gatt_application_service_provider.cc |
diff --git a/device/bluetooth/dbus/fake_bluetooth_gatt_application_service_provider.cc b/device/bluetooth/dbus/fake_bluetooth_gatt_application_service_provider.cc |
new file mode 100644 |
index 0000000000000000000000000000000000000000..a52491d9f3cb3d513de80bcfb7eff016fd98f5b4 |
--- /dev/null |
+++ b/device/bluetooth/dbus/fake_bluetooth_gatt_application_service_provider.cc |
@@ -0,0 +1,44 @@ |
+// Copyright 2016 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#include "device/bluetooth/dbus/fake_bluetooth_gatt_application_service_provider.h" |
+ |
+#include <string> |
+ |
+#include "base/logging.h" |
+#include "device/bluetooth/dbus/bluez_dbus_manager.h" |
+#include "device/bluetooth/dbus/fake_bluetooth_gatt_manager_client.h" |
+ |
+namespace bluez { |
+ |
+FakeBluetoothGattApplicationServiceProvider:: |
+ FakeBluetoothGattApplicationServiceProvider( |
+ const dbus::ObjectPath& object_path, |
+ const std::map<dbus::ObjectPath, BluetoothLocalGattServiceBlueZ*>& |
+ services) |
+ : object_path_(object_path) { |
+ VLOG(1) << "Creating Bluetooth GATT service: " << object_path_.value(); |
+ |
+ FakeBluetoothGattManagerClient* fake_bluetooth_gatt_manager_client = |
+ static_cast<FakeBluetoothGattManagerClient*>( |
+ bluez::BluezDBusManager::Get()->GetBluetoothGattManagerClient()); |
+ fake_bluetooth_gatt_manager_client->RegisterApplicationServiceProvider(this); |
+ |
+ BluetoothGattApplicationServiceProvider::CreateAttributeServiceProviders( |
+ nullptr, services, &service_providers_, &characteristic_providers_, |
+ &descriptor_providers_); |
+} |
+ |
+FakeBluetoothGattApplicationServiceProvider:: |
+ ~FakeBluetoothGattApplicationServiceProvider() { |
+ VLOG(1) << "Cleaning up Bluetooth GATT application: " << object_path_.value(); |
+ |
+ FakeBluetoothGattManagerClient* fake_bluetooth_gatt_manager_client = |
+ static_cast<FakeBluetoothGattManagerClient*>( |
+ bluez::BluezDBusManager::Get()->GetBluetoothGattManagerClient()); |
+ fake_bluetooth_gatt_manager_client->UnregisterApplicationServiceProvider( |
+ this); |
+} |
+ |
+} // namespace bluez |