OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "device/bluetooth/dbus/fake_bluetooth_gatt_application_service_provider
.h" |
| 6 |
| 7 #include <string> |
| 8 |
| 9 #include "base/logging.h" |
| 10 #include "device/bluetooth/dbus/bluez_dbus_manager.h" |
| 11 #include "device/bluetooth/dbus/fake_bluetooth_gatt_manager_client.h" |
| 12 |
| 13 namespace bluez { |
| 14 |
| 15 FakeBluetoothGattApplicationServiceProvider:: |
| 16 FakeBluetoothGattApplicationServiceProvider( |
| 17 const dbus::ObjectPath& object_path, |
| 18 const std::map<dbus::ObjectPath, BluetoothLocalGattServiceBlueZ*>& |
| 19 services) |
| 20 : object_path_(object_path) { |
| 21 VLOG(1) << "Creating Bluetooth GATT service: " << object_path_.value(); |
| 22 |
| 23 FakeBluetoothGattManagerClient* fake_bluetooth_gatt_manager_client = |
| 24 static_cast<FakeBluetoothGattManagerClient*>( |
| 25 bluez::BluezDBusManager::Get()->GetBluetoothGattManagerClient()); |
| 26 fake_bluetooth_gatt_manager_client->RegisterApplicationServiceProvider(this); |
| 27 |
| 28 BluetoothGattApplicationServiceProvider::CreateAttributeServiceProviders( |
| 29 nullptr, services, &service_providers_, &characteristic_providers_, |
| 30 &descriptor_providers_); |
| 31 } |
| 32 |
| 33 FakeBluetoothGattApplicationServiceProvider:: |
| 34 ~FakeBluetoothGattApplicationServiceProvider() { |
| 35 VLOG(1) << "Cleaning up Bluetooth GATT application: " << object_path_.value(); |
| 36 |
| 37 FakeBluetoothGattManagerClient* fake_bluetooth_gatt_manager_client = |
| 38 static_cast<FakeBluetoothGattManagerClient*>( |
| 39 bluez::BluezDBusManager::Get()->GetBluetoothGattManagerClient()); |
| 40 fake_bluetooth_gatt_manager_client->UnregisterApplicationServiceProvider( |
| 41 this); |
| 42 } |
| 43 |
| 44 } // namespace bluez |
OLD | NEW |