Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(147)

Side by Side Diff: device/bluetooth/bluetooth_low_energy_win.cc

Issue 2317773002: Fix bluetooth callback function declaration (Closed)
Patch Set: Updating typedef comment per code-review feedback Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 <memory> 7 #include <memory>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/files/file.h" 10 #include "base/files/file.h"
(...skipping 818 matching lines...) Expand 10 before | Expand all | Expand 10 after
829 829
830 return BluetoothGATTSetCharacteristicValue(file.GetPlatformFile(), 830 return BluetoothGATTSetCharacteristicValue(file.GetPlatformFile(),
831 characteristic, new_value, NULL, 831 characteristic, new_value, NULL,
832 BLUETOOTH_GATT_FLAG_NONE); 832 BLUETOOTH_GATT_FLAG_NONE);
833 } 833 }
834 834
835 HRESULT BluetoothLowEnergyWrapper::RegisterGattEvents( 835 HRESULT BluetoothLowEnergyWrapper::RegisterGattEvents(
836 base::FilePath& service_path, 836 base::FilePath& service_path,
837 BTH_LE_GATT_EVENT_TYPE event_type, 837 BTH_LE_GATT_EVENT_TYPE event_type,
838 PVOID event_parameter, 838 PVOID event_parameter,
839 PFNBLUETOOTH_GATT_EVENT_CALLBACK callback, 839 PFNBLUETOOTH_GATT_EVENT_CALLBACK_CORRECTED callback,
840 PVOID context, 840 PVOID context,
841 BLUETOOTH_GATT_EVENT_HANDLE* out_handle) { 841 BLUETOOTH_GATT_EVENT_HANDLE* out_handle) {
842 base::File file(service_path, base::File::FLAG_OPEN | base::File::FLAG_READ); 842 base::File file(service_path, base::File::FLAG_OPEN | base::File::FLAG_READ);
843 if (!file.IsValid()) 843 if (!file.IsValid())
844 return HRESULT_FROM_WIN32(ERROR_OPEN_FAILED); 844 return HRESULT_FROM_WIN32(ERROR_OPEN_FAILED);
845 return BluetoothGATTRegisterEvent(file.GetPlatformFile(), event_type, 845 // Cast to the official callback type for compatibility with the Windows
846 event_parameter, callback, context, 846 // 10.0.10586 definition, even though it is incorrect. This cast can be
847 out_handle, BLUETOOTH_GATT_FLAG_NONE); 847 // removed when we mandate building Chromium with the 10.0.14393 SDK or
848 // higher.
849 return BluetoothGATTRegisterEvent(
850 file.GetPlatformFile(), event_type, event_parameter,
851 reinterpret_cast<PFNBLUETOOTH_GATT_EVENT_CALLBACK>(callback), context,
852 out_handle, BLUETOOTH_GATT_FLAG_NONE);
848 } 853 }
849 854
850 HRESULT BluetoothLowEnergyWrapper::UnregisterGattEvent( 855 HRESULT BluetoothLowEnergyWrapper::UnregisterGattEvent(
851 BLUETOOTH_GATT_EVENT_HANDLE event_handle) { 856 BLUETOOTH_GATT_EVENT_HANDLE event_handle) {
852 return BluetoothGATTUnregisterEvent(event_handle, BLUETOOTH_GATT_FLAG_NONE); 857 return BluetoothGATTUnregisterEvent(event_handle, BLUETOOTH_GATT_FLAG_NONE);
853 } 858 }
854 859
855 HRESULT BluetoothLowEnergyWrapper::WriteDescriptorValue( 860 HRESULT BluetoothLowEnergyWrapper::WriteDescriptorValue(
856 base::FilePath& service_path, 861 base::FilePath& service_path,
857 const PBTH_LE_GATT_DESCRIPTOR descriptor, 862 const PBTH_LE_GATT_DESCRIPTOR descriptor,
858 PBTH_LE_GATT_DESCRIPTOR_VALUE new_value) { 863 PBTH_LE_GATT_DESCRIPTOR_VALUE new_value) {
859 base::File file(service_path, base::File::FLAG_OPEN | base::File::FLAG_READ | 864 base::File file(service_path, base::File::FLAG_OPEN | base::File::FLAG_READ |
860 base::File::FLAG_WRITE); 865 base::File::FLAG_WRITE);
861 if (!file.IsValid()) 866 if (!file.IsValid())
862 return HRESULT_FROM_WIN32(ERROR_OPEN_FAILED); 867 return HRESULT_FROM_WIN32(ERROR_OPEN_FAILED);
863 return BluetoothGATTSetDescriptorValue(file.GetPlatformFile(), descriptor, 868 return BluetoothGATTSetDescriptorValue(file.GetPlatformFile(), descriptor,
864 new_value, BLUETOOTH_GATT_FLAG_NONE); 869 new_value, BLUETOOTH_GATT_FLAG_NONE);
865 } 870 }
866 871
867 } // namespace win 872 } // namespace win
868 } // namespace device 873 } // namespace device
OLDNEW
« no previous file with comments | « device/bluetooth/bluetooth_low_energy_win.h ('k') | device/bluetooth/bluetooth_low_energy_win_fake.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698