OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "device/bluetooth/dbus/bluetooth_le_advertising_manager_client.h" | 5 #include "device/bluetooth/dbus/bluetooth_le_advertising_manager_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/macros.h" | 9 #include "base/macros.h" |
10 #include "base/observer_list.h" | 10 #include "base/observer_list.h" |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 weak_ptr_factory_.GetWeakPtr(), callback), | 107 weak_ptr_factory_.GetWeakPtr(), callback), |
108 base::Bind(&BluetoothAdvertisementManagerClientImpl::OnError, | 108 base::Bind(&BluetoothAdvertisementManagerClientImpl::OnError, |
109 weak_ptr_factory_.GetWeakPtr(), error_callback)); | 109 weak_ptr_factory_.GetWeakPtr(), error_callback)); |
110 } | 110 } |
111 | 111 |
112 void SetAdvertisingInterval(const dbus::ObjectPath& manager_object_path, | 112 void SetAdvertisingInterval(const dbus::ObjectPath& manager_object_path, |
113 uint16_t min_interval_ms, | 113 uint16_t min_interval_ms, |
114 uint16_t max_interval_ms, | 114 uint16_t max_interval_ms, |
115 const base::Closure& callback, | 115 const base::Closure& callback, |
116 const ErrorCallback& error_callback) override { | 116 const ErrorCallback& error_callback) override { |
117 // TODO(rkc): Replace the string "SetAdvertisingInterval" with the correct | |
118 // constant in service_constants.h once cros_system_api DEPS are rolled. | |
119 dbus::MethodCall method_call( | 117 dbus::MethodCall method_call( |
120 bluetooth_advertising_manager::kBluetoothAdvertisingManagerInterface, | 118 bluetooth_advertising_manager::kBluetoothAdvertisingManagerInterface, |
121 "SetAdvertisingIntervals"); | 119 bluetooth_advertising_manager::kSetAdvertisingIntervals); |
122 | 120 |
123 dbus::MessageWriter writer(&method_call); | 121 dbus::MessageWriter writer(&method_call); |
124 writer.AppendUint16(min_interval_ms); | 122 writer.AppendUint16(min_interval_ms); |
125 writer.AppendUint16(max_interval_ms); | 123 writer.AppendUint16(max_interval_ms); |
126 | 124 |
127 DCHECK(object_manager_); | 125 DCHECK(object_manager_); |
128 dbus::ObjectProxy* object_proxy = | 126 dbus::ObjectProxy* object_proxy = |
129 object_manager_->GetObjectProxy(manager_object_path); | 127 object_manager_->GetObjectProxy(manager_object_path); |
130 object_proxy->CallMethodWithErrorCallback( | 128 object_proxy->CallMethodWithErrorCallback( |
131 &method_call, dbus::ObjectProxy::TIMEOUT_USE_DEFAULT, | 129 &method_call, dbus::ObjectProxy::TIMEOUT_USE_DEFAULT, |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
205 BluetoothLEAdvertisingManagerClient::BluetoothLEAdvertisingManagerClient() {} | 203 BluetoothLEAdvertisingManagerClient::BluetoothLEAdvertisingManagerClient() {} |
206 | 204 |
207 BluetoothLEAdvertisingManagerClient::~BluetoothLEAdvertisingManagerClient() {} | 205 BluetoothLEAdvertisingManagerClient::~BluetoothLEAdvertisingManagerClient() {} |
208 | 206 |
209 BluetoothLEAdvertisingManagerClient* | 207 BluetoothLEAdvertisingManagerClient* |
210 BluetoothLEAdvertisingManagerClient::Create() { | 208 BluetoothLEAdvertisingManagerClient::Create() { |
211 return new BluetoothAdvertisementManagerClientImpl(); | 209 return new BluetoothAdvertisementManagerClientImpl(); |
212 } | 210 } |
213 | 211 |
214 } // namespace bluez | 212 } // namespace bluez |
OLD | NEW |