Chromium Code Reviews| Index: device/bluetooth/bluetooth_adapter_mac.mm |
| diff --git a/device/bluetooth/bluetooth_adapter_mac.mm b/device/bluetooth/bluetooth_adapter_mac.mm |
| index 0dfb7991ca4587d78faca8c4378900d86dbc08a7..3c60c6b8c868d1fd898c65dbee749cb37817fded 100644 |
| --- a/device/bluetooth/bluetooth_adapter_mac.mm |
| +++ b/device/bluetooth/bluetooth_adapter_mac.mm |
| @@ -388,11 +388,35 @@ void BluetoothAdapterMac::ClassicDeviceAdded(IOBluetoothDevice* device) { |
| DeviceAdded(this, devices_[device_address])); |
| } |
| -// TODO(krstnmnlsn): Implement method. http://crbug.com/496987. |
| void BluetoothAdapterMac::LowEnergyDeviceUpdated( |
| CBPeripheral* peripheral, |
| NSDictionary* advertisementData, |
| int rssi) { |
| + std::string device_address = |
| + BluetoothLowEnergyDeviceMac::GetPeripheralHashAddress(peripheral); |
| + |
| + if (devices_.count(device_address)) { |
|
scheib
2015/07/08 05:20:36
Push back if you like, but here's my take on testi
krstnmnlsn
2015/07/13 17:26:23
Done.
|
| + if (devices_[device_address]->GetIdentifier() != |
| + BluetoothLowEnergyDeviceMac::GetPeripheralIdentifier(peripheral)) { |
| + // Collision, two identifiers map to the same hash address. With a 48 bit |
| + // hash the probability of this occuring with 10,000 devices |
| + // simultaneously present is 1e-6, so we simply return. |
|
scheib
2015/07/08 05:20:36
Cite the source for those numbers. Also explain ha
krstnmnlsn
2015/07/13 17:26:23
Done.
|
| + return; |
| + } |
| + // A device has an update. |
| + BluetoothLowEnergyDeviceMac* old_device = |
| + static_cast<BluetoothLowEnergyDeviceMac*>(devices_[device_address]); |
| + old_device->Update(peripheral, advertisementData, rssi); |
| + FOR_EACH_OBSERVER(BluetoothAdapter::Observer, observers_, |
|
scheib
2015/07/08 05:20:36
I think only call DeviceChanged if data about the
krstnmnlsn
2015/07/13 17:26:23
(after offline discussion) leaving this for now, a
scheib
2015/07/13 18:24:39
Acknowledged.
|
| + DeviceChanged(this, old_device)); |
| + return; |
| + } |
| + |
| + // A new device has been found. |
| + devices_[device_address] = |
| + new BluetoothLowEnergyDeviceMac(peripheral, advertisementData, rssi); |
| + FOR_EACH_OBSERVER(BluetoothAdapter::Observer, observers_, |
| + DeviceAdded(this, devices_[device_address])); |
| } |
| void BluetoothAdapterMac::RemoveTimedOutDevices() { |