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

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: Fix arc 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 BluetoothDeviceBlueZ::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(uuid);
Jeffrey Yasskin 2016/08/19 15:09:53 Try to std::move() BluetoothUUIDs around, since th
ortuno 2016/08/19 20:50:34 Done.
363 } 362 }
363
364 return uuids; 364 return uuids;
365 } 365 }
366 366
367 base::Optional<int8_t> BluetoothDeviceBlueZ::GetInquiryRSSI() const { 367 base::Optional<int8_t> BluetoothDeviceBlueZ::GetInquiryRSSI() const {
368 bluez::BluetoothDeviceClient::Properties* properties = 368 bluez::BluetoothDeviceClient::Properties* properties =
369 bluez::BluezDBusManager::Get()->GetBluetoothDeviceClient()->GetProperties( 369 bluez::BluezDBusManager::Get()->GetBluetoothDeviceClient()->GetProperties(
370 object_path_); 370 object_path_);
371 DCHECK(properties); 371 DCHECK(properties);
372 372
373 if (!properties->rssi.is_valid()) 373 if (!properties->rssi.is_valid())
(...skipping 516 matching lines...) Expand 10 before | Expand all | Expand 10 after
890 void BluetoothDeviceBlueZ::OnForgetError(const ErrorCallback& error_callback, 890 void BluetoothDeviceBlueZ::OnForgetError(const ErrorCallback& error_callback,
891 const std::string& error_name, 891 const std::string& error_name,
892 const std::string& error_message) { 892 const std::string& error_message) {
893 LOG(WARNING) << object_path_.value() 893 LOG(WARNING) << object_path_.value()
894 << ": Failed to remove device: " << error_name << ": " 894 << ": Failed to remove device: " << error_name << ": "
895 << error_message; 895 << error_message;
896 error_callback.Run(); 896 error_callback.Run();
897 } 897 }
898 898
899 } // namespace bluez 899 } // namespace bluez
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698