| OLD | NEW |
| 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 #include "device/bluetooth/bluetooth_adapter_mac.h" | 5 #include "device/bluetooth/bluetooth_adapter_mac.h" |
| 6 | 6 |
| 7 #import <IOBluetooth/objc/IOBluetoothDevice.h> | 7 #import <IOBluetooth/objc/IOBluetoothDevice.h> |
| 8 #import <IOBluetooth/objc/IOBluetoothHostController.h> | 8 #import <IOBluetooth/objc/IOBluetoothHostController.h> |
| 9 #include <stddef.h> | 9 #include <stddef.h> |
| 10 | 10 |
| (...skipping 497 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 508 // hash the probability of this occuring with 10,000 devices | 508 // hash the probability of this occuring with 10,000 devices |
| 509 // simultaneously present is 1e-6 (see | 509 // simultaneously present is 1e-6 (see |
| 510 // https://en.wikipedia.org/wiki/Birthday_problem#Probability_table). We | 510 // https://en.wikipedia.org/wiki/Birthday_problem#Probability_table). We |
| 511 // ignore the second device by returning. | 511 // ignore the second device by returning. |
| 512 return; | 512 return; |
| 513 } | 513 } |
| 514 | 514 |
| 515 // A device has an update. | 515 // A device has an update. |
| 516 VLOG(2) << "LowEnergyDeviceUpdated"; | 516 VLOG(2) << "LowEnergyDeviceUpdated"; |
| 517 device_mac->Update(advertisement_data, rssi); | 517 device_mac->Update(advertisement_data, rssi); |
| 518 // TODO(scheib): Call DeviceChanged only if UUIDs change. crbug.com/547106 | 518 |
| 519 FOR_EACH_OBSERVER(BluetoothAdapter::Observer, observers_, | 519 FOR_EACH_OBSERVER(BluetoothAdapter::Observer, observers_, |
| 520 DeviceChanged(this, device_mac)); | 520 DeviceChanged(this, device_mac)); |
| 521 } | 521 } |
| 522 | 522 |
| 523 // TODO(krstnmnlsn): Implement. crbug.com/511025 | 523 // TODO(krstnmnlsn): Implement. crbug.com/511025 |
| 524 void BluetoothAdapterMac::LowEnergyCentralManagerUpdatedState() {} | 524 void BluetoothAdapterMac::LowEnergyCentralManagerUpdatedState() {} |
| 525 | 525 |
| 526 void BluetoothAdapterMac::AddPairedDevices() { | 526 void BluetoothAdapterMac::AddPairedDevices() { |
| 527 // Add any new paired devices. | 527 // Add any new paired devices. |
| 528 for (IOBluetoothDevice* device in [IOBluetoothDevice pairedDevices]) { | 528 for (IOBluetoothDevice* device in [IOBluetoothDevice pairedDevices]) { |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 591 std::string device_address = | 591 std::string device_address = |
| 592 BluetoothLowEnergyDeviceMac::GetPeripheralHashAddress(peripheral); | 592 BluetoothLowEnergyDeviceMac::GetPeripheralHashAddress(peripheral); |
| 593 DevicesMap::const_iterator iter = devices_.find(device_address); | 593 DevicesMap::const_iterator iter = devices_.find(device_address); |
| 594 if (iter == devices_.end()) { | 594 if (iter == devices_.end()) { |
| 595 return nil; | 595 return nil; |
| 596 } | 596 } |
| 597 return static_cast<BluetoothLowEnergyDeviceMac*>(iter->second); | 597 return static_cast<BluetoothLowEnergyDeviceMac*>(iter->second); |
| 598 } | 598 } |
| 599 | 599 |
| 600 } // namespace device | 600 } // namespace device |
| OLD | NEW |