| 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_low_energy_win_fake.h" | 5 #include "device/bluetooth/bluetooth_low_energy_win_fake.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 | 8 |
| 9 #include "base/memory/ptr_util.h" | 9 #include "base/memory/ptr_util.h" |
| 10 #include "base/strings/stringprintf.h" | 10 #include "base/strings/stringprintf.h" |
| (...skipping 455 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 466 target_characteristic->value.reset(win_value); | 466 target_characteristic->value.reset(win_value); |
| 467 } | 467 } |
| 468 | 468 |
| 469 void BluetoothLowEnergyWrapperFake:: | 469 void BluetoothLowEnergyWrapperFake:: |
| 470 SimulateCharacteristicValueChangeNotification( | 470 SimulateCharacteristicValueChangeNotification( |
| 471 GattCharacteristic* characteristic) { | 471 GattCharacteristic* characteristic) { |
| 472 GattCharacteristic* target_characteristic = characteristic; | 472 GattCharacteristic* target_characteristic = characteristic; |
| 473 if (target_characteristic == nullptr) | 473 if (target_characteristic == nullptr) |
| 474 target_characteristic = remembered_characteristic_; | 474 target_characteristic = remembered_characteristic_; |
| 475 CHECK(target_characteristic); | 475 CHECK(target_characteristic); |
| 476 for (const auto& observer : target_characteristic->observers) { | 476 for (auto* observer : target_characteristic->observers) { |
| 477 GattCharacteristicObserverTable::const_iterator it = | 477 GattCharacteristicObserverTable::const_iterator it = |
| 478 gatt_characteristic_observers_.find(observer); | 478 gatt_characteristic_observers_.find(observer); |
| 479 // Check if |observer| has been unregistered by UnregisterGattEvent. | 479 // Check if |observer| has been unregistered by UnregisterGattEvent. |
| 480 if (it != gatt_characteristic_observers_.end()) { | 480 if (it != gatt_characteristic_observers_.end()) { |
| 481 BLUETOOTH_GATT_VALUE_CHANGED_EVENT event; | 481 BLUETOOTH_GATT_VALUE_CHANGED_EVENT event; |
| 482 event.ChangedAttributeHandle = | 482 event.ChangedAttributeHandle = |
| 483 target_characteristic->characteristic_info->AttributeHandle; | 483 target_characteristic->characteristic_info->AttributeHandle; |
| 484 event.CharacteristicValueDataSize = | 484 event.CharacteristicValueDataSize = |
| 485 target_characteristic->value->DataSize + sizeof(ULONG); | 485 target_characteristic->value->DataSize + sizeof(ULONG); |
| 486 event.CharacteristicValue = target_characteristic->value.get(); | 486 event.CharacteristicValue = target_characteristic->value.get(); |
| (...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 636 std::string BluetoothLowEnergyWrapperFake::BluetoothAddressToCanonicalString( | 636 std::string BluetoothLowEnergyWrapperFake::BluetoothAddressToCanonicalString( |
| 637 const BLUETOOTH_ADDRESS& btha) { | 637 const BLUETOOTH_ADDRESS& btha) { |
| 638 std::string result = base::StringPrintf( | 638 std::string result = base::StringPrintf( |
| 639 "%02X:%02X:%02X:%02X:%02X:%02X", btha.rgBytes[5], btha.rgBytes[4], | 639 "%02X:%02X:%02X:%02X:%02X:%02X", btha.rgBytes[5], btha.rgBytes[4], |
| 640 btha.rgBytes[3], btha.rgBytes[2], btha.rgBytes[1], btha.rgBytes[0]); | 640 btha.rgBytes[3], btha.rgBytes[2], btha.rgBytes[1], btha.rgBytes[0]); |
| 641 return result; | 641 return result; |
| 642 } | 642 } |
| 643 | 643 |
| 644 } // namespace win | 644 } // namespace win |
| 645 } // namespace device | 645 } // namespace device |
| OLD | NEW |