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

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

Issue 2244693002: bluetooth: Refactor how we update based on Advertising Data (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 4 years, 4 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_device_bluez.h" 5 #include "device/bluetooth/bluez/bluetooth_device_bluez.h"
6 6
7 #include <stdio.h> 7 #include <stdio.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <memory> 10 #include <memory>
(...skipping 329 matching lines...) Expand 10 before | Expand all | Expand 10 after
340 if (!input_properties) 340 if (!input_properties)
341 return true; 341 return true;
342 342
343 return input_properties->reconnect_mode.value() != "device"; 343 return input_properties->reconnect_mode.value() != "device";
344 } 344 }
345 345
346 bool BluetoothDeviceBlueZ::IsConnecting() const { 346 bool BluetoothDeviceBlueZ::IsConnecting() const {
347 return num_connecting_calls_ > 0; 347 return num_connecting_calls_ > 0;
348 } 348 }
349 349
350 BluetoothDeviceBlueZ::UUIDList BluetoothDeviceBlueZ::GetUUIDs() const { 350 BluetoothDevice::UUIDSet BluetoothDeviceBlueZ::GetUUIDs() const {
351 bluez::BluetoothDeviceClient::Properties* properties = 351 bluez::BluetoothDeviceClient::Properties* properties =
352 bluez::BluezDBusManager::Get()->GetBluetoothDeviceClient()->GetProperties( 352 bluez::BluezDBusManager::Get()->GetBluetoothDeviceClient()->GetProperties(
353 object_path_); 353 object_path_);
354 DCHECK(properties); 354 DCHECK(properties);
355 355
356 std::vector<device::BluetoothUUID> uuids; 356 UUIDSet uuids;
357 const std::vector<std::string>& dbus_uuids = properties->uuids.value(); 357 const std::vector<std::string>& dbus_uuids = properties->uuids.value();
358 for (std::vector<std::string>::const_iterator iter = dbus_uuids.begin(); 358 for (const std::string& dbus_uuid : dbus_uuids) {
359 iter != dbus_uuids.end(); ++iter) { 359 device::BluetoothUUID uuid(dbus_uuid);
360 device::BluetoothUUID uuid(*iter);
361 DCHECK(uuid.IsValid()); 360 DCHECK(uuid.IsValid());
362 uuids.push_back(uuid); 361 uuids.insert(std::move(uuid));
363 } 362 }
364 return uuids; 363 return uuids;
365 } 364 }
366 365
367 base::Optional<int8_t> BluetoothDeviceBlueZ::GetInquiryRSSI() const { 366 base::Optional<int8_t> BluetoothDeviceBlueZ::GetInquiryRSSI() const {
368 bluez::BluetoothDeviceClient::Properties* properties = 367 bluez::BluetoothDeviceClient::Properties* properties =
369 bluez::BluezDBusManager::Get()->GetBluetoothDeviceClient()->GetProperties( 368 bluez::BluezDBusManager::Get()->GetBluetoothDeviceClient()->GetProperties(
370 object_path_); 369 object_path_);
371 DCHECK(properties); 370 DCHECK(properties);
372 371
(...skipping 517 matching lines...) Expand 10 before | Expand all | Expand 10 after
890 void BluetoothDeviceBlueZ::OnForgetError(const ErrorCallback& error_callback, 889 void BluetoothDeviceBlueZ::OnForgetError(const ErrorCallback& error_callback,
891 const std::string& error_name, 890 const std::string& error_name,
892 const std::string& error_message) { 891 const std::string& error_message) {
893 LOG(WARNING) << object_path_.value() 892 LOG(WARNING) << object_path_.value()
894 << ": Failed to remove device: " << error_name << ": " 893 << ": Failed to remove device: " << error_name << ": "
895 << error_message; 894 << error_message;
896 error_callback.Run(); 895 error_callback.Run();
897 } 896 }
898 897
899 } // namespace bluez 898 } // namespace bluez
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698