1 // Copyright (c) 2013 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.
5 #include "chromeos/dbus/fake_bluetooth_profile_service_provider.h"
7 #include "chromeos/dbus/dbus_thread_manager.h"
8 #include "chromeos/dbus/fake_bluetooth_profile_manager_client.h"
9 #include "dbus/object_path.h"
13 FakeBluetoothProfileServiceProvider::FakeBluetoothProfileServiceProvider(
14 const dbus::ObjectPath
& object_path
,
16 : object_path_(object_path
),
18 VLOG(1) << "Creating Bluetooth Profile: " << object_path_
.value();
20 FakeBluetoothProfileManagerClient
* fake_bluetooth_profile_manager_client
=
21 static_cast<FakeBluetoothProfileManagerClient
*>(
22 DBusThreadManager::Get()->GetBluetoothProfileManagerClient());
23 fake_bluetooth_profile_manager_client
->RegisterProfileServiceProvider(this);
26 FakeBluetoothProfileServiceProvider::~FakeBluetoothProfileServiceProvider() {
27 VLOG(1) << "Cleaning up Bluetooth Profile: " << object_path_
.value();
29 FakeBluetoothProfileManagerClient
* fake_bluetooth_profile_manager_client
=
30 static_cast<FakeBluetoothProfileManagerClient
*>(
31 DBusThreadManager::Get()->GetBluetoothProfileManagerClient());
32 fake_bluetooth_profile_manager_client
->UnregisterProfileServiceProvider(this);
35 void FakeBluetoothProfileServiceProvider::Release() {
36 VLOG(1) << object_path_
.value() << ": Release";
37 delegate_
->Released();
40 void FakeBluetoothProfileServiceProvider::NewConnection(
41 const dbus::ObjectPath
& device_path
,
42 scoped_ptr
<dbus::FileDescriptor
> fd
,
43 const Delegate::Options
& options
,
44 const Delegate::ConfirmationCallback
& callback
) {
45 VLOG(1) << object_path_
.value() << ": NewConnection for "
46 << device_path
.value();
47 delegate_
->NewConnection(device_path
, fd
.Pass(), options
, callback
);
50 void FakeBluetoothProfileServiceProvider::RequestDisconnection(
51 const dbus::ObjectPath
& device_path
,
52 const Delegate::ConfirmationCallback
& callback
) {
53 VLOG(1) << object_path_
.value() << ": RequestDisconnection for "
54 << device_path
.value();
55 delegate_
->RequestDisconnection(device_path
, callback
);
58 void FakeBluetoothProfileServiceProvider::Cancel() {
59 VLOG(1) << object_path_
.value() << ": Cancel";
63 } // namespace chromeos