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