| 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 #include "chromeos/dbus/bluetooth_media_transport_client.h" | 5 #include "chromeos/dbus/bluetooth_media_transport_client.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
| 10 #include "base/observer_list.h" | 10 #include "base/observer_list.h" |
| 11 #include "dbus/bus.h" | 11 #include "dbus/bus.h" |
| 12 #include "dbus/message.h" | 12 #include "dbus/message.h" |
| 13 #include "dbus/object_manager.h" | 13 #include "dbus/object_manager.h" |
| 14 #include "dbus/object_proxy.h" | 14 #include "dbus/object_proxy.h" |
| 15 #include "third_party/cros_system_api/dbus/service_constants.h" | 15 #include "third_party/cros_system_api/dbus/service_constants.h" |
| 16 | 16 |
| 17 namespace { | 17 namespace { |
| 18 | 18 |
| 19 // TODO(mcchou): Add these service constants into dbus/service_constants.h | 19 // TODO(mcchou): Add these service constants into dbus/service_constants.h |
| 20 // later. | 20 // later. |
| 21 const char kBluetoothMediaTransportInterface[] = "org.bluez.MediaTransport1"; | 21 const char kBluetoothMediaTransportInterface[] = "org.bluez.MediaTransport1"; |
| 22 | 22 |
| 23 // Constants used to indicate exceptional error conditions. |
| 24 const char kNoResponseError[] = "org.chromium.Error.NoResponse"; |
| 25 const char kUnexpectedResponse[] = "org.chromium.Error.UnexpectedResponse"; |
| 26 |
| 23 // Method names of Media Transport interface. | 27 // Method names of Media Transport interface. |
| 24 const char kAcquire[] = "Acquire"; | 28 const char kAcquire[] = "Acquire"; |
| 25 const char kTryAcquire[] = "TryAcquire"; | 29 const char kTryAcquire[] = "TryAcquire"; |
| 26 const char kRelease[] = "Release"; | 30 const char kRelease[] = "Release"; |
| 27 | 31 |
| 28 // Property names of Media Transport interface. | |
| 29 const char kDeviceProperty[] = "Device"; | |
| 30 const char kUUIDProperty[] = "UUID"; | |
| 31 const char kCodecProperty[] = "Codec"; | |
| 32 const char kConfigurationProperty[] = "Configuration"; | |
| 33 const char kStateProperty[] = "State"; | |
| 34 const char kDelayProperty[] = "Delay"; | |
| 35 const char kVolumeProperty[] = "Volume"; | |
| 36 | |
| 37 } // namespace | 32 } // namespace |
| 38 | 33 |
| 39 namespace chromeos { | 34 namespace chromeos { |
| 40 | 35 |
| 41 const char BluetoothMediaTransportClient::kNoResponseError[] = | 36 // static |
| 42 "org.chromium.Error.NoResponse"; | 37 const char BluetoothMediaTransportClient::kDeviceProperty[] = "Device"; |
| 43 const char BluetoothMediaTransportClient::kUnexpectedResponse[] = | 38 const char BluetoothMediaTransportClient::kUUIDProperty[] = "UUID"; |
| 44 "org.chromium.Error.UnexpectedResponse"; | 39 const char BluetoothMediaTransportClient::kCodecProperty[] = "Codec"; |
| 40 const char BluetoothMediaTransportClient::kConfigurationProperty[] = |
| 41 "Configuration"; |
| 42 const char BluetoothMediaTransportClient::kStateProperty[] = "State"; |
| 43 const char BluetoothMediaTransportClient::kDelayProperty[] = "Delay"; |
| 44 const char BluetoothMediaTransportClient::kVolumeProperty[] = "Volume"; |
| 45 |
| 46 // static |
| 47 const char BluetoothMediaTransportClient::kStateIdle[] = "idle"; |
| 48 const char BluetoothMediaTransportClient::kStatePending[] = "pending"; |
| 49 const char BluetoothMediaTransportClient::kStateActive[] = "active"; |
| 45 | 50 |
| 46 BluetoothMediaTransportClient::Properties::Properties( | 51 BluetoothMediaTransportClient::Properties::Properties( |
| 47 dbus::ObjectProxy* object_proxy, | 52 dbus::ObjectProxy* object_proxy, |
| 48 const std::string& interface_name, | 53 const std::string& interface_name, |
| 49 const PropertyChangedCallback& callback) | 54 const PropertyChangedCallback& callback) |
| 50 : dbus::PropertySet(object_proxy, interface_name, callback) { | 55 : dbus::PropertySet(object_proxy, interface_name, callback) { |
| 51 RegisterProperty(kDeviceProperty, &device); | 56 RegisterProperty(kDeviceProperty, &device); |
| 52 RegisterProperty(kUUIDProperty, &uuid); | 57 RegisterProperty(kUUIDProperty, &uuid); |
| 53 RegisterProperty(kCodecProperty, &codec); | 58 RegisterProperty(kCodecProperty, &codec); |
| 54 RegisterProperty(kConfigurationProperty, &configuration); | 59 RegisterProperty(kConfigurationProperty, &configuration); |
| (...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 271 } | 276 } |
| 272 | 277 |
| 273 BluetoothMediaTransportClient::~BluetoothMediaTransportClient() { | 278 BluetoothMediaTransportClient::~BluetoothMediaTransportClient() { |
| 274 } | 279 } |
| 275 | 280 |
| 276 BluetoothMediaTransportClient* BluetoothMediaTransportClient::Create() { | 281 BluetoothMediaTransportClient* BluetoothMediaTransportClient::Create() { |
| 277 return new BluetoothMediaTransportClientImpl(); | 282 return new BluetoothMediaTransportClientImpl(); |
| 278 } | 283 } |
| 279 | 284 |
| 280 } // namespace chromeos | 285 } // namespace chromeos |
| OLD | NEW |