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

Side by Side Diff: device/bluetooth/bluetooth_adapter_mac.h

Issue 1538173003: Implementing GATT connection/disconnect on OS X. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Removing chromium.gyp_env Created 4 years, 11 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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_ADAPTER_MAC_H_ 5 #ifndef DEVICE_BLUETOOTH_BLUETOOTH_ADAPTER_MAC_H_
6 #define DEVICE_BLUETOOTH_BLUETOOTH_ADAPTER_MAC_H_ 6 #define DEVICE_BLUETOOTH_BLUETOOTH_ADAPTER_MAC_H_
7 7
8 #include <IOKit/IOReturn.h> 8 #include <IOKit/IOReturn.h>
9 9
10 #include <string> 10 #include <string>
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 90
91 // Registers that a new |device| has connected to the local host. 91 // Registers that a new |device| has connected to the local host.
92 void DeviceConnected(IOBluetoothDevice* device); 92 void DeviceConnected(IOBluetoothDevice* device);
93 93
94 // We only use CoreBluetooth when OS X >= 10.10. This because the 94 // We only use CoreBluetooth when OS X >= 10.10. This because the
95 // CBCentralManager destructor was found to crash on the mac_chromium_rel_ng 95 // CBCentralManager destructor was found to crash on the mac_chromium_rel_ng
96 // builder running 10.9.5. May also cause blued to crash on OS X 10.9.5 96 // builder running 10.9.5. May also cause blued to crash on OS X 10.9.5
97 // (crbug.com/506287). 97 // (crbug.com/506287).
98 static bool IsLowEnergyAvailable(); 98 static bool IsLowEnergyAvailable();
99 99
100 // Resets |low_energy_central_manager_| to |central_manager| and sets 100 void CreateGattConnection(BluetoothLowEnergyDeviceMac* device_mac);
scheib 2016/01/27 01:09:03 Comment group of methods. I see that these provide
jlebel 2016/02/10 13:38:51 Done.
101 // |low_energy_central_manager_delegate_| as the manager's delegate. Should 101 void DidConnectPeripheral(CBPeripheral* peripheral);
102 // be called only when |IsLowEnergyAvailable()|. 102 void DisconnectGatt(BluetoothLowEnergyDeviceMac* device_mac);
103 void SetCentralManagerForTesting(CBCentralManager* central_manager);
104 103
105 protected: 104 protected:
106 // BluetoothAdapter override: 105 // BluetoothAdapter override:
107 void RemovePairingDelegateInternal( 106 void RemovePairingDelegateInternal(
108 device::BluetoothDevice::PairingDelegate* pairing_delegate) override; 107 device::BluetoothDevice::PairingDelegate* pairing_delegate) override;
109 108
109 // Resets |low_energy_central_manager_| to |central_manager| and sets
110 // |low_energy_central_manager_delegate_| as the manager's delegate. Should
111 // be called only when |IsLowEnergyAvailable()|.
112 void SetCentralManagerForTesting(CBCentralManager* central_manager);
113 CBCentralManager* GetCentralManagerForTesting();
114
110 private: 115 private:
111 // The length of time that must elapse since the last Inquiry response (on 116 // The length of time that must elapse since the last Inquiry response (on
112 // Classic devices) or call to BluetoothLowEnergyDevice::Update() (on Low 117 // Classic devices) or call to BluetoothLowEnergyDevice::Update() (on Low
113 // Energy) before a discovered device is considered to be no longer available. 118 // Energy) before a discovered device is considered to be no longer available.
114 const static NSTimeInterval kDiscoveryTimeoutSec; 119 const static NSTimeInterval kDiscoveryTimeoutSec;
115 120
116 friend class BluetoothTestMac; 121 friend class BluetoothTestMac;
117 friend class BluetoothAdapterMacTest; 122 friend class BluetoothAdapterMacTest;
118 friend class BluetoothLowEnergyCentralManagerBridge; 123 friend class BluetoothLowEnergyCentralManagerBridge;
119 124
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
182 scoped_refptr<base::SequencedTaskRunner> ui_task_runner_; 187 scoped_refptr<base::SequencedTaskRunner> ui_task_runner_;
183 188
184 base::WeakPtrFactory<BluetoothAdapterMac> weak_ptr_factory_; 189 base::WeakPtrFactory<BluetoothAdapterMac> weak_ptr_factory_;
185 190
186 DISALLOW_COPY_AND_ASSIGN(BluetoothAdapterMac); 191 DISALLOW_COPY_AND_ASSIGN(BluetoothAdapterMac);
187 }; 192 };
188 193
189 } // namespace device 194 } // namespace device
190 195
191 #endif // DEVICE_BLUETOOTH_BLUETOOTH_ADAPTER_MAC_H_ 196 #endif // DEVICE_BLUETOOTH_BLUETOOTH_ADAPTER_MAC_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698