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

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

Issue 2242833002: Bluetooth: mac: add connected BLE devices at startup Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Device: bluetooth: use untyped containers Created 4 years, 3 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
« no previous file with comments | « no previous file | device/bluetooth/bluetooth_adapter_mac.mm » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 <memory> 10 #include <memory>
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 42
43 class DEVICE_BLUETOOTH_EXPORT BluetoothAdapterMac 43 class DEVICE_BLUETOOTH_EXPORT BluetoothAdapterMac
44 : public BluetoothAdapter, 44 : public BluetoothAdapter,
45 public BluetoothDiscoveryManagerMac::Observer, 45 public BluetoothDiscoveryManagerMac::Observer,
46 public BluetoothLowEnergyDiscoveryManagerMac::Observer { 46 public BluetoothLowEnergyDiscoveryManagerMac::Observer {
47 public: 47 public:
48 static base::WeakPtr<BluetoothAdapterMac> CreateAdapter(); 48 static base::WeakPtr<BluetoothAdapterMac> CreateAdapter();
49 static base::WeakPtr<BluetoothAdapterMac> CreateAdapterForTest( 49 static base::WeakPtr<BluetoothAdapterMac> CreateAdapterForTest(
50 std::string name, 50 std::string name,
51 std::string address, 51 std::string address,
52 scoped_refptr<base::SequencedTaskRunner> ui_task_runner); 52 scoped_refptr<base::SequencedTaskRunner> ui_task_runner,
53 CBCentralManager* central_manager = nil);
53 54
54 // Converts CBUUID into BluetoothUUID 55 // Converts CBUUID into BluetoothUUID
55 static BluetoothUUID BluetoothUUIDWithCBUUID(CBUUID* UUID); 56 static BluetoothUUID BluetoothUUIDWithCBUUID(CBUUID* UUID);
56 57
57 // BluetoothAdapter overrides: 58 // BluetoothAdapter overrides:
58 std::string GetAddress() const override; 59 std::string GetAddress() const override;
59 std::string GetName() const override; 60 std::string GetName() const override;
60 void SetName(const std::string& name, 61 void SetName(const std::string& name,
61 const base::Closure& callback, 62 const base::Closure& callback,
62 const ErrorCallback& error_callback) override; 63 const ErrorCallback& error_callback) override;
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
170 void ClassicDeviceAdded(IOBluetoothDevice* device); 171 void ClassicDeviceAdded(IOBluetoothDevice* device);
171 172
172 // BluetoothLowEnergyDiscoveryManagerMac::Observer override: 173 // BluetoothLowEnergyDiscoveryManagerMac::Observer override:
173 void LowEnergyDeviceUpdated(CBPeripheral* peripheral, 174 void LowEnergyDeviceUpdated(CBPeripheral* peripheral,
174 NSDictionary* advertisement_data, 175 NSDictionary* advertisement_data,
175 int rssi) override; 176 int rssi) override;
176 177
177 // Updates |devices_| when there is a change to the CBCentralManager's state. 178 // Updates |devices_| when there is a change to the CBCentralManager's state.
178 void LowEnergyCentralManagerUpdatedState(); 179 void LowEnergyCentralManagerUpdatedState();
179 180
180 // Updates |devices_| to include the currently paired devices and notifies 181 // Updates |devices_| to include the currently paired Bluetooth Classic
181 // observers. 182 // devices and notifies observers.
182 void AddPairedDevices(); 183 void AddPairedClassicDevices();
184
185 // Updates |devices_| to include the currently connected Bluetooth Low Energy
186 // devices and notifies observers.
187 void AddConnectedLowEnergyDevices();
183 188
184 // Returns the BLE device associated with the CoreBluetooth peripheral. 189 // Returns the BLE device associated with the CoreBluetooth peripheral.
185 BluetoothLowEnergyDeviceMac* GetBluetoothLowEnergyDeviceMac( 190 BluetoothLowEnergyDeviceMac* GetBluetoothLowEnergyDeviceMac(
186 CBPeripheral* peripheral); 191 CBPeripheral* peripheral);
187 192
188 std::string address_; 193 std::string address_;
189 std::string name_; 194 std::string name_;
190 bool classic_powered_; 195 bool classic_powered_;
191 int num_discovery_sessions_; 196 int num_discovery_sessions_;
192 197
(...skipping 12 matching lines...) Expand all
205 scoped_refptr<base::SequencedTaskRunner> ui_task_runner_; 210 scoped_refptr<base::SequencedTaskRunner> ui_task_runner_;
206 211
207 base::WeakPtrFactory<BluetoothAdapterMac> weak_ptr_factory_; 212 base::WeakPtrFactory<BluetoothAdapterMac> weak_ptr_factory_;
208 213
209 DISALLOW_COPY_AND_ASSIGN(BluetoothAdapterMac); 214 DISALLOW_COPY_AND_ASSIGN(BluetoothAdapterMac);
210 }; 215 };
211 216
212 } // namespace device 217 } // namespace device
213 218
214 #endif // DEVICE_BLUETOOTH_BLUETOOTH_ADAPTER_MAC_H_ 219 #endif // DEVICE_BLUETOOTH_BLUETOOTH_ADAPTER_MAC_H_
OLDNEW
« no previous file with comments | « no previous file | device/bluetooth/bluetooth_adapter_mac.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698