OLD | NEW |
---|---|
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 #ifndef DEVICE_BLUETOOTH_BLUETOOTH_LOW_ENERGY_DISCOVERY_MANAGER_MAC_H_ | 5 #ifndef DEVICE_BLUETOOTH_BLUETOOTH_LOW_ENERGY_DISCOVERY_MANAGER_MAC_H_ |
scheib
2015/07/09 19:51:23
Consider adding a static method to this class so t
krstnmnlsn
2015/07/10 17:17:46
I like this idea a lot. Added the method to mac a
| |
6 #define DEVICE_BLUETOOTH_BLUETOOTH_LOW_ENERGY_DISCOVERY_MANAGER_MAC_H_ | 6 #define DEVICE_BLUETOOTH_BLUETOOTH_LOW_ENERGY_DISCOVERY_MANAGER_MAC_H_ |
7 | 7 |
8 #if defined(OS_IOS) | 8 #if defined(OS_IOS) |
9 #import <CoreBluetooth/CoreBluetooth.h> | 9 #import <CoreBluetooth/CoreBluetooth.h> |
10 #else | 10 #else |
11 #import <IOBluetooth/IOBluetooth.h> | 11 #import <IOBluetooth/IOBluetooth.h> |
12 #endif | 12 #endif |
13 | 13 |
14 #include "base/mac/scoped_nsobject.h" | 14 #include "base/mac/scoped_nsobject.h" |
15 #include "base/mac/sdk_forward_declarations.h" | 15 #include "base/mac/sdk_forward_declarations.h" |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
73 // |bridge_| as its delegate. Only for use on OSX 10.7 or later, where | 73 // |bridge_| as its delegate. Only for use on OSX 10.7 or later, where |
74 // CoreBluetooth is available. | 74 // CoreBluetooth is available. |
75 virtual void SetManagerForTesting(CBCentralManager* manager); | 75 virtual void SetManagerForTesting(CBCentralManager* manager); |
76 | 76 |
77 friend class BluetoothLowEnergyDiscoveryManagerMacDelegate; | 77 friend class BluetoothLowEnergyDiscoveryManagerMacDelegate; |
78 friend class BluetoothAdapterMacTest; | 78 friend class BluetoothAdapterMacTest; |
79 | 79 |
80 // Observer interested in notifications from us. | 80 // Observer interested in notifications from us. |
81 Observer* observer_; | 81 Observer* observer_; |
82 | 82 |
83 // Underlying CoreBluetooth central manager. | 83 // Underlying CoreBluetooth central manager. Should only be instantiated on |
84 // | 84 // OS X >= 10.10 as was found to crash on the mac_chromium_rel_ng trybot |
85 // Note: Intentionally leaked. Deallocating CBCentralManager | 85 // running 10.9.5. May also cause blued to crash on OS X 10.9.5 |
86 // results in a crash, at least when running OSX 10.9.5 on a | 86 // (crbug.com/506287). |
87 // mac_chromuim_rel_ng trybot. On the other hand, restricting |manager_| use | |
88 // to 10.10 and later would mean the code is unrun and untested by the current | |
89 // trybots. To work around this we call retain on |manager_| after allocation, | |
90 // so that the object is leaked. | |
91 base::scoped_nsobject<CBCentralManager> manager_; | 87 base::scoped_nsobject<CBCentralManager> manager_; |
92 | 88 |
93 // Discovery has been initiated by calling the API StartDiscovery(). | 89 // Discovery has been initiated by calling the API StartDiscovery(). |
94 bool discovering_; | 90 bool discovering_; |
95 | 91 |
96 // A discovery has been initiated but has not started yet because it's | 92 // A discovery has been initiated but has not started yet because it's |
97 // waiting for Bluetooth to turn on. | 93 // waiting for Bluetooth to turn on. |
98 bool pending_; | 94 bool pending_; |
99 | 95 |
100 // Delegate of the central manager. | 96 // Delegate of the central manager. |
101 base::scoped_nsobject<BluetoothLowEnergyDiscoveryManagerMacBridge> bridge_; | 97 base::scoped_nsobject<BluetoothLowEnergyDiscoveryManagerMacBridge> bridge_; |
102 | 98 |
103 // List of service UUIDs to scan. | 99 // List of service UUIDs to scan. |
104 BluetoothDevice::UUIDList services_uuids_; | 100 BluetoothDevice::UUIDList services_uuids_; |
105 | 101 |
106 DISALLOW_COPY_AND_ASSIGN(BluetoothLowEnergyDiscoveryManagerMac); | 102 DISALLOW_COPY_AND_ASSIGN(BluetoothLowEnergyDiscoveryManagerMac); |
107 }; | 103 }; |
108 | 104 |
109 } // namespace device | 105 } // namespace device |
110 | 106 |
111 #endif // DEVICE_BLUETOOTH_BLUETOOTH_LOW_ENERGY_DISCOVERY_MANAGER_MAC_H_ | 107 #endif // DEVICE_BLUETOOTH_BLUETOOTH_LOW_ENERGY_DISCOVERY_MANAGER_MAC_H_ |
OLD | NEW |