Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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.h" | 5 #include "device/bluetooth/bluetooth_low_energy_win.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/files/file.h" | 9 #include "base/files/file.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 819 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 830 base::File file(service_path, base::File::FLAG_OPEN | base::File::FLAG_READ | | 830 base::File file(service_path, base::File::FLAG_OPEN | base::File::FLAG_READ | |
| 831 base::File::FLAG_WRITE); | 831 base::File::FLAG_WRITE); |
| 832 if (!file.IsValid()) | 832 if (!file.IsValid()) |
| 833 return HRESULT_FROM_WIN32(ERROR_OPEN_FAILED); | 833 return HRESULT_FROM_WIN32(ERROR_OPEN_FAILED); |
| 834 | 834 |
| 835 return BluetoothGATTSetCharacteristicValue(file.GetPlatformFile(), | 835 return BluetoothGATTSetCharacteristicValue(file.GetPlatformFile(), |
| 836 characteristic, new_value, NULL, | 836 characteristic, new_value, NULL, |
| 837 BLUETOOTH_GATT_FLAG_NONE); | 837 BLUETOOTH_GATT_FLAG_NONE); |
| 838 } | 838 } |
| 839 | 839 |
| 840 HRESULT BluetoothLowEnergyWrapper::RegisterGattEvents( | |
| 841 base::FilePath& service_path, | |
| 842 BTH_LE_GATT_EVENT_TYPE event_type, | |
| 843 PVOID event_parameter, | |
| 844 PFNBLUETOOTH_GATT_EVENT_CALLBACK callback, | |
| 845 PVOID context, | |
| 846 BLUETOOTH_GATT_EVENT_HANDLE* out_handle) { | |
| 847 base::File file(service_path, base::File::FLAG_OPEN | base::File::FLAG_READ); | |
|
ortuno
2016/03/07 18:48:45
I'm curious. If BluetoothLowEnergyWrapper is suppo
gogerald1
2016/03/07 22:52:49
Here open file opens a device in OS. It makes this
ortuno
2016/03/08 00:05:36
Ah that makes sense.
| |
| 848 if (!file.IsValid()) | |
| 849 return HRESULT_FROM_WIN32(ERROR_OPEN_FAILED); | |
| 850 return BluetoothGATTRegisterEvent(file.GetPlatformFile(), event_type, | |
| 851 event_parameter, callback, context, | |
| 852 out_handle, BLUETOOTH_GATT_FLAG_NONE); | |
| 853 } | |
| 854 | |
| 855 HRESULT BluetoothLowEnergyWrapper::UnregisterGattEvent( | |
| 856 BLUETOOTH_GATT_EVENT_HANDLE event_handle) { | |
| 857 return BluetoothGATTUnregisterEvent(event_handle, BLUETOOTH_GATT_FLAG_NONE); | |
| 858 } | |
| 859 | |
| 840 } // namespace win | 860 } // namespace win |
| 841 } // namespace device | 861 } // namespace device |
| OLD | NEW |