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

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

Issue 2339253002: bluetooth: mac: add connected LE devices to chooser (Closed)
Patch Set: More tests, and fixing ortuno's comments Created 4 years, 1 month 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 <memory> 10 #include <memory>
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 bool IsPresent() const override; 63 bool IsPresent() const override;
64 bool IsPowered() const override; 64 bool IsPowered() const override;
65 void SetPowered(bool powered, 65 void SetPowered(bool powered,
66 const base::Closure& callback, 66 const base::Closure& callback,
67 const ErrorCallback& error_callback) override; 67 const ErrorCallback& error_callback) override;
68 bool IsDiscoverable() const override; 68 bool IsDiscoverable() const override;
69 void SetDiscoverable(bool discoverable, 69 void SetDiscoverable(bool discoverable,
70 const base::Closure& callback, 70 const base::Closure& callback,
71 const ErrorCallback& error_callback) override; 71 const ErrorCallback& error_callback) override;
72 bool IsDiscovering() const override; 72 bool IsDiscovering() const override;
73 std::unordered_map<BluetoothDevice*, BluetoothDevice::UUIDSet>
74 RetrieveGattConnectedDevicesWithDiscoveryFilter(
75 const BluetoothDiscoveryFilter& discovery_filter) override;
73 UUIDList GetUUIDs() const override; 76 UUIDList GetUUIDs() const override;
74 void CreateRfcommService( 77 void CreateRfcommService(
75 const BluetoothUUID& uuid, 78 const BluetoothUUID& uuid,
76 const ServiceOptions& options, 79 const ServiceOptions& options,
77 const CreateServiceCallback& callback, 80 const CreateServiceCallback& callback,
78 const CreateServiceErrorCallback& error_callback) override; 81 const CreateServiceErrorCallback& error_callback) override;
79 void CreateL2capService( 82 void CreateL2capService(
80 const BluetoothUUID& uuid, 83 const BluetoothUUID& uuid,
81 const ServiceOptions& options, 84 const ServiceOptions& options,
82 const CreateServiceCallback& callback, 85 const CreateServiceCallback& callback,
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
169 NSDictionary* advertisement_data, 172 NSDictionary* advertisement_data,
170 int rssi) override; 173 int rssi) override;
171 174
172 // Updates |devices_| when there is a change to the CBCentralManager's state. 175 // Updates |devices_| when there is a change to the CBCentralManager's state.
173 void LowEnergyCentralManagerUpdatedState(); 176 void LowEnergyCentralManagerUpdatedState();
174 177
175 // Updates |devices_| to include the currently paired devices and notifies 178 // Updates |devices_| to include the currently paired devices and notifies
176 // observers. 179 // observers.
177 void AddPairedDevices(); 180 void AddPairedDevices();
178 181
182 // Returns the list of devices that are connected by other applications than
183 // Chromium, based on a service UUID. If no uuid is given, generic access
184 // service (1800) is used (since CoreBluetooth requires to use a service).
185 std::vector<BluetoothDevice*> RetrieveGattConnectedDevicesWithService(
186 const BluetoothUUID* uuid);
187
179 // Returns the BLE device associated with the CoreBluetooth peripheral. 188 // Returns the BLE device associated with the CoreBluetooth peripheral.
180 BluetoothLowEnergyDeviceMac* GetBluetoothLowEnergyDeviceMac( 189 BluetoothLowEnergyDeviceMac* GetBluetoothLowEnergyDeviceMac(
181 CBPeripheral* peripheral); 190 CBPeripheral* peripheral);
182 191
192 // Returns true if a new device collides with an existing device.
193 bool DoesCollideWithKnownDevice(CBPeripheral* peripheral,
194 BluetoothLowEnergyDeviceMac* device_mac);
195
183 std::string address_; 196 std::string address_;
184 bool classic_powered_; 197 bool classic_powered_;
185 int num_discovery_sessions_; 198 int num_discovery_sessions_;
186 199
187 // Cached name. Updated in GetName if should_update_name_ is true. 200 // Cached name. Updated in GetName if should_update_name_ is true.
188 // 201 //
189 // For performance reasons, cache the adapter's name. It's not uncommon for 202 // For performance reasons, cache the adapter's name. It's not uncommon for
190 // a call to [controller nameAsString] to take tens of milliseconds. Note 203 // a call to [controller nameAsString] to take tens of milliseconds. Note
191 // that this caching strategy might result in clients receiving a stale 204 // that this caching strategy might result in clients receiving a stale
192 // name. If this is a significant issue, then some more sophisticated 205 // name. If this is a significant issue, then some more sophisticated
(...skipping 19 matching lines...) Expand all
212 scoped_refptr<base::SequencedTaskRunner> ui_task_runner_; 225 scoped_refptr<base::SequencedTaskRunner> ui_task_runner_;
213 226
214 base::WeakPtrFactory<BluetoothAdapterMac> weak_ptr_factory_; 227 base::WeakPtrFactory<BluetoothAdapterMac> weak_ptr_factory_;
215 228
216 DISALLOW_COPY_AND_ASSIGN(BluetoothAdapterMac); 229 DISALLOW_COPY_AND_ASSIGN(BluetoothAdapterMac);
217 }; 230 };
218 231
219 } // namespace device 232 } // namespace device
220 233
221 #endif // DEVICE_BLUETOOTH_BLUETOOTH_ADAPTER_MAC_H_ 234 #endif // DEVICE_BLUETOOTH_BLUETOOTH_ADAPTER_MAC_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698