Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(206)

Side by Side Diff: device/bluetooth/bluez/bluetooth_adapter_bluez.cc

Issue 2098653002: device/bluetooth/bluez: add discoverable timeout adapter property (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fixing nits Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 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/bluez/bluetooth_adapter_bluez.h" 5 #include "device/bluetooth/bluez/bluetooth_adapter_bluez.h"
6 6
7 #include <memory> 7 #include <memory>
8 #include <set> 8 #include <set>
9 #include <string> 9 #include <string>
10 #include <utility> 10 #include <utility>
(...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after
346 346
347 bluez::BluezDBusManager::Get() 347 bluez::BluezDBusManager::Get()
348 ->GetBluetoothAdapterClient() 348 ->GetBluetoothAdapterClient()
349 ->GetProperties(object_path_) 349 ->GetProperties(object_path_)
350 ->discoverable.Set( 350 ->discoverable.Set(
351 discoverable, 351 discoverable,
352 base::Bind(&BluetoothAdapterBlueZ::OnSetDiscoverable, 352 base::Bind(&BluetoothAdapterBlueZ::OnSetDiscoverable,
353 weak_ptr_factory_.GetWeakPtr(), callback, error_callback)); 353 weak_ptr_factory_.GetWeakPtr(), callback, error_callback));
354 } 354 }
355 355
356 uint32_t BluetoothAdapterBlueZ::GetDiscoverableTimeout() const {
357 if (!IsPresent())
358 return 0;
359
360 bluez::BluetoothAdapterClient::Properties* properties =
361 bluez::BluezDBusManager::Get()
362 ->GetBluetoothAdapterClient()
363 ->GetProperties(object_path_);
364
365 return properties->discoverable_timeout.value();
366 }
367
356 bool BluetoothAdapterBlueZ::IsDiscovering() const { 368 bool BluetoothAdapterBlueZ::IsDiscovering() const {
357 if (!IsPresent()) 369 if (!IsPresent())
358 return false; 370 return false;
359 371
360 bluez::BluetoothAdapterClient::Properties* properties = 372 bluez::BluetoothAdapterClient::Properties* properties =
361 bluez::BluezDBusManager::Get() 373 bluez::BluezDBusManager::Get()
362 ->GetBluetoothAdapterClient() 374 ->GetBluetoothAdapterClient()
363 ->GetProperties(object_path_); 375 ->GetProperties(object_path_);
364 376
365 return properties->discovering.value(); 377 return properties->discovering.value();
(...skipping 1306 matching lines...) Expand 10 before | Expand all | Expand 10 after
1672 } else if (error_name == bluetooth_adapter::kErrorAlreadyExists) { 1684 } else if (error_name == bluetooth_adapter::kErrorAlreadyExists) {
1673 code = BluetoothServiceRecordBlueZ::ErrorCode::ERROR_RECORD_ALREADY_EXISTS; 1685 code = BluetoothServiceRecordBlueZ::ErrorCode::ERROR_RECORD_ALREADY_EXISTS;
1674 } else if (error_name == bluetooth_adapter::kErrorNotReady) { 1686 } else if (error_name == bluetooth_adapter::kErrorNotReady) {
1675 code = BluetoothServiceRecordBlueZ::ErrorCode::ERROR_ADAPTER_NOT_READY; 1687 code = BluetoothServiceRecordBlueZ::ErrorCode::ERROR_ADAPTER_NOT_READY;
1676 } 1688 }
1677 1689
1678 error_callback.Run(code); 1690 error_callback.Run(code);
1679 } 1691 }
1680 1692
1681 } // namespace bluez 1693 } // namespace bluez
OLDNEW
« no previous file with comments | « device/bluetooth/bluez/bluetooth_adapter_bluez.h ('k') | device/bluetooth/bluez/bluetooth_bluez_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698