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.
5 #include "chromeos/dbus/fake_bluetooth_media_endpoint_service_provider.h"
7 #include "chromeos/dbus/dbus_thread_manager.h"
8 #include "chromeos/dbus/fake_bluetooth_media_client.h"
9 #include "chromeos/dbus/fake_bluetooth_media_transport_client.h"
11 using dbus::ObjectPath
;
15 FakeBluetoothMediaEndpointServiceProvider::
16 FakeBluetoothMediaEndpointServiceProvider(const ObjectPath
& object_path
,
18 : visible_(false), object_path_(object_path
), delegate_(delegate
) {
19 VLOG(1) << "Create Bluetooth Media Endpoint: " << object_path_
.value();
22 FakeBluetoothMediaEndpointServiceProvider::
23 ~FakeBluetoothMediaEndpointServiceProvider() {
24 VLOG(1) << "Cleaning up Bluetooth Media Endpoint: " << object_path_
.value();
27 void FakeBluetoothMediaEndpointServiceProvider::SetConfiguration(
28 const ObjectPath
& transport_path
,
29 const Delegate::TransportProperties
& properties
) {
30 VLOG(1) << object_path_
.value() << ": SetConfiguration for "
31 << transport_path
.value();
33 // Makes the transport object valid for the given endpoint path.
34 FakeBluetoothMediaTransportClient
* transport
=
35 static_cast<FakeBluetoothMediaTransportClient
*>(
36 DBusThreadManager::Get()->GetBluetoothMediaTransportClient());
37 transport
->SetValid(object_path_
, true);
39 delegate_
->SetConfiguration(transport_path
, properties
);
42 void FakeBluetoothMediaEndpointServiceProvider::SelectConfiguration(
43 const std::vector
<uint8_t>& capabilities
,
44 const Delegate::SelectConfigurationCallback
& callback
) {
45 VLOG(1) << object_path_
.value() << ": SelectConfiguration";
46 delegate_
->SelectConfiguration(capabilities
, callback
);
49 void FakeBluetoothMediaEndpointServiceProvider::ClearConfiguration(
50 const ObjectPath
& transport_path
) {
51 VLOG(1) << object_path_
.value() << ": ClearConfiguration on "
52 << transport_path
.value();
53 delegate_
->ClearConfiguration(transport_path
);
56 void FakeBluetoothMediaEndpointServiceProvider::Released() {
57 VLOG(1) << object_path_
.value() << ": Released";
58 delegate_
->Released();
61 } // namespace chromeos