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

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

Issue 2924753002: Allow device/bluetooth to build on the macOS 10.13 SDK (Closed)
Patch Set: Use new enum values in tests too 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 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 // Remove when Chrome no longer supports 10.12.
24 #if defined(MAC_OS_X_VERSION_10_13)
25
26 // In the 10.13 SDK, CBPeripheral became a subclass of CBPeer, which defines
27 // -[CBPeer identifier] as partially available. Pretend it still exists on
28 // CBPeripheral. At runtime the implementation on CBPeer will be invoked.
29 @interface CBPeripheral (HighSierraSDK)
30 @property(readonly, nonatomic) NSUUID* identifier;
31 @end
32
33 #endif // MAC_OS_X_VERSION_10_13
34
23 namespace device { 35 namespace device {
24 36
25 BluetoothLowEnergyDeviceMac::BluetoothLowEnergyDeviceMac( 37 BluetoothLowEnergyDeviceMac::BluetoothLowEnergyDeviceMac(
26 BluetoothAdapterMac* adapter, 38 BluetoothAdapterMac* adapter,
27 CBPeripheral* peripheral) 39 CBPeripheral* peripheral)
28 : BluetoothDeviceMac(adapter), 40 : BluetoothDeviceMac(adapter),
29 peripheral_(peripheral, base::scoped_policy::RETAIN), 41 peripheral_(peripheral, base::scoped_policy::RETAIN),
30 connected_(false), 42 connected_(false),
31 discovery_pending_count_(0) { 43 discovery_pending_count_(0) {
32 DCHECK(BluetoothAdapterMac::IsLowEnergyAvailable()); 44 DCHECK(BluetoothAdapterMac::IsLowEnergyAvailable());
(...skipping 477 matching lines...) Expand 10 before | Expand all | Expand 10 after
510 // BluetoothLowEnergyDeviceMac::GetNameForDisplay() instead. 522 // BluetoothLowEnergyDeviceMac::GetNameForDisplay() instead.
511 base::Optional<std::string> name = device.GetName(); 523 base::Optional<std::string> name = device.GetName();
512 const char* is_gatt_connected = 524 const char* is_gatt_connected =
513 device.IsGattConnected() ? "GATT connected" : "GATT disconnected"; 525 device.IsGattConnected() ? "GATT connected" : "GATT disconnected";
514 return out << "<BluetoothLowEnergyDeviceMac " << device.GetAddress() << "/" 526 return out << "<BluetoothLowEnergyDeviceMac " << device.GetAddress() << "/"
515 << &device << ", " << is_gatt_connected << ", \"" 527 << &device << ", " << is_gatt_connected << ", \""
516 << name.value_or("Unnamed device") << "\">"; 528 << name.value_or("Unnamed device") << "\">";
517 } 529 }
518 530
519 } // namespace device 531 } // namespace device
OLDNEW
« no previous file with comments | « device/bluetooth/bluetooth_adapter_mac_unittest.mm ('k') | device/bluetooth/bluetooth_low_energy_discovery_manager_mac.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698