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