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

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

Issue 2854733002: bluetooth: macOS: BluetoothLowEnergyDeviceMac::IsConnectable() not implemented (Closed)
Patch Set: Adding unittests and implementation Created 3 years, 7 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"
11 #include "base/mac/scoped_cftyperef.h" 11 #include "base/mac/scoped_cftyperef.h"
12 #include "base/mac/sdk_forward_declarations.h" 12 #include "base/mac/sdk_forward_declarations.h"
13 #include "base/memory/ptr_util.h" 13 #include "base/memory/ptr_util.h"
14 #include "base/strings/string_number_conversions.h" 14 #include "base/strings/string_number_conversions.h"
15 #include "base/strings/sys_string_conversions.h" 15 #include "base/strings/sys_string_conversions.h"
16 #include "device/bluetooth/bluetooth_adapter_mac.h" 16 #include "device/bluetooth/bluetooth_adapter_mac.h"
17 #include "device/bluetooth/bluetooth_device.h" 17 #include "device/bluetooth/bluetooth_device.h"
18 #include "device/bluetooth/bluetooth_low_energy_peripheral_delegate.h" 18 #include "device/bluetooth/bluetooth_low_energy_peripheral_delegate.h"
19 #include "device/bluetooth/bluetooth_remote_gatt_characteristic_mac.h" 19 #include "device/bluetooth/bluetooth_remote_gatt_characteristic_mac.h"
20 #include "device/bluetooth/bluetooth_remote_gatt_descriptor_mac.h" 20 #include "device/bluetooth/bluetooth_remote_gatt_descriptor_mac.h"
21 #include "device/bluetooth/bluetooth_remote_gatt_service_mac.h" 21 #include "device/bluetooth/bluetooth_remote_gatt_service_mac.h"
22 22
23 using device::BluetoothDevice; 23 using device::BluetoothDevice;
24 using device::BluetoothLowEnergyDeviceMac; 24 using device::BluetoothLowEnergyDeviceMac;
25 25
26 BluetoothLowEnergyDeviceMac::BluetoothLowEnergyDeviceMac( 26 BluetoothLowEnergyDeviceMac::BluetoothLowEnergyDeviceMac(
27 BluetoothAdapterMac* adapter, 27 BluetoothAdapterMac* adapter,
28 CBPeripheral* peripheral) 28 CBPeripheral* peripheral,
29 bool connectable)
29 : BluetoothDeviceMac(adapter), 30 : BluetoothDeviceMac(adapter),
30 peripheral_(peripheral, base::scoped_policy::RETAIN), 31 peripheral_(peripheral, base::scoped_policy::RETAIN),
32 connectable_(connectable),
ortuno 2017/05/04 00:35:36 Thanks for implementing this. I think we want to k
jlebel 2017/05/04 00:56:17 Done.
31 discovery_pending_count_(0) { 33 discovery_pending_count_(0) {
32 DCHECK(BluetoothAdapterMac::IsLowEnergyAvailable()); 34 DCHECK(BluetoothAdapterMac::IsLowEnergyAvailable());
33 DCHECK(peripheral_.get()); 35 DCHECK(peripheral_.get());
34 peripheral_delegate_.reset([[BluetoothLowEnergyPeripheralDelegate alloc] 36 peripheral_delegate_.reset([[BluetoothLowEnergyPeripheralDelegate alloc]
35 initWithBluetoothLowEnergyDeviceMac:this]); 37 initWithBluetoothLowEnergyDeviceMac:this]);
36 [peripheral_ setDelegate:peripheral_delegate_]; 38 [peripheral_ setDelegate:peripheral_delegate_];
37 identifier_ = GetPeripheralIdentifier(peripheral); 39 identifier_ = GetPeripheralIdentifier(peripheral);
38 hash_address_ = GetPeripheralHashAddress(peripheral); 40 hash_address_ = GetPeripheralHashAddress(peripheral);
39 UpdateTimestamp(); 41 UpdateTimestamp();
40 } 42 }
(...skipping 425 matching lines...) Expand 10 before | Expand all | Expand 10 after
466 std::ostream& operator<<(std::ostream& out, 468 std::ostream& operator<<(std::ostream& out,
467 const BluetoothLowEnergyDeviceMac& device) { 469 const BluetoothLowEnergyDeviceMac& device) {
468 // TODO(crbug.com/703878): Should use 470 // TODO(crbug.com/703878): Should use
469 // BluetoothLowEnergyDeviceMac::GetNameForDisplay() instead. 471 // BluetoothLowEnergyDeviceMac::GetNameForDisplay() instead.
470 base::Optional<std::string> name = device.GetName(); 472 base::Optional<std::string> name = device.GetName();
471 const char* name_cstr = name ? name->c_str() : ""; 473 const char* name_cstr = name ? name->c_str() : "";
472 return out << "<BluetoothLowEnergyDeviceMac " << device.GetAddress() << "/" 474 return out << "<BluetoothLowEnergyDeviceMac " << device.GetAddress() << "/"
473 << &device << ", \"" << name_cstr << "\">"; 475 << &device << ", \"" << name_cstr << "\">";
474 } 476 }
475 } // namespace device 477 } // namespace device
OLDNEW
« no previous file with comments | « device/bluetooth/bluetooth_low_energy_device_mac.h ('k') | device/bluetooth/test/bluetooth_test_mac.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698