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

Unified Diff: device/bluetooth/bluetooth_low_energy_win.h

Issue 2317773002: Fix bluetooth callback function declaration (Closed)
Patch Set: Add comment to explain and justify cast 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | device/bluetooth/bluetooth_low_energy_win.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: device/bluetooth/bluetooth_low_energy_win.h
diff --git a/device/bluetooth/bluetooth_low_energy_win.h b/device/bluetooth/bluetooth_low_energy_win.h
index edb17e933caa729b14afed0458d59cf649bd9a25..11dbf239e1a05705c571c440f596d43c35e9db32 100644
--- a/device/bluetooth/bluetooth_low_energy_win.h
+++ b/device/bluetooth/bluetooth_low_energy_win.h
@@ -20,6 +20,19 @@
namespace device {
namespace win {
+//
+// Callback function signature for Bluetooth GATT events. This fixes a bug in
+// the prototype in the Windows 10.0.10586 SDK which is missing the CALLBACK
+// modifier. This typedef should be used throughout Chromium except when casting
scheib 2016/09/12 19:28:16 Would be nice to include the 'why' you mention in
+// to the 'official' definition when calling Microsoft functions. This allows
+// Chromium to build with 10.0.10586 or later SDKs (with the fix) while doing
+// the correct thing.
+//
+typedef VOID(CALLBACK* PFNBLUETOOTH_GATT_EVENT_CALLBACK_CORRECTED)(
+ _In_ BTH_LE_GATT_EVENT_TYPE EventType,
+ _In_ PVOID EventOutParameter,
+ _In_opt_ PVOID Context);
+
// Represents a device registry property value
class DEVICE_BLUETOOTH_EXPORT DeviceRegistryPropertyValue {
public:
@@ -181,12 +194,13 @@ class DEVICE_BLUETOOTH_EXPORT BluetoothLowEnergyWrapper {
// is the function to be invoked if the event happened. |context| is the input
// parameter to be given back through |callback|. |*out_handle| stores the
// unique handle in OS for this registration.
- virtual HRESULT RegisterGattEvents(base::FilePath& service_path,
- BTH_LE_GATT_EVENT_TYPE event_type,
- PVOID event_parameter,
- PFNBLUETOOTH_GATT_EVENT_CALLBACK callback,
- PVOID context,
- BLUETOOTH_GATT_EVENT_HANDLE* out_handle);
+ virtual HRESULT RegisterGattEvents(
+ base::FilePath& service_path,
+ BTH_LE_GATT_EVENT_TYPE event_type,
+ PVOID event_parameter,
+ PFNBLUETOOTH_GATT_EVENT_CALLBACK_CORRECTED callback,
+ PVOID context,
+ BLUETOOTH_GATT_EVENT_HANDLE* out_handle);
virtual HRESULT UnregisterGattEvent(BLUETOOTH_GATT_EVENT_HANDLE event_handle);
// Writes |descriptor| value in service with service device path
« no previous file with comments | « no previous file | device/bluetooth/bluetooth_low_energy_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698