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

Side by Side Diff: device/bluetooth/bluetooth_low_energy_device_mac.mm

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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/bluetooth_low_energy_device_mac.h" 5 #include "device/bluetooth/bluetooth_low_energy_device_mac.h"
6 6
7 #import <CoreFoundation/CoreFoundation.h> 7 #import <CoreFoundation/CoreFoundation.h>
8 #include <stddef.h> 8 #include <stddef.h>
9 9
10 #include "base/mac/mac_util.h" 10 #include "base/mac/mac_util.h"
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 return 0; 104 return 0;
105 } 105 }
106 106
107 uint16_t BluetoothLowEnergyDeviceMac::GetAppearance() const { 107 uint16_t BluetoothLowEnergyDeviceMac::GetAppearance() const {
108 // TODO(crbug.com/588083): Implementing GetAppearance() 108 // TODO(crbug.com/588083): Implementing GetAppearance()
109 // on mac, win, and android platforms for chrome 109 // on mac, win, and android platforms for chrome
110 NOTIMPLEMENTED(); 110 NOTIMPLEMENTED();
111 return 0; 111 return 0;
112 } 112 }
113 113
114 base::Optional<std::string> BluetoothLowEnergyDeviceMac::GetName() const {
115 if ([peripheral_ name])
116 return base::SysNSStringToUTF8([peripheral_ name]);
117 return base::nullopt;
118 }
119
114 int BluetoothLowEnergyDeviceMac::GetRSSI() const { 120 int BluetoothLowEnergyDeviceMac::GetRSSI() const {
115 return rssi_; 121 return rssi_;
116 } 122 }
117 123
118 bool BluetoothLowEnergyDeviceMac::IsPaired() const { 124 bool BluetoothLowEnergyDeviceMac::IsPaired() const {
119 return false; 125 return false;
120 } 126 }
121 127
122 bool BluetoothLowEnergyDeviceMac::IsConnected() const { 128 bool BluetoothLowEnergyDeviceMac::IsConnected() const {
123 return IsGattConnected(); 129 return IsGattConnected();
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
211 NOTIMPLEMENTED(); 217 NOTIMPLEMENTED();
212 } 218 }
213 219
214 void BluetoothLowEnergyDeviceMac::ConnectToServiceInsecurely( 220 void BluetoothLowEnergyDeviceMac::ConnectToServiceInsecurely(
215 const device::BluetoothUUID& uuid, 221 const device::BluetoothUUID& uuid,
216 const ConnectToServiceCallback& callback, 222 const ConnectToServiceCallback& callback,
217 const ConnectToServiceErrorCallback& error_callback) { 223 const ConnectToServiceErrorCallback& error_callback) {
218 NOTIMPLEMENTED(); 224 NOTIMPLEMENTED();
219 } 225 }
220 226
221 std::string BluetoothLowEnergyDeviceMac::GetDeviceName() const {
222 return base::SysNSStringToUTF8([peripheral_ name]);
223 }
224
225 void BluetoothLowEnergyDeviceMac::CreateGattConnectionImpl() { 227 void BluetoothLowEnergyDeviceMac::CreateGattConnectionImpl() {
226 if (!IsGattConnected()) { 228 if (!IsGattConnected()) {
227 GetMacAdapter()->CreateGattConnection(this); 229 GetMacAdapter()->CreateGattConnection(this);
228 } 230 }
229 } 231 }
230 232
231 void BluetoothLowEnergyDeviceMac::DisconnectGatt() { 233 void BluetoothLowEnergyDeviceMac::DisconnectGatt() {
232 GetMacAdapter()->DisconnectGatt(this); 234 GetMacAdapter()->DisconnectGatt(this);
233 } 235 }
234 236
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
385 GattServiceMap gatt_services_swapped; 387 GattServiceMap gatt_services_swapped;
386 gatt_services_swapped.swap(gatt_services_); 388 gatt_services_swapped.swap(gatt_services_);
387 gatt_services_swapped.clear(); 389 gatt_services_swapped.clear();
388 if (create_gatt_connection_error_callbacks_.empty()) { 390 if (create_gatt_connection_error_callbacks_.empty()) {
389 // TODO(http://crbug.com/585897): Need to pass the error. 391 // TODO(http://crbug.com/585897): Need to pass the error.
390 DidDisconnectGatt(); 392 DidDisconnectGatt();
391 } else { 393 } else {
392 DidFailToConnectGatt(error_code); 394 DidFailToConnectGatt(error_code);
393 } 395 }
394 } 396 }
OLDNEW
« no previous file with comments | « device/bluetooth/bluetooth_low_energy_device_mac.h ('k') | device/bluetooth/bluetooth_low_energy_win.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698