1 // Copyright 2014 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 "chromeos/dbus/fake_bluetooth_gatt_service_service_provider.h" 6 7 #include "base/logging.h" 8 #include "chromeos/dbus/dbus_thread_manager.h" 9 #include "chromeos/dbus/fake_bluetooth_gatt_manager_client.h" 10 11 namespace chromeos { 12 13 FakeBluetoothGattServiceServiceProvider:: 14 FakeBluetoothGattServiceServiceProvider( 15 const dbus::ObjectPath& object_path, 16 const std::string& uuid, 17 const std::vector<dbus::ObjectPath>& includes) 18 : object_path_(object_path), 19 uuid_(uuid), 20 includes_(includes) { 21 VLOG(1) << "Creating Bluetooth GATT service: " << object_path_.value(); 22 23 FakeBluetoothGattManagerClient* fake_bluetooth_gatt_manager_client = 24 static_cast<FakeBluetoothGattManagerClient*>( 25 DBusThreadManager::Get()->GetBluetoothGattManagerClient()); 26 fake_bluetooth_gatt_manager_client->RegisterServiceServiceProvider(this); 27 } 28 29 FakeBluetoothGattServiceServiceProvider:: 30 ~FakeBluetoothGattServiceServiceProvider() { 31 VLOG(1) << "Cleaning up Bluetooth GATT service: " << object_path_.value(); 32 33 FakeBluetoothGattManagerClient* fake_bluetooth_gatt_manager_client = 34 static_cast<FakeBluetoothGattManagerClient*>( 35 DBusThreadManager::Get()->GetBluetoothGattManagerClient()); 36 fake_bluetooth_gatt_manager_client->UnregisterServiceServiceProvider(this); 37 } 38 39 } // namespace chromeos 40