OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 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 | 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/fake_bluetooth_adapter_client.h" | 5 #include "device/bluetooth/dbus/fake_bluetooth_adapter_client.h" |
6 | 6 |
7 #include <map> | 7 #include <map> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
(...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
306 void FakeBluetoothAdapterClient::SetUUIDs( | 306 void FakeBluetoothAdapterClient::SetUUIDs( |
307 const std::vector<std::string>& uuids) { | 307 const std::vector<std::string>& uuids) { |
308 properties_->uuids.ReplaceValue(uuids); | 308 properties_->uuids.ReplaceValue(uuids); |
309 } | 309 } |
310 | 310 |
311 void FakeBluetoothAdapterClient::SetSecondUUIDs( | 311 void FakeBluetoothAdapterClient::SetSecondUUIDs( |
312 const std::vector<std::string>& uuids) { | 312 const std::vector<std::string>& uuids) { |
313 second_properties_->uuids.ReplaceValue(uuids); | 313 second_properties_->uuids.ReplaceValue(uuids); |
314 } | 314 } |
315 | 315 |
| 316 void FakeBluetoothAdapterClient::SetDiscoverableTimeout(uint32_t timeout) { |
| 317 properties_->discoverable_timeout.ReplaceValue(timeout); |
| 318 } |
| 319 |
316 void FakeBluetoothAdapterClient::OnPropertyChanged( | 320 void FakeBluetoothAdapterClient::OnPropertyChanged( |
317 const std::string& property_name) { | 321 const std::string& property_name) { |
318 if (property_name == properties_->powered.name() && | 322 if (property_name == properties_->powered.name() && |
319 !properties_->powered.value()) { | 323 !properties_->powered.value()) { |
320 VLOG(1) << "Adapter powered off"; | 324 VLOG(1) << "Adapter powered off"; |
321 | 325 |
322 if (discovering_count_) { | 326 if (discovering_count_) { |
323 discovering_count_ = 0; | 327 discovering_count_ = 0; |
324 properties_->discovering.ReplaceValue(false); | 328 properties_->discovering.ReplaceValue(false); |
325 } | 329 } |
326 } | 330 } |
327 | 331 |
328 FOR_EACH_OBSERVER( | 332 FOR_EACH_OBSERVER( |
329 BluetoothAdapterClient::Observer, observers_, | 333 BluetoothAdapterClient::Observer, observers_, |
330 AdapterPropertyChanged(dbus::ObjectPath(kAdapterPath), property_name)); | 334 AdapterPropertyChanged(dbus::ObjectPath(kAdapterPath), property_name)); |
331 } | 335 } |
332 | 336 |
333 void FakeBluetoothAdapterClient::PostDelayedTask( | 337 void FakeBluetoothAdapterClient::PostDelayedTask( |
334 const base::Closure& callback) { | 338 const base::Closure& callback) { |
335 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( | 339 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( |
336 FROM_HERE, callback, | 340 FROM_HERE, callback, |
337 base::TimeDelta::FromMilliseconds(simulation_interval_ms_)); | 341 base::TimeDelta::FromMilliseconds(simulation_interval_ms_)); |
338 } | 342 } |
339 | 343 |
340 } // namespace bluez | 344 } // namespace bluez |
OLD | NEW |