| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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_remote_gatt_service_mac.h" | 5 #include "device/bluetooth/bluetooth_remote_gatt_service_mac.h" |
| 6 | 6 |
| 7 #import <CoreBluetooth/CoreBluetooth.h> | 7 #import <CoreBluetooth/CoreBluetooth.h> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 95 if (gatt_characteristic_mac) { | 95 if (gatt_characteristic_mac) { |
| 96 const std::string& identifier = gatt_characteristic_mac->GetIdentifier(); | 96 const std::string& identifier = gatt_characteristic_mac->GetIdentifier(); |
| 97 characteristic_identifier_to_remove.erase(identifier); | 97 characteristic_identifier_to_remove.erase(identifier); |
| 98 gatt_characteristic_mac->DiscoverDescriptors(); | 98 gatt_characteristic_mac->DiscoverDescriptors(); |
| 99 continue; | 99 continue; |
| 100 } | 100 } |
| 101 gatt_characteristic_mac = | 101 gatt_characteristic_mac = |
| 102 new BluetoothRemoteGattCharacteristicMac(this, cb_characteristic); | 102 new BluetoothRemoteGattCharacteristicMac(this, cb_characteristic); |
| 103 const std::string& identifier = gatt_characteristic_mac->GetIdentifier(); | 103 const std::string& identifier = gatt_characteristic_mac->GetIdentifier(); |
| 104 auto result_iter = gatt_characteristic_macs_.insert( | 104 auto result_iter = gatt_characteristic_macs_.insert( |
| 105 {identifier, base::WrapUnique(gatt_characteristic_mac)}); | 105 std::make_pair(identifier, base::WrapUnique(gatt_characteristic_mac))); |
| 106 DCHECK(result_iter.second); | 106 DCHECK(result_iter.second); |
| 107 gatt_characteristic_mac->DiscoverDescriptors(); | 107 gatt_characteristic_mac->DiscoverDescriptors(); |
| 108 GetMacAdapter()->NotifyGattCharacteristicAdded(gatt_characteristic_mac); | 108 GetMacAdapter()->NotifyGattCharacteristicAdded(gatt_characteristic_mac); |
| 109 } | 109 } |
| 110 | 110 |
| 111 for (const std::string& identifier : characteristic_identifier_to_remove) { | 111 for (const std::string& identifier : characteristic_identifier_to_remove) { |
| 112 auto pair_to_remove = gatt_characteristic_macs_.find(identifier); | 112 auto pair_to_remove = gatt_characteristic_macs_.find(identifier); |
| 113 std::unique_ptr<BluetoothRemoteGattCharacteristicMac> | 113 std::unique_ptr<BluetoothRemoteGattCharacteristicMac> |
| 114 characteristic_to_remove; | 114 characteristic_to_remove; |
| 115 pair_to_remove->second.swap(characteristic_to_remove); | 115 pair_to_remove->second.swap(characteristic_to_remove); |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 201 return pair.second->GetCBCharacteristic() == characteristic; | 201 return pair.second->GetCBCharacteristic() == characteristic; |
| 202 }); | 202 }); |
| 203 if (found == gatt_characteristic_macs_.end()) { | 203 if (found == gatt_characteristic_macs_.end()) { |
| 204 return nullptr; | 204 return nullptr; |
| 205 } else { | 205 } else { |
| 206 return found->second.get(); | 206 return found->second.get(); |
| 207 } | 207 } |
| 208 } | 208 } |
| 209 | 209 |
| 210 } // namespace device | 210 } // namespace device |
| OLD | NEW |