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

Unified Diff: device/bluetooth/bluetooth_low_energy_defs_win.h

Issue 395633003: Enumerate Bluetooth LE services and expose them to chrome.bluetooth API. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix x64 build. Created 6 years, 5 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 | « device/bluetooth/bluetooth_init_win.h ('k') | device/bluetooth/bluetooth_low_energy_defs_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_defs_win.h
diff --git a/device/bluetooth/bluetooth_low_energy_defs_win.h b/device/bluetooth/bluetooth_low_energy_defs_win.h
new file mode 100644
index 0000000000000000000000000000000000000000..921821a648529752a23c6e7294cd5afcf5c7d99b
--- /dev/null
+++ b/device/bluetooth/bluetooth_low_energy_defs_win.h
@@ -0,0 +1,192 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef DEVICE_BLUETOOTH_BLUETOOTH_LOW_ENERGY_DEFS_WIN_H_
+#define DEVICE_BLUETOOTH_BLUETOOTH_LOW_ENERGY_DEFS_WIN_H_
+
+#include <windows.h>
+#include <cfg.h>
+#include <devpkey.h>
+#include <setupapi.h>
+// #include <bthledef.h>
+// TODO(rpaquay):
+// bthledef.h from Win8 SDK has a couple of issues when used in a Win32 app:
+// * line 420: usage of "pragma pop" instead of "pragma warning(pop)"
+// * line 349: no CALLBACK modifier in the definition of
+// PFNBLUETOOTH_GATT_EVENT_CALLBACK.
+//
+// So, we duplicate the definitions we need and prevent the build from including
+// the content of bthledef.h.
+#ifndef __BTHLEDEF_H__
+#define __BTHLEDEF_H__
+
+//
+// Bluetooth LE device interface GUID
+//
+// {781aee18-7733-4ce4-adb0-91f41c67b592}
+DEFINE_GUID(GUID_BLUETOOTHLE_DEVICE_INTERFACE,
+ 0x781aee18,
+ 0x7733,
+ 0x4ce4,
+ 0xad,
+ 0xd0,
+ 0x91,
+ 0xf4,
+ 0x1c,
+ 0x67,
+ 0xb5,
+ 0x92);
+
+DEFINE_GUID(BTH_LE_ATT_BLUETOOTH_BASE_GUID,
+ 0x00000000,
+ 0x0000,
+ 0x1000,
+ 0x80,
+ 0x00,
+ 0x00,
+ 0x80,
+ 0x5F,
+ 0x9B,
+ 0x34,
+ 0xFB);
+
+#define BLUETOOTH_GATT_FLAG_NONE 0x00000000
+
+typedef struct _BTH_LE_UUID {
+ BOOLEAN IsShortUuid;
+#ifdef MIDL_PASS
+ [ switch_type(BOOLEAN), switch_is((BOOLEAN)IsShortUuid) ]
+#endif
+ union {
+#ifdef MIDL_PASS
+ [case(TRUE)]
+#endif
+ USHORT ShortUuid;
+#ifdef MIDL_PASS
+ [case(FALSE)]
+#endif
+ GUID LongUuid;
+ } Value;
+} BTH_LE_UUID, *PBTH_LE_UUID;
+
+typedef struct _BTH_LE_GATT_SERVICE {
+ BTH_LE_UUID ServiceUuid;
+ USHORT AttributeHandle;
+} BTH_LE_GATT_SERVICE, *PBTH_LE_GATT_SERVICE;
+
+typedef struct _BTH_LE_GATT_CHARACTERISTIC {
+ USHORT ServiceHandle;
+ BTH_LE_UUID CharacteristicUuid;
+ USHORT AttributeHandle;
+ USHORT CharacteristicValueHandle;
+ BOOLEAN IsBroadcastable;
+ BOOLEAN IsReadable;
+ BOOLEAN IsWritable;
+ BOOLEAN IsWritableWithoutResponse;
+ BOOLEAN IsSignedWritable;
+ BOOLEAN IsNotifiable;
+ BOOLEAN IsIndicatable;
+ BOOLEAN HasExtendedProperties;
+} BTH_LE_GATT_CHARACTERISTIC, *PBTH_LE_GATT_CHARACTERISTIC;
+
+typedef struct _BTH_LE_GATT_CHARACTERISTIC_VALUE {
+ ULONG DataSize;
+
+#ifdef MIDL_PASS
+ [size_is(DataSize)] UCHAR Data[*];
+#else
+ _Field_size_bytes_(DataSize) UCHAR Data[1];
+#endif
+} BTH_LE_GATT_CHARACTERISTIC_VALUE, *PBTH_LE_GATT_CHARACTERISTIC_VALUE;
+
+typedef enum _BTH_LE_GATT_DESCRIPTOR_TYPE {
+ CharacteristicExtendedProperties,
+ CharacteristicUserDescription,
+ ClientCharacteristicConfiguration,
+ ServerCharacteristicConfiguration,
+ CharacteristicFormat,
+ CharacteristicAggregateFormat,
+ CustomDescriptor
+} BTH_LE_GATT_DESCRIPTOR_TYPE,
+ *PBTH_LE_GATT_DESCRIPTOR_TYPE;
+
+typedef struct _BTH_LE_GATT_DESCRIPTOR {
+ USHORT ServiceHandle;
+ USHORT CharacteristicHandle;
+ BTH_LE_GATT_DESCRIPTOR_TYPE DescriptorType;
+ BTH_LE_UUID DescriptorUuid;
+ USHORT AttributeHandle;
+} BTH_LE_GATT_DESCRIPTOR, *PBTH_LE_GATT_DESCRIPTOR;
+
+typedef struct _BTH_LE_GATT_DESCRIPTOR_VALUE {
+ BTH_LE_GATT_DESCRIPTOR_TYPE DescriptorType;
+ BTH_LE_UUID DescriptorUuid;
+
+#ifdef MIDL_PASS
+ [
+ switch_type(BTH_LE_GATT_DESCRIPTOR_TYPE),
+ switch_is((BTH_LE_GATT_DESCRIPTOR_TYPE)DescriptorType)
+ ]
+#endif
+ union {
+
+#ifdef MIDL_PASS
+ [case(CharacteristicExtendedProperties)]
+#endif
+ struct {
+ BOOLEAN IsReliableWriteEnabled;
+ BOOLEAN IsAuxiliariesWritable;
+ } CharacteristicExtendedProperties;
+
+#ifdef MIDL_PASS
+ [case(ClientCharacteristicConfiguration)]
+#endif
+ struct {
+ BOOLEAN IsSubscribeToNotification;
+ BOOLEAN IsSubscribeToIndication;
+ } ClientCharacteristicConfiguration;
+
+#ifdef MIDL_PASS
+ [case(ServerCharacteristicConfiguration)]
+#endif
+ struct {
+ BOOLEAN IsBroadcast;
+ } ServerCharacteristicConfiguration;
+
+#ifdef MIDL_PASS
+ [case(CharacteristicFormat)]
+#endif
+ struct {
+ UCHAR Format;
+ UCHAR Exponent;
+ BTH_LE_UUID Unit;
+ UCHAR NameSpace;
+ BTH_LE_UUID Description;
+ } CharacteristicFormat;
+#ifdef MIDL_PASS
+ [default];
+#endif
+ };
+
+ ULONG DataSize;
+
+#ifdef MIDL_PASS
+ [size_is(DataSize)] UCHAR Data[*];
+#else
+ _Field_size_bytes_(DataSize) UCHAR Data[1];
+#endif
+} BTH_LE_GATT_DESCRIPTOR_VALUE, *PBTH_LE_GATT_DESCRIPTOR_VALUE;
+
+typedef enum _BTH_LE_GATT_EVENT_TYPE {
+ CharacteristicValueChangedEvent,
+} BTH_LE_GATT_EVENT_TYPE;
+
+typedef ULONG64 BTH_LE_GATT_RELIABLE_WRITE_CONTEXT,
+ *PBTH_LE_GATT_RELIABLE_WRITE_CONTEXT;
+
+#endif // __BTHLEDEF_H__
+#include <bluetoothapis.h>
+#include <bluetoothleapis.h>
+
+#endif // DEVICE_BLUETOOTH_BLUETOOTH_LOW_ENERGY_DEFS_WIN_H_
« no previous file with comments | « device/bluetooth/bluetooth_init_win.h ('k') | device/bluetooth/bluetooth_low_energy_defs_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698