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

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

Issue 2910513005: Removing -[NSString UTF8String] calls (Closed)
Patch Set: Created 3 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
« no previous file with comments | « device/bluetooth/bluetooth_adapter_mac.mm ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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_remote_gatt_service_mac.h" 5 #include "device/bluetooth/bluetooth_remote_gatt_service_mac.h"
6 6
7 #import <CoreBluetooth/CoreBluetooth.h> 7 #import <CoreBluetooth/CoreBluetooth.h>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/logging.h" 10 #include "base/logging.h"
11 #include "base/memory/ptr_util.h" 11 #include "base/memory/ptr_util.h"
12 #include "base/strings/sys_string_conversions.h"
12 #include "device/bluetooth/bluetooth_adapter_mac.h" 13 #include "device/bluetooth/bluetooth_adapter_mac.h"
13 #include "device/bluetooth/bluetooth_low_energy_device_mac.h" 14 #include "device/bluetooth/bluetooth_low_energy_device_mac.h"
14 #include "device/bluetooth/bluetooth_remote_gatt_characteristic_mac.h" 15 #include "device/bluetooth/bluetooth_remote_gatt_characteristic_mac.h"
15 #include "device/bluetooth/bluetooth_uuid.h" 16 #include "device/bluetooth/bluetooth_uuid.h"
16 17
17 namespace device { 18 namespace device {
18 19
19 BluetoothRemoteGattServiceMac::BluetoothRemoteGattServiceMac( 20 BluetoothRemoteGattServiceMac::BluetoothRemoteGattServiceMac(
20 BluetoothLowEnergyDeviceMac* bluetooth_device_mac, 21 BluetoothLowEnergyDeviceMac* bluetooth_device_mac,
21 CBService* service, 22 CBService* service,
22 bool is_primary) 23 bool is_primary)
23 : bluetooth_device_mac_(bluetooth_device_mac), 24 : bluetooth_device_mac_(bluetooth_device_mac),
24 service_(service, base::scoped_policy::RETAIN), 25 service_(service, base::scoped_policy::RETAIN),
25 is_primary_(is_primary), 26 is_primary_(is_primary),
26 is_discovery_complete_(false), 27 is_discovery_complete_(false),
27 discovery_pending_count_(0) { 28 discovery_pending_count_(0) {
28 uuid_ = BluetoothAdapterMac::BluetoothUUIDWithCBUUID([service_.get() UUID]); 29 uuid_ = BluetoothAdapterMac::BluetoothUUIDWithCBUUID([service_.get() UUID]);
29 identifier_ = 30 identifier_ = base::SysNSStringToUTF8(
30 [NSString stringWithFormat:@"%s-%p", uuid_.canonical_value().c_str(), 31 [NSString stringWithFormat:@"%s-%p", uuid_.canonical_value().c_str(),
31 (void*)service_] 32 (void*)service_]);
32 .UTF8String;
33 } 33 }
34 34
35 BluetoothRemoteGattServiceMac::~BluetoothRemoteGattServiceMac() {} 35 BluetoothRemoteGattServiceMac::~BluetoothRemoteGattServiceMac() {}
36 36
37 std::string BluetoothRemoteGattServiceMac::GetIdentifier() const { 37 std::string BluetoothRemoteGattServiceMac::GetIdentifier() const {
38 return identifier_; 38 return identifier_;
39 } 39 }
40 40
41 BluetoothUUID BluetoothRemoteGattServiceMac::GetUUID() const { 41 BluetoothUUID BluetoothRemoteGattServiceMac::GetUUID() const {
42 return uuid_; 42 return uuid_;
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after
240 const BluetoothRemoteGattServiceMac& service) { 240 const BluetoothRemoteGattServiceMac& service) {
241 const BluetoothLowEnergyDeviceMac* bluetooth_device_mac_ = 241 const BluetoothLowEnergyDeviceMac* bluetooth_device_mac_ =
242 static_cast<const BluetoothLowEnergyDeviceMac*>(service.GetDevice()); 242 static_cast<const BluetoothLowEnergyDeviceMac*>(service.GetDevice());
243 return out << "<BluetoothRemoteGattServiceMac " 243 return out << "<BluetoothRemoteGattServiceMac "
244 << service.GetUUID().canonical_value() << "/" << &service 244 << service.GetUUID().canonical_value() << "/" << &service
245 << ", device: " << bluetooth_device_mac_->GetAddress() << "/" 245 << ", device: " << bluetooth_device_mac_->GetAddress() << "/"
246 << bluetooth_device_mac_ << ">"; 246 << bluetooth_device_mac_ << ">";
247 } 247 }
248 248
249 } // namespace device 249 } // namespace device
OLDNEW
« no previous file with comments | « device/bluetooth/bluetooth_adapter_mac.mm ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698