1 // Licensed under the Apache License, Version 2.0
2 // <LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
3 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your option.
4 // All files in the project carrying such notice may not be copied, modified, or distributed
5 // except according to those terms.
6 use shared::basetsd::ULONG64;
7 use shared::guiddef::{GUID, IsEqualGUID};
8 use shared::minwindef::{UCHAR, ULONG, USHORT};
9 use um::winnt::{BOOLEAN, HANDLE, PVOID};
10 DEFINE_GUID!{GUID_BLUETOOTHLE_DEVICE_INTERFACE,
11     0x781aee18, 0x7733, 0x4ce4, 0xad, 0xd0, 0x91, 0xf4, 0x1c, 0x67, 0xb5, 0x92}
12 DEFINE_GUID!{GUID_BLUETOOTH_GATT_SERVICE_DEVICE_INTERFACE,
13     0x6e3bb679, 0x4372, 0x40c8, 0x9e, 0xaa, 0x45, 0x09, 0xdf, 0x26, 0x0c, 0xd8}
14 DEFINE_GUID!{BTH_LE_ATT_BLUETOOTH_BASE_GUID,
15     0x00000000, 0x0000, 0x1000, 0x80, 0x00, 0x00, 0x80, 0x5F, 0x9B, 0x34, 0xFB}
16 pub const BTH_LE_SERVICE_GAP: USHORT = 0x1800;
17 pub const BTH_LE_SERVICE_GATT: USHORT = 0x1801;
18 pub const BTH_LE_GATT_ATTRIBUTE_TYPE_PRIMARY_SERVICE: USHORT = 0x2800;
19 pub const BTH_LE_GATT_ATTRIBUTE_TYPE_SECONDARY_SERVICE: USHORT = 0x2801;
20 pub const BTH_LE_GATT_ATTRIBUTE_TYPE_INCLUDE: USHORT = 0x2802;
21 pub const BTH_LE_GATT_ATTRIBUTE_TYPE_CHARACTERISTIC: USHORT = 0x2803;
22 pub const BTH_LE_GATT_CHARACTERISTIC_DESCRIPTOR_EXTENDED_PROPERTIES: USHORT = 0x2900;
23 pub const BTH_LE_GATT_CHARACTERISTIC_DESCRIPTOR_USER_DESCRIPTION: USHORT = 0x2901;
24 pub const BTH_LE_GATT_CHARACTERISTIC_DESCRIPTOR_CLIENT_CONFIGURATION: USHORT = 0x2902;
25 pub const BTH_LE_GATT_CHARACTERISTIC_DESCRIPTOR_SERVER_CONFIGURATION: USHORT = 0x2903;
26 pub const BTH_LE_GATT_CHARACTERISTIC_DESCRIPTOR_FORMAT: USHORT = 0x2904;
27 pub const BTH_LE_GATT_CHARACTERISTIC_DESCRIPTOR_AGGREGATE_FORMAT: USHORT = 0x2905;
28 pub const BTH_LE_GATT_CHARACTERISTIC_TYPE_DEVICE_NAME: USHORT = 0x2A00;
29 pub const BTH_LE_GATT_CHARACTERISTIC_TYPE_APPEARANCE: USHORT = 0x2A01;
30 pub const BTH_LE_GATT_CHARACTERISTIC_TYPE_PERIPHERAL_PRIVACY_FLAG: USHORT = 0x2A02;
31 pub const BTH_LE_GATT_CHARACTERISTIC_TYPE_RECONNECTION_ADDRESS: USHORT = 0x2A03;
32 pub const BTH_LE_GATT_CHARACTERISTIC_TYPE_PERIPHERAL_PREFERED_CONNECTION_PARAMETER: USHORT
33     = 0x2A04;
34 pub const BTH_LE_GATT_CHARACTERISTIC_TYPE_SERVICE_CHANGED: USHORT = 0x2A05;
35 pub const BTH_LE_GAP_APPEARANCE_CATEGORY_OFFSET: u8 = 0x6;
36 pub const BTH_LE_GAP_APPEARANCE_CATEGORY_MASK: USHORT = 0x3ff;
37 #[inline]
BTH_LE_GAP_APPEARANCE_GET_CATEGORY(a: USHORT) -> USHORT38 pub fn BTH_LE_GAP_APPEARANCE_GET_CATEGORY(a: USHORT) -> USHORT {
39     (a >> BTH_LE_GAP_APPEARANCE_CATEGORY_OFFSET) & BTH_LE_GAP_APPEARANCE_CATEGORY_MASK
40 }
41 #[inline]
BTH_LE_GAP_APPEARANCE_SET_CATEGORY(a: &mut USHORT, c: USHORT)42 pub fn BTH_LE_GAP_APPEARANCE_SET_CATEGORY(a: &mut USHORT, c: USHORT) {
43     *a = (*a & !BTH_LE_GAP_APPEARANCE_CATEGORY_MASK)
44         | (c << BTH_LE_GAP_APPEARANCE_CATEGORY_OFFSET);
45 }
46 pub const BTH_LE_GAP_APPEARANCE_SUB_CATEGORY_MASK: USHORT = 0x3f;
47 #[inline]
BTH_LE_GAP_APPEARANCE_GET_SUB_CATEGORY(a: USHORT) -> UCHAR48 pub fn BTH_LE_GAP_APPEARANCE_GET_SUB_CATEGORY(a: USHORT) -> UCHAR {
49     (a & BTH_LE_GAP_APPEARANCE_SUB_CATEGORY_MASK) as u8
50 }
51 #[inline]
BTH_LE_GAP_APPEARANCE_SET_SUB_CATEGORY(a: &mut USHORT, s: UCHAR)52 pub fn BTH_LE_GAP_APPEARANCE_SET_SUB_CATEGORY(a: &mut USHORT, s: UCHAR) {
53     *a = (*a & !BTH_LE_GAP_APPEARANCE_SUB_CATEGORY_MASK) | (s as u16);
54 }
55 pub const BTH_LE_GAP_APPEARANCE_CATEGORY_UNCATEGORIZED: USHORT = 0x0000;
56 pub const BTH_LE_GAP_APPEARANCE_CATEGORY_PHONE: USHORT = 0x0001;
57 pub const BTH_LE_GAP_APPEARANCE_CATEGORY_COMPUTER: USHORT = 0x0002;
58 pub const BTH_LE_GAP_APPEARANCE_CATEGORY_WATCH: USHORT = 0x0003;
59 pub const BTH_LE_GAP_APPEARANCE_CATEGORY_CLOCK: USHORT = 0x0004;
60 pub const BTH_LE_GAP_APPEARANCE_CATEGORY_DISPLAY: USHORT = 0x0005;
61 pub const BTH_LE_GAP_APPEARANCE_CATEGORY_REMOTE_CONTROL: USHORT = 0x0006;
62 pub const BTH_LE_GAP_APPEARANCE_CATEGORY_EYE_GLASSES: USHORT = 0x0007;
63 pub const BTH_LE_GAP_APPEARANCE_CATEGORY_TAG: USHORT = 0x0008;
64 pub const BTH_LE_GAP_APPEARANCE_CATEGORY_KEYRING: USHORT = 0x0009;
65 pub const BTH_LE_GAP_APPEARANCE_CATEGORY_MEDIA_PLAYER: USHORT = 0x000a;
66 pub const BTH_LE_GAP_APPEARANCE_CATEGORY_BARCODE_SCANNER: USHORT = 0x000b;
67 pub const BTH_LE_GAP_APPEARANCE_CATEGORY_THERMOMETER: USHORT = 0x000c;
68 pub const BTH_LE_GAP_APPEARANCE_CATEGORY_HEART_RATE: USHORT = 0x000d;
69 pub const BTH_LE_GAP_APPEARANCE_CATEGORY_BLOOD_PRESSURE: USHORT = 0x000e;
70 pub const BTH_LE_GAP_APPEARANCE_CATEGORY_HID: USHORT = 0x000f;
71 pub const BTH_LE_GAP_APPEARANCE_CATEGORY_GLUCOSE_METER: USHORT = 0x0010;
72 pub const BTH_LE_GAP_APPEARANCE_CATEGORY_RUNNING_WALKING_SENSOR: USHORT = 0x0011;
73 pub const BTH_LE_GAP_APPEARANCE_CATEGORY_CYCLING: USHORT = 0x0012;
74 pub const BTH_LE_GAP_APPEARANCE_CATEGORY_PLUSE_OXIMETER: USHORT = 0x0031;
75 pub const BTH_LE_GAP_APPEARANCE_CATEGORY_WEIGHT_SCALE: USHORT = 0x0032;
76 pub const BTH_LE_GAP_APPEARANCE_CATEGORY_OUTDOOR_SPORTS_ACTIVITY: USHORT = 0x0051;
77 pub const BTH_LE_GAP_APPEARANCE_SUBCATEGORY_GENERIC: UCHAR = 0x00;
78 pub const BTH_LE_GAP_APPEARANCE_WATCH_SUBCATEGORY_SPORTS_WATCH: UCHAR = 0x01;
79 pub const BTH_LE_GAP_APPEARANCE_THERMOMETER_SUBCATEGORY_EAR: UCHAR = 0x01;
80 pub const BTH_LE_GAP_APPEARANCE_HEART_RATE_SUBCATEGORY_HEART_RATE_BELT: UCHAR = 0x01;
81 pub const BTH_LE_GAP_APPEARANCE_BLOOD_PRESSURE_SUBCATEGORY_ARM: UCHAR = 0x01;
82 pub const BTH_LE_GAP_APPEARANCE_BLOOD_PRESSURE_SUBCATEGORY_WRIST: UCHAR = 0x02;
83 pub const BTH_LE_GAP_APPEARANCE_HID_SUBCATEGORY_KEYBOARD: UCHAR = 0x01;
84 pub const BTH_LE_GAP_APPEARANCE_HID_SUBCATEGORY_MOUSE: UCHAR = 0x02;
85 pub const BTH_LE_GAP_APPEARANCE_HID_SUBCATEGORY_JOYSTICK: UCHAR = 0x03;
86 pub const BTH_LE_GAP_APPEARANCE_HID_SUBCATEGORY_GAMEPAD: UCHAR = 0x04;
87 pub const BTH_LE_GAP_APPEARANCE_HID_SUBCATEGORY_DIGITIZER_TABLET: UCHAR = 0x05;
88 pub const BTH_LE_GAP_APPEARANCE_HID_SUBCATEGORY_CARD_READER: UCHAR = 0x06;
89 pub const BTH_LE_GAP_APPEARANCE_HID_SUBCATEGORY_DIGITAL_PEN: UCHAR = 0x07;
90 pub const BTH_LE_GAP_APPEARANCE_HID_SUBCATEGORY_BARCODE_SCANNER: UCHAR = 0x08;
91 pub const BTH_LE_GAP_APPEARANCE_RUNNING_WALKING_SENSOR_SUBCATEGORY_IN_SHOE: UCHAR = 0x01;
92 pub const BTH_LE_GAP_APPEARANCE_RUNNING_WALKING_SENSOR_SUBCATEGORY_ON_SHOE: UCHAR = 0x02;
93 pub const BTH_LE_GAP_APPEARANCE_RUNNING_WALKING_SENSOR_SUBCATEGORY_ON_HIP: UCHAR = 0x03;
94 pub const BTH_LE_GAP_APPEARANCE_CYCLING_SUBCATEGORY_CYCLING_COMPUTER: UCHAR = 0x01;
95 pub const BTH_LE_GAP_APPEARANCE_CYCLING_SUBCATEGORY_SPEED_SENSOR: UCHAR = 0x02;
96 pub const BTH_LE_GAP_APPEARANCE_CYCLING_SUBCATEGORY_CADENCE_SENSOR: UCHAR = 0x03;
97 pub const BTH_LE_GAP_APPEARANCE_CYCLING_SUBCATEGORY_POWER_SENSOR: UCHAR = 0x04;
98 pub const BTH_LE_GAP_APPEARANCE_CYCLING_SUBCATEGORY_SPEED_AND_CADENCE_SENSOR: UCHAR = 0x05;
99 pub const BTH_LE_GAP_APPEARANCE_PULSE_OXIMETER_SUBCATEGORY_FINGERTIP: UCHAR = 0x01;
100 pub const BTH_LE_GAP_APPEARANCE_PULSE_OXIMETER_SUBCATEGORY_WRIST_WORN: UCHAR = 0x02;
101 pub const BTH_LE_GAP_APPEARANCE_OUTDOOR_SPORTS_ACTIVITY_SUBCATEGORY_LOCATION_DISPLAY_DEVICE: UCHAR
102     = 0x01;
103 pub const
104     BTH_LE_GAP_APPEARANCE_OUTDOOR_SPORTS_ACTIVITY_SUBCATEGORY_LOCATION_NAVIGATION_DISPLAY_DEVICE:
105         UCHAR = 0x02;
106 pub const BTH_LE_GAP_APPEARANCE_OUTDOOR_SPORTS_ACTIVITY_SUBCATEGORY_LOCATION_POD: UCHAR = 0x03;
107 pub const BTH_LE_GAP_APPEARANCE_OUTDOOR_SPORTS_ACTIVITY_SUBCATEGORY_LOCATION_NAVIGATION_POD: UCHAR
108     = 0x04;
109 pub const BTH_LE_GATT_DEFAULT_MAX_INCLUDED_SERVICES_DEPTH: USHORT = 3;
110 pub const BTH_LE_ATT_TRANSACTION_TIMEOUT: USHORT = 30;
111 pub const BTH_LE_ATT_MAX_VALUE_SIZE: USHORT = 512;
112 pub const BTH_LE_ATT_CID: USHORT = 0x0004;
113 pub const BTHLEENUM_ATT_MTU_MIN: USHORT = 23;
114 // #define BTHLEENUM_ATT_MTU_MAX (MAX_USHORT)
115 pub const BTHLEENUM_ATT_MTU_DEFAULT: USHORT = BTHLEENUM_ATT_MTU_MIN;
116 pub const BTHLEENUM_ATT_MTU_INITIAL_NEGOTIATION: USHORT = 525;
117 pub const BTH_LE_ERROR_INVALID_HANDLE: USHORT = 0x01;
118 pub const BTH_LE_ERROR_READ_NOT_PERMITTED: USHORT = 0x02;
119 pub const BTH_LE_ERROR_WRITE_NOT_PERMITTED: USHORT = 0x03;
120 pub const BTH_LE_ERROR_INVALID_PDU: USHORT = 0x04;
121 pub const BTH_LE_ERROR_INSUFFICIENT_AUTHENTICATION: USHORT = 0x05;
122 pub const BTH_LE_ERROR_REQUEST_NOT_SUPPORTED: USHORT = 0x06;
123 pub const BTH_LE_ERROR_INVALID_OFFSET: USHORT = 0x07;
124 pub const BTH_LE_ERROR_INSUFFICIENT_AUTHORIZATION: USHORT = 0x08;
125 pub const BTH_LE_ERROR_PREPARE_QUEUE_FULL: USHORT = 0x09;
126 pub const BTH_LE_ERROR_ATTRIBUTE_NOT_FOUND: USHORT = 0x0A;
127 pub const BTH_LE_ERROR_ATTRIBUTE_NOT_LONG: USHORT = 0x0B;
128 pub const BTH_LE_ERROR_INSUFFICIENT_ENCRYPTION_KEY_SIZE: USHORT = 0x0C;
129 pub const BTH_LE_ERROR_INVALID_ATTRIBUTE_VALUE_LENGTH: USHORT = 0x0D;
130 pub const BTH_LE_ERROR_UNLIKELY: USHORT = 0x0E;
131 pub const BTH_LE_ERROR_INSUFFICIENT_ENCRYPTION: USHORT = 0x0F;
132 pub const BTH_LE_ERROR_UNSUPPORTED_GROUP_TYPE: USHORT = 0x10;
133 pub const BTH_LE_ERROR_INSUFFICIENT_RESOURCES: USHORT = 0x11;
134 pub const BTH_LE_ERROR_UNKNOWN: USHORT = 0x1000;
135 pub const BLUETOOTH_GATT_FLAG_NONE: ULONG = 0x00000000;
136 pub const BLUETOOTH_GATT_FLAG_CONNECTION_ENCRYPTED: ULONG = 0x00000001;
137 pub const BLUETOOTH_GATT_FLAG_CONNECTION_AUTHENTICATED: ULONG = 0x00000002;
138 pub const BLUETOOTH_GATT_FLAG_FORCE_READ_FROM_DEVICE: ULONG = 0x00000004;
139 pub const BLUETOOTH_GATT_FLAG_FORCE_READ_FROM_CACHE: ULONG = 0x00000008;
140 pub const BLUETOOTH_GATT_FLAG_SIGNED_WRITE: ULONG = 0x00000010;
141 pub const BLUETOOTH_GATT_FLAG_WRITE_WITHOUT_RESPONSE: ULONG = 0x00000020;
142 pub const BLUETOOTH_GATT_FLAG_RETURN_ALL: ULONG = 0x00000040;
143 pub const BLUETOOTH_GATT_FLAG_VALID_MASK: ULONG = BLUETOOTH_GATT_FLAG_NONE
144     | BLUETOOTH_GATT_FLAG_CONNECTION_ENCRYPTED | BLUETOOTH_GATT_FLAG_CONNECTION_AUTHENTICATED
145     | BLUETOOTH_GATT_FLAG_FORCE_READ_FROM_DEVICE | BLUETOOTH_GATT_FLAG_FORCE_READ_FROM_CACHE
146     | BLUETOOTH_GATT_FLAG_SIGNED_WRITE | BLUETOOTH_GATT_FLAG_WRITE_WITHOUT_RESPONSE
147     | BLUETOOTH_GATT_FLAG_RETURN_ALL;
148 #[inline]
IS_BLUETOOTH_GATT_FLAG_VALID(f: ULONG) -> bool149 pub fn IS_BLUETOOTH_GATT_FLAG_VALID(f: ULONG) -> bool {
150     (f & !BLUETOOTH_GATT_FLAG_VALID_MASK) == 0
151 }
152 pub type BLUETOOTH_GATT_EVENT_HANDLE = HANDLE;
153 UNION!{union BTH_LE_UUID_value {
154     [u32; 4],
155     ShortUuid ShortUuid_mut: USHORT,
156     LongUuid LongUuid_mut: GUID,
157 }}
158 STRUCT!{struct BTH_LE_UUID {
159     IsShortUuid: BOOLEAN,
160     Value: BTH_LE_UUID_value,
161 }}
162 pub type PBTH_LE_UUID = *mut BTH_LE_UUID;
163 STRUCT!{struct BTH_LE_GATT_SERVICE {
164     ServiceUuid: BTH_LE_UUID,
165     AttributeHandle: USHORT,
166 }}
167 pub type PBTH_LE_GATT_SERVICE = *mut BTH_LE_GATT_SERVICE;
168 ENUM!{enum BTH_LE_GATT_DESCRIPTOR_TYPE {
169     CharacteristicExtendedProperties,
170     CharacteristicUserDescription,
171     ClientCharacteristicConfiguration,
172     ServerCharacteristicConfiguration,
173     CharacteristicFormat,
174     CharacteristicAggregateFormat,
175     CustomDescriptor,
176 }}
177 pub type PBTH_LE_GATT_DESCRIPTOR_TYPE = *mut BTH_LE_GATT_DESCRIPTOR_TYPE;
178 STRUCT!{struct BTH_LE_GATT_CHARACTERISTIC {
179     ServiceHandle: USHORT,
180     CharacteristicUuid: BTH_LE_UUID,
181     AttributeHandle: USHORT,
182     CharacteristicValueHandle: USHORT,
183     IsBroadcastable: BOOLEAN,
184     IsReadable: BOOLEAN,
185     IsWritable: BOOLEAN,
186     IsWritableWithoutResponse: BOOLEAN,
187     IsSignedWritable: BOOLEAN,
188     IsNotifiable: BOOLEAN,
189     IsIndicatable: BOOLEAN,
190     HasExtendedProperties: BOOLEAN,
191 }}
192 pub type PBTH_LE_GATT_CHARACTERISTIC = *mut BTH_LE_GATT_CHARACTERISTIC;
193 STRUCT!{struct BTH_LE_GATT_CHARACTERISTIC_VALUE {
194     DataSize: ULONG,
195     Data: [UCHAR; 1],
196 }}
197 pub type PBTH_LE_GATT_CHARACTERISTIC_VALUE = *mut BTH_LE_GATT_CHARACTERISTIC_VALUE;
198 STRUCT!{struct BTH_LE_GATT_DESCRIPTOR {
199     ServiceHandle: USHORT,
200     CharacteristicHandle: USHORT,
201     DescriptorType: BTH_LE_GATT_DESCRIPTOR_TYPE,
202     DescriptorUuid: BTH_LE_UUID,
203     AttributeHandle: USHORT,
204 }}
205 pub type PBTH_LE_GATT_DESCRIPTOR = *mut BTH_LE_GATT_DESCRIPTOR;
206 STRUCT!{struct BTH_LE_GATT_DESCRIPTOR_VALUE_u_CharacteristicExtendedProperties {
207     IsReliableWriteEnabled: BOOLEAN,
208     IsAuxiliariesWritable: BOOLEAN,
209 }}
210 STRUCT!{struct BTH_LE_GATT_DESCRIPTOR_VALUE_u_ClientCharacteristicConfiguration {
211     IsSubscribeToNotification: BOOLEAN,
212     IsSubscribeToIndication: BOOLEAN,
213 }}
214 STRUCT!{struct BTH_LE_GATT_DESCRIPTOR_VALUE_u_ServerCharacteristicConfiguration {
215     IsBroadcast: BOOLEAN,
216 }}
217 STRUCT!{struct BTH_LE_GATT_DESCRIPTOR_VALUE_u_CharacteristicFormat {
218     Format: UCHAR,
219     Exponent: UCHAR,
220     Unit: BTH_LE_UUID,
221     NameSpace: UCHAR,
222     Description: BTH_LE_UUID,
223 }}
224 UNION!{union BTH_LE_GATT_DESCRIPTOR_VALUE_u {
225     [u32; 12],
226     CharacteristicExtendedProperties CharacteristicExtendedProperties_mut:
227         BTH_LE_GATT_DESCRIPTOR_VALUE_u_CharacteristicExtendedProperties,
228     ClientCharacteristicConfiguration ClientCharacteristicConfiguration_mut:
229         BTH_LE_GATT_DESCRIPTOR_VALUE_u_ClientCharacteristicConfiguration,
230     ServerCharacteristicConfiguration ServerCharacteristicConfiguration_mut:
231         BTH_LE_GATT_DESCRIPTOR_VALUE_u_ServerCharacteristicConfiguration,
232     CharacteristicFormat CharacteristicFormat_mut:
233         BTH_LE_GATT_DESCRIPTOR_VALUE_u_CharacteristicFormat,
234 }}
235 STRUCT!{struct BTH_LE_GATT_DESCRIPTOR_VALUE {
236     DescriptorType: BTH_LE_GATT_DESCRIPTOR_TYPE,
237     DescriptorUuid: BTH_LE_UUID,
238     u: BTH_LE_GATT_DESCRIPTOR_VALUE_u,
239     DataSize: ULONG,
240     Data: [UCHAR; 1],
241 }}
242 pub type PBTH_LE_GATT_DESCRIPTOR_VALUE = *mut BTH_LE_GATT_DESCRIPTOR_VALUE;
243 ENUM!{enum BTH_LE_GATT_EVENT_TYPE {
244     CharacteristicValueChangedEvent,
245 }}
246 FN!{stdcall PFNBLUETOOTH_GATT_EVENT_CALLBACK(
247     EventType: BTH_LE_GATT_EVENT_TYPE,
248     EventOutParameter: PVOID,
249     Context: PVOID,
250 ) -> ()}
251 STRUCT!{struct BLUETOOTH_GATT_VALUE_CHANGED_EVENT_REGISTRATION {
252     NumCharacteristics: USHORT,
253     Characteristics: [BTH_LE_GATT_CHARACTERISTIC; 1],
254 }}
255 pub type PBLUETOOTH_GATT_VALUE_CHANGED_EVENT_REGISTRATION
256     = *mut BLUETOOTH_GATT_VALUE_CHANGED_EVENT_REGISTRATION;
257 STRUCT!{struct BLUETOOTH_GATT_VALUE_CHANGED_EVENT {
258     ChangedAttributeHandle: USHORT,
259     CharacteristicValueDataSize: usize,
260     CharacteristicValue: PBTH_LE_GATT_CHARACTERISTIC_VALUE,
261 }}
262 pub type PBLUETOOTH_GATT_VALUE_CHANGED_EVENT = *mut BLUETOOTH_GATT_VALUE_CHANGED_EVENT;
263 pub type BTH_LE_GATT_RELIABLE_WRITE_CONTEXT = ULONG64;
264 pub type PBTH_LE_GATT_RELIABLE_WRITE_CONTEXT = *mut ULONG64;
265 #[inline]
IsBthLEUuidMatch(uuid1: &BTH_LE_UUID, uuid2: &BTH_LE_UUID) -> bool266 pub fn IsBthLEUuidMatch(uuid1: &BTH_LE_UUID, uuid2: &BTH_LE_UUID) -> bool {
267     fn is_bluetooth_le_uuid(uuid: &GUID) -> bool {
268         uuid.Data2 == BTH_LE_ATT_BLUETOOTH_BASE_GUID.Data2
269             && uuid.Data3 == BTH_LE_ATT_BLUETOOTH_BASE_GUID.Data3
270             && uuid.Data4 == BTH_LE_ATT_BLUETOOTH_BASE_GUID.Data4
271     }
272     unsafe { match (uuid1.IsShortUuid != 0, uuid2.IsShortUuid != 0) {
273         (true, true) => uuid1.Value.ShortUuid() == uuid2.Value.ShortUuid(),
274         (false, false) => IsEqualGUID(uuid1.Value.LongUuid(), uuid2.Value.LongUuid()),
275         (true, false) => is_bluetooth_le_uuid(uuid2.Value.LongUuid())
276             && ((*uuid1.Value.ShortUuid()) as u32) == uuid2.Value.LongUuid().Data1,
277         (false, true) => is_bluetooth_le_uuid(uuid1.Value.LongUuid())
278             && ((*uuid2.Value.ShortUuid()) as u32) == uuid1.Value.LongUuid().Data1,
279     }}
280 }
281