OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 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 | 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 "chromeos/dbus/fake_bluetooth_agent_service_provider.h" | 5 #include "device/bluetooth/dbus/fake_bluetooth_agent_service_provider.h" |
6 | 6 |
7 #include "chromeos/dbus/dbus_thread_manager.h" | 7 #include "device/bluetooth/dbus/bluez_dbus_manager.h" |
8 #include "chromeos/dbus/fake_bluetooth_agent_manager_client.h" | 8 #include "device/bluetooth/dbus/fake_bluetooth_agent_manager_client.h" |
9 | 9 |
10 namespace chromeos { | 10 namespace bluez { |
11 | 11 |
12 FakeBluetoothAgentServiceProvider::FakeBluetoothAgentServiceProvider( | 12 FakeBluetoothAgentServiceProvider::FakeBluetoothAgentServiceProvider( |
13 const dbus::ObjectPath& object_path, | 13 const dbus::ObjectPath& object_path, |
14 Delegate* delegate) | 14 Delegate* delegate) |
15 : object_path_(object_path), | 15 : object_path_(object_path), delegate_(delegate) { |
16 delegate_(delegate) { | |
17 VLOG(1) << "Creating Bluetooth Agent: " << object_path_.value(); | 16 VLOG(1) << "Creating Bluetooth Agent: " << object_path_.value(); |
18 | 17 |
19 FakeBluetoothAgentManagerClient* fake_bluetooth_agent_manager_client = | 18 FakeBluetoothAgentManagerClient* fake_bluetooth_agent_manager_client = |
20 static_cast<FakeBluetoothAgentManagerClient*>( | 19 static_cast<FakeBluetoothAgentManagerClient*>( |
21 DBusThreadManager::Get()->GetBluetoothAgentManagerClient()); | 20 bluez::BluezDBusManager::Get()->GetBluetoothAgentManagerClient()); |
22 fake_bluetooth_agent_manager_client->RegisterAgentServiceProvider(this); | 21 fake_bluetooth_agent_manager_client->RegisterAgentServiceProvider(this); |
23 } | 22 } |
24 | 23 |
25 FakeBluetoothAgentServiceProvider::~FakeBluetoothAgentServiceProvider() { | 24 FakeBluetoothAgentServiceProvider::~FakeBluetoothAgentServiceProvider() { |
26 VLOG(1) << "Cleaning up Bluetooth Agent: " << object_path_.value(); | 25 VLOG(1) << "Cleaning up Bluetooth Agent: " << object_path_.value(); |
27 | 26 |
28 FakeBluetoothAgentManagerClient* fake_bluetooth_agent_manager_client = | 27 FakeBluetoothAgentManagerClient* fake_bluetooth_agent_manager_client = |
29 static_cast<FakeBluetoothAgentManagerClient*>( | 28 static_cast<FakeBluetoothAgentManagerClient*>( |
30 DBusThreadManager::Get()->GetBluetoothAgentManagerClient()); | 29 bluez::BluezDBusManager::Get()->GetBluetoothAgentManagerClient()); |
31 fake_bluetooth_agent_manager_client->UnregisterAgentServiceProvider(this); | 30 fake_bluetooth_agent_manager_client->UnregisterAgentServiceProvider(this); |
32 } | 31 } |
33 | 32 |
34 void FakeBluetoothAgentServiceProvider::Release() { | 33 void FakeBluetoothAgentServiceProvider::Release() { |
35 VLOG(1) << object_path_.value() << ": Release"; | 34 VLOG(1) << object_path_.value() << ": Release"; |
36 delegate_->Released(); | 35 delegate_->Released(); |
37 } | 36 } |
38 | 37 |
39 void FakeBluetoothAgentServiceProvider::RequestPinCode( | 38 void FakeBluetoothAgentServiceProvider::RequestPinCode( |
40 const dbus::ObjectPath& device_path, | 39 const dbus::ObjectPath& device_path, |
(...skipping 14 matching lines...) Expand all Loading... |
55 void FakeBluetoothAgentServiceProvider::RequestPasskey( | 54 void FakeBluetoothAgentServiceProvider::RequestPasskey( |
56 const dbus::ObjectPath& device_path, | 55 const dbus::ObjectPath& device_path, |
57 const Delegate::PasskeyCallback& callback) { | 56 const Delegate::PasskeyCallback& callback) { |
58 VLOG(1) << object_path_.value() << ": RequestPasskey for " | 57 VLOG(1) << object_path_.value() << ": RequestPasskey for " |
59 << device_path.value(); | 58 << device_path.value(); |
60 delegate_->RequestPasskey(device_path, callback); | 59 delegate_->RequestPasskey(device_path, callback); |
61 } | 60 } |
62 | 61 |
63 void FakeBluetoothAgentServiceProvider::DisplayPasskey( | 62 void FakeBluetoothAgentServiceProvider::DisplayPasskey( |
64 const dbus::ObjectPath& device_path, | 63 const dbus::ObjectPath& device_path, |
65 uint32 passkey, int16 entered) { | 64 uint32 passkey, |
66 VLOG(1) << object_path_.value() << ": DisplayPasskey " << passkey | 65 int16 entered) { |
67 << " (" << entered << " entered) for "<< device_path.value(); | 66 VLOG(1) << object_path_.value() << ": DisplayPasskey " << passkey << " (" |
| 67 << entered << " entered) for " << device_path.value(); |
68 delegate_->DisplayPasskey(device_path, passkey, entered); | 68 delegate_->DisplayPasskey(device_path, passkey, entered); |
69 } | 69 } |
70 | 70 |
71 void FakeBluetoothAgentServiceProvider::RequestConfirmation( | 71 void FakeBluetoothAgentServiceProvider::RequestConfirmation( |
72 const dbus::ObjectPath& device_path, | 72 const dbus::ObjectPath& device_path, |
73 uint32 passkey, | 73 uint32 passkey, |
74 const Delegate::ConfirmationCallback& callback) { | 74 const Delegate::ConfirmationCallback& callback) { |
75 VLOG(1) << object_path_.value() << ": RequestConfirmation " << passkey | 75 VLOG(1) << object_path_.value() << ": RequestConfirmation " << passkey |
76 << " for "<< device_path.value(); | 76 << " for " << device_path.value(); |
77 delegate_->RequestConfirmation(device_path, passkey, callback); | 77 delegate_->RequestConfirmation(device_path, passkey, callback); |
78 } | 78 } |
79 | 79 |
80 void FakeBluetoothAgentServiceProvider::RequestAuthorization( | 80 void FakeBluetoothAgentServiceProvider::RequestAuthorization( |
81 const dbus::ObjectPath& device_path, | 81 const dbus::ObjectPath& device_path, |
82 const Delegate::ConfirmationCallback& callback) { | 82 const Delegate::ConfirmationCallback& callback) { |
83 VLOG(1) << object_path_.value() << ": RequestAuthorization for " | 83 VLOG(1) << object_path_.value() << ": RequestAuthorization for " |
84 << device_path.value(); | 84 << device_path.value(); |
85 delegate_->RequestAuthorization(device_path, callback); | 85 delegate_->RequestAuthorization(device_path, callback); |
86 } | 86 } |
87 | 87 |
88 void FakeBluetoothAgentServiceProvider::AuthorizeService( | 88 void FakeBluetoothAgentServiceProvider::AuthorizeService( |
89 const dbus::ObjectPath& device_path, | 89 const dbus::ObjectPath& device_path, |
90 const std::string& uuid, | 90 const std::string& uuid, |
91 const Delegate::ConfirmationCallback& callback) { | 91 const Delegate::ConfirmationCallback& callback) { |
92 VLOG(1) << object_path_.value() << ": AuthorizeService " << uuid << " for " | 92 VLOG(1) << object_path_.value() << ": AuthorizeService " << uuid << " for " |
93 << device_path.value(); | 93 << device_path.value(); |
94 delegate_->AuthorizeService(device_path, uuid, callback); | 94 delegate_->AuthorizeService(device_path, uuid, callback); |
95 } | 95 } |
96 | 96 |
97 void FakeBluetoothAgentServiceProvider::Cancel() { | 97 void FakeBluetoothAgentServiceProvider::Cancel() { |
98 VLOG(1) << object_path_.value() << ": Cancel"; | 98 VLOG(1) << object_path_.value() << ": Cancel"; |
99 delegate_->Cancel(); | 99 delegate_->Cancel(); |
100 } | 100 } |
101 | 101 |
102 } // namespace chromeos | 102 } // namespace bluez |
OLD | NEW |