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
3 // found in the LICENSE file.
5 #ifndef DEVICE_BLUETOOTH_BLUETOOTH_LOW_ENERGY_DEFS_WIN_H_
6 #define DEVICE_BLUETOOTH_BLUETOOTH_LOW_ENERGY_DEFS_WIN_H_
12 // #include <bthledef.h>
14 // bthledef.h from Win8 SDK has a couple of issues when used in a Win32 app:
15 // * line 420: usage of "pragma pop" instead of "pragma warning(pop)"
16 // * line 349: no CALLBACK modifier in the definition of
17 // PFNBLUETOOTH_GATT_EVENT_CALLBACK.
19 // So, we duplicate the definitions we need and prevent the build from including
20 // the content of bthledef.h.
21 #ifndef __BTHLEDEF_H__
22 #define __BTHLEDEF_H__
25 // Bluetooth LE device interface GUID
27 // {781aee18-7733-4ce4-adb0-91f41c67b592}
28 DEFINE_GUID(GUID_BLUETOOTHLE_DEVICE_INTERFACE
,
41 DEFINE_GUID(BTH_LE_ATT_BLUETOOTH_BASE_GUID
,
54 #define BLUETOOTH_GATT_FLAG_NONE 0x00000000
56 typedef struct _BTH_LE_UUID
{
59 [ switch_type(BOOLEAN
), switch_is((BOOLEAN
)IsShortUuid
) ]
71 } BTH_LE_UUID
, *PBTH_LE_UUID
;
73 typedef struct _BTH_LE_GATT_SERVICE
{
74 BTH_LE_UUID ServiceUuid
;
75 USHORT AttributeHandle
;
76 } BTH_LE_GATT_SERVICE
, *PBTH_LE_GATT_SERVICE
;
78 typedef struct _BTH_LE_GATT_CHARACTERISTIC
{
80 BTH_LE_UUID CharacteristicUuid
;
81 USHORT AttributeHandle
;
82 USHORT CharacteristicValueHandle
;
83 BOOLEAN IsBroadcastable
;
86 BOOLEAN IsWritableWithoutResponse
;
87 BOOLEAN IsSignedWritable
;
89 BOOLEAN IsIndicatable
;
90 BOOLEAN HasExtendedProperties
;
91 } BTH_LE_GATT_CHARACTERISTIC
, *PBTH_LE_GATT_CHARACTERISTIC
;
93 typedef struct _BTH_LE_GATT_CHARACTERISTIC_VALUE
{
97 [size_is(DataSize
)] UCHAR Data
[*];
99 _Field_size_bytes_(DataSize
) UCHAR Data
[1];
101 } BTH_LE_GATT_CHARACTERISTIC_VALUE
, *PBTH_LE_GATT_CHARACTERISTIC_VALUE
;
103 typedef enum _BTH_LE_GATT_DESCRIPTOR_TYPE
{
104 CharacteristicExtendedProperties
,
105 CharacteristicUserDescription
,
106 ClientCharacteristicConfiguration
,
107 ServerCharacteristicConfiguration
,
108 CharacteristicFormat
,
109 CharacteristicAggregateFormat
,
111 } BTH_LE_GATT_DESCRIPTOR_TYPE
,
112 *PBTH_LE_GATT_DESCRIPTOR_TYPE
;
114 typedef struct _BTH_LE_GATT_DESCRIPTOR
{
115 USHORT ServiceHandle
;
116 USHORT CharacteristicHandle
;
117 BTH_LE_GATT_DESCRIPTOR_TYPE DescriptorType
;
118 BTH_LE_UUID DescriptorUuid
;
119 USHORT AttributeHandle
;
120 } BTH_LE_GATT_DESCRIPTOR
, *PBTH_LE_GATT_DESCRIPTOR
;
122 typedef struct _BTH_LE_GATT_DESCRIPTOR_VALUE
{
123 BTH_LE_GATT_DESCRIPTOR_TYPE DescriptorType
;
124 BTH_LE_UUID DescriptorUuid
;
128 switch_type(BTH_LE_GATT_DESCRIPTOR_TYPE
),
129 switch_is((BTH_LE_GATT_DESCRIPTOR_TYPE
)DescriptorType
)
135 [case(CharacteristicExtendedProperties
)]
138 BOOLEAN IsReliableWriteEnabled
;
139 BOOLEAN IsAuxiliariesWritable
;
140 } CharacteristicExtendedProperties
;
143 [case(ClientCharacteristicConfiguration
)]
146 BOOLEAN IsSubscribeToNotification
;
147 BOOLEAN IsSubscribeToIndication
;
148 } ClientCharacteristicConfiguration
;
151 [case(ServerCharacteristicConfiguration
)]
155 } ServerCharacteristicConfiguration
;
158 [case(CharacteristicFormat
)]
165 BTH_LE_UUID Description
;
166 } CharacteristicFormat
;
175 [size_is(DataSize
)] UCHAR Data
[*];
177 _Field_size_bytes_(DataSize
) UCHAR Data
[1];
179 } BTH_LE_GATT_DESCRIPTOR_VALUE
, *PBTH_LE_GATT_DESCRIPTOR_VALUE
;
181 typedef enum _BTH_LE_GATT_EVENT_TYPE
{
182 CharacteristicValueChangedEvent
,
183 } BTH_LE_GATT_EVENT_TYPE
;
185 typedef ULONG64 BTH_LE_GATT_RELIABLE_WRITE_CONTEXT
,
186 *PBTH_LE_GATT_RELIABLE_WRITE_CONTEXT
;
188 #endif // __BTHLEDEF_H__
189 #include <bluetoothapis.h>
190 #include <bluetoothleapis.h>
192 #endif // DEVICE_BLUETOOTH_BLUETOOTH_LOW_ENERGY_DEFS_WIN_H_