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

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

Issue 2906883004: bluetooth: macOS: Removing useless |.get()| (Closed)
Patch Set: Merge from top of tree 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
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 "base/strings/sys_string_conversions.h"
13 #include "device/bluetooth/bluetooth_adapter_mac.h" 13 #include "device/bluetooth/bluetooth_adapter_mac.h"
14 #include "device/bluetooth/bluetooth_low_energy_device_mac.h" 14 #include "device/bluetooth/bluetooth_low_energy_device_mac.h"
15 #include "device/bluetooth/bluetooth_remote_gatt_characteristic_mac.h" 15 #include "device/bluetooth/bluetooth_remote_gatt_characteristic_mac.h"
16 #include "device/bluetooth/bluetooth_uuid.h" 16 #include "device/bluetooth/bluetooth_uuid.h"
17 17
18 namespace device { 18 namespace device {
19 19
20 BluetoothRemoteGattServiceMac::BluetoothRemoteGattServiceMac( 20 BluetoothRemoteGattServiceMac::BluetoothRemoteGattServiceMac(
21 BluetoothLowEnergyDeviceMac* bluetooth_device_mac, 21 BluetoothLowEnergyDeviceMac* bluetooth_device_mac,
22 CBService* service, 22 CBService* service,
23 bool is_primary) 23 bool is_primary)
24 : bluetooth_device_mac_(bluetooth_device_mac), 24 : bluetooth_device_mac_(bluetooth_device_mac),
25 service_(service, base::scoped_policy::RETAIN), 25 service_(service, base::scoped_policy::RETAIN),
26 is_primary_(is_primary), 26 is_primary_(is_primary),
27 is_discovery_complete_(false), 27 is_discovery_complete_(false),
28 discovery_pending_count_(0) { 28 discovery_pending_count_(0) {
29 uuid_ = BluetoothAdapterMac::BluetoothUUIDWithCBUUID([service_.get() UUID]); 29 uuid_ = BluetoothAdapterMac::BluetoothUUIDWithCBUUID([service_ UUID]);
30 identifier_ = base::SysNSStringToUTF8( 30 identifier_ = base::SysNSStringToUTF8(
31 [NSString stringWithFormat:@"%s-%p", uuid_.canonical_value().c_str(), 31 [NSString stringWithFormat:@"%s-%p", uuid_.canonical_value().c_str(),
32 (void*)service_]); 32 (void*)service_]);
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 }
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
207 207
208 BluetoothAdapterMac* BluetoothRemoteGattServiceMac::GetMacAdapter() const { 208 BluetoothAdapterMac* BluetoothRemoteGattServiceMac::GetMacAdapter() const {
209 return bluetooth_device_mac_->GetMacAdapter(); 209 return bluetooth_device_mac_->GetMacAdapter();
210 } 210 }
211 211
212 CBPeripheral* BluetoothRemoteGattServiceMac::GetCBPeripheral() const { 212 CBPeripheral* BluetoothRemoteGattServiceMac::GetCBPeripheral() const {
213 return bluetooth_device_mac_->GetPeripheral(); 213 return bluetooth_device_mac_->GetPeripheral();
214 } 214 }
215 215
216 CBService* BluetoothRemoteGattServiceMac::GetService() const { 216 CBService* BluetoothRemoteGattServiceMac::GetService() const {
217 return service_.get(); 217 return service_;
218 } 218 }
219 219
220 BluetoothRemoteGattCharacteristicMac* 220 BluetoothRemoteGattCharacteristicMac*
221 BluetoothRemoteGattServiceMac::GetBluetoothRemoteGattCharacteristicMac( 221 BluetoothRemoteGattServiceMac::GetBluetoothRemoteGattCharacteristicMac(
222 CBCharacteristic* characteristic) const { 222 CBCharacteristic* characteristic) const {
223 auto found = std::find_if( 223 auto found = std::find_if(
224 gatt_characteristic_macs_.begin(), gatt_characteristic_macs_.end(), 224 gatt_characteristic_macs_.begin(), gatt_characteristic_macs_.end(),
225 [characteristic]( 225 [characteristic](
226 const std::pair< 226 const std::pair<
227 const std::string, 227 const std::string,
(...skipping 12 matching lines...) Expand all
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_remote_gatt_characteristic_mac.mm ('k') | device/bluetooth/test/bluetooth_test_mac.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698