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_agent_service_provider.h"
7 #include "chromeos/dbus/dbus_thread_manager.h"
8 #include "chromeos/dbus/fake_bluetooth_agent_manager_client.h"
9 #include "dbus/object_path.h"
13 FakeBluetoothAgentServiceProvider::FakeBluetoothAgentServiceProvider(
14 const dbus::ObjectPath
& object_path
,
16 : object_path_(object_path
),
18 VLOG(1) << "Creating Bluetooth Agent: " << object_path_
.value();
20 FakeBluetoothAgentManagerClient
* fake_bluetooth_agent_manager_client
=
21 static_cast<FakeBluetoothAgentManagerClient
*>(
22 DBusThreadManager::Get()->
23 GetExperimentalBluetoothAgentManagerClient());
24 fake_bluetooth_agent_manager_client
->RegisterAgentServiceProvider(this);
27 FakeBluetoothAgentServiceProvider::~FakeBluetoothAgentServiceProvider() {
28 VLOG(1) << "Cleaning up Bluetooth Agent: " << object_path_
.value();
30 FakeBluetoothAgentManagerClient
* fake_bluetooth_agent_manager_client
=
31 static_cast<FakeBluetoothAgentManagerClient
*>(
32 DBusThreadManager::Get()->
33 GetExperimentalBluetoothAgentManagerClient());
34 fake_bluetooth_agent_manager_client
->UnregisterAgentServiceProvider(this);
37 void FakeBluetoothAgentServiceProvider::Release() {
38 VLOG(1) << object_path_
.value() << ": Release";
42 void FakeBluetoothAgentServiceProvider::RequestPinCode(
43 const dbus::ObjectPath
& device_path
,
44 const Delegate::PinCodeCallback
& callback
) {
45 VLOG(1) << object_path_
.value() << ": RequestPinCode for "
46 << device_path
.value();
47 delegate_
->RequestPinCode(device_path
, callback
);
50 void FakeBluetoothAgentServiceProvider::DisplayPinCode(
51 const dbus::ObjectPath
& device_path
,
52 const std::string
& pincode
) {
53 VLOG(1) << object_path_
.value() << ": DisplayPincode " << pincode
<< " for "
54 << device_path
.value();
55 delegate_
->DisplayPinCode(device_path
, pincode
);
58 void FakeBluetoothAgentServiceProvider::RequestPasskey(
59 const dbus::ObjectPath
& device_path
,
60 const Delegate::PasskeyCallback
& callback
) {
61 VLOG(1) << object_path_
.value() << ": RequestPasskey for "
62 << device_path
.value();
63 delegate_
->RequestPasskey(device_path
, callback
);
66 void FakeBluetoothAgentServiceProvider::DisplayPasskey(
67 const dbus::ObjectPath
& device_path
,
68 uint32 passkey
, int16 entered
) {
69 VLOG(1) << object_path_
.value() << ": DisplayPasskey " << passkey
70 << " (" << entered
<< " entered) for "<< device_path
.value();
71 delegate_
->DisplayPasskey(device_path
, passkey
, entered
);
74 void FakeBluetoothAgentServiceProvider::RequestConfirmation(
75 const dbus::ObjectPath
& device_path
,
77 const Delegate::ConfirmationCallback
& callback
) {
78 VLOG(1) << object_path_
.value() << ": RequestConfirmation " << passkey
79 << " for "<< device_path
.value();
80 delegate_
->RequestConfirmation(device_path
, passkey
, callback
);
83 void FakeBluetoothAgentServiceProvider::RequestAuthorization(
84 const dbus::ObjectPath
& device_path
,
85 const Delegate::ConfirmationCallback
& callback
) {
86 VLOG(1) << object_path_
.value() << ": RequestAuthorization for "
87 << device_path
.value();
88 delegate_
->RequestAuthorization(device_path
, callback
);
91 void FakeBluetoothAgentServiceProvider::AuthorizeService(
92 const dbus::ObjectPath
& device_path
,
93 const std::string
& uuid
,
94 const Delegate::ConfirmationCallback
& callback
) {
95 VLOG(1) << object_path_
.value() << ": AuthorizeService " << uuid
<< " for "
96 << device_path
.value();
97 delegate_
->AuthorizeService(device_path
, uuid
, callback
);
100 void FakeBluetoothAgentServiceProvider::Cancel() {
101 VLOG(1) << object_path_
.value() << ": Cancel";
105 } // namespace chromeos