OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 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 #ifndef CHROMEOS_DBUS_FAKE_BLUETOOTH_MEDIA_TRANSPORT_CLIENT_H_ | 5 #ifndef CHROMEOS_DBUS_FAKE_BLUETOOTH_MEDIA_TRANSPORT_CLIENT_H_ |
6 #define CHROMEOS_DBUS_FAKE_BLUETOOTH_MEDIA_TRANSPORT_CLIENT_H_ | 6 #define CHROMEOS_DBUS_FAKE_BLUETOOTH_MEDIA_TRANSPORT_CLIENT_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
11 | 11 |
12 #include "base/files/file.h" | 12 #include "base/files/file.h" |
13 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
14 #include "base/observer_list.h" | 14 #include "base/observer_list.h" |
15 #include "chromeos/chromeos_export.h" | |
16 #include "chromeos/dbus/bluetooth_media_transport_client.h" | |
17 #include "dbus/object_path.h" | 15 #include "dbus/object_path.h" |
| 16 #include "device/bluetooth/bluetooth_export.h" |
| 17 #include "device/bluetooth/dbus/bluetooth_media_transport_client.h" |
18 | 18 |
19 namespace chromeos { | 19 namespace bluez { |
20 | 20 |
21 class FakeBluetoothMediaEndpointServiceProvider; | 21 class FakeBluetoothMediaEndpointServiceProvider; |
22 | 22 |
23 class CHROMEOS_EXPORT FakeBluetoothMediaTransportClient | 23 class DEVICE_BLUETOOTH_EXPORT FakeBluetoothMediaTransportClient |
24 : public BluetoothMediaTransportClient { | 24 : public BluetoothMediaTransportClient { |
25 public: | 25 public: |
26 struct Properties : public BluetoothMediaTransportClient::Properties { | 26 struct Properties : public BluetoothMediaTransportClient::Properties { |
27 explicit Properties(const PropertyChangedCallback& callback); | 27 explicit Properties(const PropertyChangedCallback& callback); |
28 ~Properties() override; | 28 ~Properties() override; |
29 | 29 |
30 void Get(dbus::PropertyBase* property, | 30 void Get(dbus::PropertyBase* property, |
31 dbus::PropertySet::GetCallback callback) override; | 31 dbus::PropertySet::GetCallback callback) override; |
32 void GetAll() override; | 32 void GetAll() override; |
33 void Set(dbus::PropertyBase* property, | 33 void Set(dbus::PropertyBase* property, |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 | 71 |
72 // Makes the transport valid/invalid for a given media endpoint. The transport | 72 // Makes the transport valid/invalid for a given media endpoint. The transport |
73 // object is assigned to the given endpoint if valid is true, false | 73 // object is assigned to the given endpoint if valid is true, false |
74 // otherwise. | 74 // otherwise. |
75 void SetValid(FakeBluetoothMediaEndpointServiceProvider* endpoint, | 75 void SetValid(FakeBluetoothMediaEndpointServiceProvider* endpoint, |
76 bool valid); | 76 bool valid); |
77 | 77 |
78 // Set state/volume property to a certain value. | 78 // Set state/volume property to a certain value. |
79 void SetState(const dbus::ObjectPath& endpoint_path, | 79 void SetState(const dbus::ObjectPath& endpoint_path, |
80 const std::string& state); | 80 const std::string& state); |
81 void SetVolume(const dbus::ObjectPath& endpoint_path, | 81 void SetVolume(const dbus::ObjectPath& endpoint_path, const uint16_t& volume); |
82 const uint16_t& volume); | |
83 | 82 |
84 // Writes bytes to the input file descriptor, |input_fd|, associated with a | 83 // Writes bytes to the input file descriptor, |input_fd|, associated with a |
85 // transport object which is bound to |endpoint_path|. | 84 // transport object which is bound to |endpoint_path|. |
86 void WriteData(const dbus::ObjectPath& endpoint_path, | 85 void WriteData(const dbus::ObjectPath& endpoint_path, |
87 const std::vector<char>& bytes); | 86 const std::vector<char>& bytes); |
88 | 87 |
89 // Retrieves the transport object path bound to |endpoint_path|. | 88 // Retrieves the transport object path bound to |endpoint_path|. |
90 dbus::ObjectPath GetTransportPath(const dbus::ObjectPath& endpoint_path); | 89 dbus::ObjectPath GetTransportPath(const dbus::ObjectPath& endpoint_path); |
91 | 90 |
92 private: | 91 private: |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
136 // Map of valid transports. Each pair is composed of a transport path as the | 135 // Map of valid transports. Each pair is composed of a transport path as the |
137 // key and an endpoint path as the value. This map is used to get the | 136 // key and an endpoint path as the value. This map is used to get the |
138 // corresponding endpoint path when GetProperties() is called. | 137 // corresponding endpoint path when GetProperties() is called. |
139 std::map<dbus::ObjectPath, dbus::ObjectPath> transport_to_endpoint_map_; | 138 std::map<dbus::ObjectPath, dbus::ObjectPath> transport_to_endpoint_map_; |
140 | 139 |
141 base::ObserverList<BluetoothMediaTransportClient::Observer> observers_; | 140 base::ObserverList<BluetoothMediaTransportClient::Observer> observers_; |
142 | 141 |
143 DISALLOW_COPY_AND_ASSIGN(FakeBluetoothMediaTransportClient); | 142 DISALLOW_COPY_AND_ASSIGN(FakeBluetoothMediaTransportClient); |
144 }; | 143 }; |
145 | 144 |
146 } // namespace chromeos | 145 } // namespace bluez |
147 | 146 |
148 #endif // CHROMEOS_DBUS_FAKE_BLUETOOTH_MEDIA_TRANSPORT_CLIENT_H_ | 147 #endif // CHROMEOS_DBUS_FAKE_BLUETOOTH_MEDIA_TRANSPORT_CLIENT_H_ |
OLD | NEW |