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

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

Issue 2009753002: bluetooth: Make public BluetoothDevice::GetName method. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: split out name/alias Created 4 years, 5 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 <memory> 9 #include <memory>
10 #include <utility> 10 #include <utility>
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after
207 } else if (type == bluez::BluetoothDeviceClient::kTypeLe) { 207 } else if (type == bluez::BluetoothDeviceClient::kTypeLe) {
208 return device::BLUETOOTH_TRANSPORT_LE; 208 return device::BLUETOOTH_TRANSPORT_LE;
209 } else if (type == bluez::BluetoothDeviceClient::kTypeDual) { 209 } else if (type == bluez::BluetoothDeviceClient::kTypeDual) {
210 return device::BLUETOOTH_TRANSPORT_DUAL; 210 return device::BLUETOOTH_TRANSPORT_DUAL;
211 } 211 }
212 212
213 NOTREACHED(); 213 NOTREACHED();
214 return device::BLUETOOTH_TRANSPORT_INVALID; 214 return device::BLUETOOTH_TRANSPORT_INVALID;
215 } 215 }
216 216
217 std::string BluetoothDeviceBlueZ::GetDeviceName() const {
218 bluez::BluetoothDeviceClient::Properties* properties =
219 bluez::BluezDBusManager::Get()->GetBluetoothDeviceClient()->GetProperties(
220 object_path_);
221 DCHECK(properties);
222
223 return properties->alias.value();
224 }
225
226 void BluetoothDeviceBlueZ::CreateGattConnectionImpl() { 217 void BluetoothDeviceBlueZ::CreateGattConnectionImpl() {
227 // BlueZ implementation does not use the default CreateGattConnection 218 // BlueZ implementation does not use the default CreateGattConnection
228 // implementation. 219 // implementation.
229 NOTIMPLEMENTED(); 220 NOTIMPLEMENTED();
230 } 221 }
231 222
232 void BluetoothDeviceBlueZ::SetGattServicesDiscoveryComplete(bool complete) { 223 void BluetoothDeviceBlueZ::SetGattServicesDiscoveryComplete(bool complete) {
233 // BlueZ implementation already tracks service discovery state. 224 // BlueZ implementation already tracks service discovery state.
234 NOTIMPLEMENTED(); 225 NOTIMPLEMENTED();
235 } 226 }
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
286 bluez::BluezDBusManager::Get()->GetBluetoothDeviceClient()->GetProperties( 277 bluez::BluezDBusManager::Get()->GetBluetoothDeviceClient()->GetProperties(
287 object_path_); 278 object_path_);
288 DCHECK(properties); 279 DCHECK(properties);
289 280
290 if (!properties->appearance.is_valid()) 281 if (!properties->appearance.is_valid())
291 return kAppearanceNotPresent; 282 return kAppearanceNotPresent;
292 283
293 return properties->appearance.value(); 284 return properties->appearance.value();
294 } 285 }
295 286
287 base::Optional<std::string> BluetoothDeviceBlueZ::GetName() const {
288 bluez::BluetoothDeviceClient::Properties* properties =
289 bluez::BluezDBusManager::Get()->GetBluetoothDeviceClient()->GetProperties(
290 object_path_);
291 DCHECK(properties);
292
293 return properties->alias.value();
294 }
295
296 bool BluetoothDeviceBlueZ::IsPaired() const { 296 bool BluetoothDeviceBlueZ::IsPaired() const {
297 bluez::BluetoothDeviceClient::Properties* properties = 297 bluez::BluetoothDeviceClient::Properties* properties =
298 bluez::BluezDBusManager::Get()->GetBluetoothDeviceClient()->GetProperties( 298 bluez::BluezDBusManager::Get()->GetBluetoothDeviceClient()->GetProperties(
299 object_path_); 299 object_path_);
300 DCHECK(properties); 300 DCHECK(properties);
301 301
302 // Trusted devices are devices that don't support pairing but that the 302 // Trusted devices are devices that don't support pairing but that the
303 // user has explicitly connected; it makes no sense for UI purposes to 303 // user has explicitly connected; it makes no sense for UI purposes to
304 // treat them differently from each other. 304 // treat them differently from each other.
305 return properties->paired.value() || properties->trusted.value(); 305 return properties->paired.value() || properties->trusted.value();
(...skipping 567 matching lines...) Expand 10 before | Expand all | Expand 10 after
873 void BluetoothDeviceBlueZ::OnForgetError(const ErrorCallback& error_callback, 873 void BluetoothDeviceBlueZ::OnForgetError(const ErrorCallback& error_callback,
874 const std::string& error_name, 874 const std::string& error_name,
875 const std::string& error_message) { 875 const std::string& error_message) {
876 LOG(WARNING) << object_path_.value() 876 LOG(WARNING) << object_path_.value()
877 << ": Failed to remove device: " << error_name << ": " 877 << ": Failed to remove device: " << error_name << ": "
878 << error_message; 878 << error_message;
879 error_callback.Run(); 879 error_callback.Run();
880 } 880 }
881 881
882 } // namespace bluez 882 } // namespace bluez
OLDNEW
« no previous file with comments | « device/bluetooth/bluez/bluetooth_device_bluez.h ('k') | device/bluetooth/test/bluetooth_test_mac.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698