| 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 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 243 target_characteristic->value.reset(win_value); | 243 target_characteristic->value.reset(win_value); |
| 244 if (observer_) | 244 if (observer_) |
| 245 observer_->OnWriteGattCharacteristicValue(win_value); | 245 observer_->OnWriteGattCharacteristicValue(win_value); |
| 246 return S_OK; | 246 return S_OK; |
| 247 } | 247 } |
| 248 | 248 |
| 249 HRESULT BluetoothLowEnergyWrapperFake::RegisterGattEvents( | 249 HRESULT BluetoothLowEnergyWrapperFake::RegisterGattEvents( |
| 250 base::FilePath& service_path, | 250 base::FilePath& service_path, |
| 251 BTH_LE_GATT_EVENT_TYPE type, | 251 BTH_LE_GATT_EVENT_TYPE type, |
| 252 PVOID event_parameter, | 252 PVOID event_parameter, |
| 253 PFNBLUETOOTH_GATT_EVENT_CALLBACK callback, | 253 PFNBLUETOOTH_GATT_EVENT_CALLBACK_CORRECTED callback, |
| 254 PVOID context, | 254 PVOID context, |
| 255 BLUETOOTH_GATT_EVENT_HANDLE* out_handle) { | 255 BLUETOOTH_GATT_EVENT_HANDLE* out_handle) { |
| 256 // Right now, only CharacteristicValueChangedEvent is supported. | 256 // Right now, only CharacteristicValueChangedEvent is supported. |
| 257 CHECK(CharacteristicValueChangedEvent == type); | 257 CHECK(CharacteristicValueChangedEvent == type); |
| 258 | 258 |
| 259 std::unique_ptr<GattCharacteristicObserver> observer( | 259 std::unique_ptr<GattCharacteristicObserver> observer( |
| 260 new GattCharacteristicObserver()); | 260 new GattCharacteristicObserver()); |
| 261 observer->callback = callback; | 261 observer->callback = callback; |
| 262 observer->context = context; | 262 observer->context = context; |
| 263 *out_handle = (BLUETOOTH_GATT_EVENT_HANDLE)observer.get(); | 263 *out_handle = (BLUETOOTH_GATT_EVENT_HANDLE)observer.get(); |
| (...skipping 372 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 |