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::minwindef::{ULONG, USHORT};
7 use shared::winerror::HRESULT;
8 use um::bthledef::{
9     BLUETOOTH_GATT_EVENT_HANDLE, BTH_LE_GATT_EVENT_TYPE, BTH_LE_GATT_RELIABLE_WRITE_CONTEXT,
10     PBTH_LE_GATT_CHARACTERISTIC, PBTH_LE_GATT_CHARACTERISTIC_VALUE, PBTH_LE_GATT_DESCRIPTOR,
11     PBTH_LE_GATT_DESCRIPTOR_VALUE, PBTH_LE_GATT_RELIABLE_WRITE_CONTEXT, PBTH_LE_GATT_SERVICE,
12     PFNBLUETOOTH_GATT_EVENT_CALLBACK,
13 };
14 use um::winnt::{HANDLE, PVOID};
15 extern "system" {
BluetoothGATTGetServices( hDevice: HANDLE, ServicesBufferCount: USHORT, ServicesBuffer: PBTH_LE_GATT_SERVICE, ServicesBufferActual: *mut USHORT, Flags: ULONG, ) -> HRESULT16     pub fn BluetoothGATTGetServices(
17         hDevice: HANDLE,
18         ServicesBufferCount: USHORT,
19         ServicesBuffer: PBTH_LE_GATT_SERVICE,
20         ServicesBufferActual: *mut USHORT,
21         Flags: ULONG,
22     ) -> HRESULT;
BluetoothGATTGetIncludedServices( hDevice: HANDLE, ParentService: PBTH_LE_GATT_SERVICE, IncludedServicesBufferCount: USHORT, IncludedServicesBuffer: PBTH_LE_GATT_SERVICE, IncludedServicesBufferActual: *mut USHORT, Flags: ULONG, ) -> HRESULT23     pub fn BluetoothGATTGetIncludedServices(
24         hDevice: HANDLE,
25         ParentService: PBTH_LE_GATT_SERVICE,
26         IncludedServicesBufferCount: USHORT,
27         IncludedServicesBuffer: PBTH_LE_GATT_SERVICE,
28         IncludedServicesBufferActual: *mut USHORT,
29         Flags: ULONG,
30     ) -> HRESULT;
BluetoothGATTGetCharacteristics( hDevice: HANDLE, Service: PBTH_LE_GATT_SERVICE, CharacteristicsBufferCount: USHORT, CharacteristicsBuffer: PBTH_LE_GATT_CHARACTERISTIC, CharacteristicsBufferActual: *mut USHORT, Flags: ULONG, ) -> HRESULT31     pub fn BluetoothGATTGetCharacteristics(
32         hDevice: HANDLE,
33         Service: PBTH_LE_GATT_SERVICE,
34         CharacteristicsBufferCount: USHORT,
35         CharacteristicsBuffer: PBTH_LE_GATT_CHARACTERISTIC,
36         CharacteristicsBufferActual: *mut USHORT,
37         Flags: ULONG,
38     ) -> HRESULT;
BluetoothGATTGetDescriptors( hDevice: HANDLE, Characteristic: PBTH_LE_GATT_CHARACTERISTIC, DescriptorsBufferCount: USHORT, DescriptorsBuffer: PBTH_LE_GATT_DESCRIPTOR, DescriptorsBufferActual: *mut USHORT, Flags: ULONG, ) -> HRESULT39     pub fn BluetoothGATTGetDescriptors(
40         hDevice: HANDLE,
41         Characteristic: PBTH_LE_GATT_CHARACTERISTIC,
42         DescriptorsBufferCount: USHORT,
43         DescriptorsBuffer: PBTH_LE_GATT_DESCRIPTOR,
44         DescriptorsBufferActual: *mut USHORT,
45         Flags: ULONG,
46     ) -> HRESULT;
BluetoothGATTGetCharacteristicValue( hDevice: HANDLE, Characteristic: PBTH_LE_GATT_CHARACTERISTIC, CharacteristicValueDataSize: ULONG, CharacteristicValue: PBTH_LE_GATT_CHARACTERISTIC_VALUE, CharacteristicValueSizeRequired: *mut USHORT, Flags: ULONG, ) -> HRESULT47     pub fn BluetoothGATTGetCharacteristicValue(
48         hDevice: HANDLE,
49         Characteristic: PBTH_LE_GATT_CHARACTERISTIC,
50         CharacteristicValueDataSize: ULONG,
51         CharacteristicValue: PBTH_LE_GATT_CHARACTERISTIC_VALUE,
52         CharacteristicValueSizeRequired: *mut USHORT,
53         Flags: ULONG,
54     ) -> HRESULT;
BluetoothGATTGetDescriptorValue( hDevice: HANDLE, Descriptor: PBTH_LE_GATT_DESCRIPTOR, DescriptorValueDataSize: ULONG, DescriptorValue: PBTH_LE_GATT_DESCRIPTOR_VALUE, DescriptorValueSizeRequired: *mut USHORT, Flags: ULONG, ) -> HRESULT55     pub fn BluetoothGATTGetDescriptorValue(
56         hDevice: HANDLE,
57         Descriptor: PBTH_LE_GATT_DESCRIPTOR,
58         DescriptorValueDataSize: ULONG,
59         DescriptorValue: PBTH_LE_GATT_DESCRIPTOR_VALUE,
60         DescriptorValueSizeRequired: *mut USHORT,
61         Flags: ULONG,
62     ) -> HRESULT;
BluetoothGATTBeginReliableWrite( hDevice: HANDLE, ReliableWriteContext: PBTH_LE_GATT_RELIABLE_WRITE_CONTEXT, Flags: ULONG, ) -> HRESULT63     pub fn BluetoothGATTBeginReliableWrite(
64         hDevice: HANDLE,
65         ReliableWriteContext: PBTH_LE_GATT_RELIABLE_WRITE_CONTEXT,
66         Flags: ULONG,
67     ) -> HRESULT;
BluetoothGATTSetCharacteristicValue( hDevice: HANDLE, Characteristic: PBTH_LE_GATT_CHARACTERISTIC, CharacteristicValue: PBTH_LE_GATT_CHARACTERISTIC_VALUE, ReliableWriteContext: BTH_LE_GATT_RELIABLE_WRITE_CONTEXT, Flags: ULONG, ) -> HRESULT68     pub fn BluetoothGATTSetCharacteristicValue(
69         hDevice: HANDLE,
70         Characteristic: PBTH_LE_GATT_CHARACTERISTIC,
71         CharacteristicValue: PBTH_LE_GATT_CHARACTERISTIC_VALUE,
72         ReliableWriteContext: BTH_LE_GATT_RELIABLE_WRITE_CONTEXT,
73         Flags: ULONG,
74     ) -> HRESULT;
BluetoothGATTEndReliableWrite( hDevice: HANDLE, ReliableWriteContext: BTH_LE_GATT_RELIABLE_WRITE_CONTEXT, Flags: ULONG, ) -> HRESULT75     pub fn BluetoothGATTEndReliableWrite(
76         hDevice: HANDLE,
77         ReliableWriteContext: BTH_LE_GATT_RELIABLE_WRITE_CONTEXT,
78         Flags: ULONG,
79     ) -> HRESULT;
BluetoothGATTAbortReliableWrite( hDevice: HANDLE, ReliableWriteContext: BTH_LE_GATT_RELIABLE_WRITE_CONTEXT, Flags: ULONG, ) -> HRESULT80     pub fn BluetoothGATTAbortReliableWrite(
81         hDevice: HANDLE,
82         ReliableWriteContext: BTH_LE_GATT_RELIABLE_WRITE_CONTEXT,
83         Flags: ULONG,
84     ) -> HRESULT;
BluetoothGATTSetDescriptorValue( hDevice: HANDLE, Descriptor: PBTH_LE_GATT_DESCRIPTOR, DescriptorValue: PBTH_LE_GATT_DESCRIPTOR_VALUE, Flags: ULONG, ) -> HRESULT85     pub fn BluetoothGATTSetDescriptorValue(
86         hDevice: HANDLE,
87         Descriptor: PBTH_LE_GATT_DESCRIPTOR,
88         DescriptorValue: PBTH_LE_GATT_DESCRIPTOR_VALUE,
89         Flags: ULONG,
90     ) -> HRESULT;
BluetoothGATTRegisterEvent( hService: HANDLE, EventType: BTH_LE_GATT_EVENT_TYPE, EventParameterIn: PVOID, Callback: PFNBLUETOOTH_GATT_EVENT_CALLBACK, CallbackContext: PVOID, pEventHandle: *mut BLUETOOTH_GATT_EVENT_HANDLE, Flags: ULONG, ) -> HRESULT91     pub fn BluetoothGATTRegisterEvent(
92         hService: HANDLE,
93         EventType: BTH_LE_GATT_EVENT_TYPE,
94         EventParameterIn: PVOID,
95         Callback: PFNBLUETOOTH_GATT_EVENT_CALLBACK,
96         CallbackContext: PVOID,
97         pEventHandle: *mut BLUETOOTH_GATT_EVENT_HANDLE,
98         Flags: ULONG,
99     ) -> HRESULT;
BluetoothGATTUnregisterEvent( EventHandle: BLUETOOTH_GATT_EVENT_HANDLE, Flags: ULONG, ) -> HRESULT100     pub fn BluetoothGATTUnregisterEvent(
101         EventHandle: BLUETOOTH_GATT_EVENT_HANDLE,
102         Flags: ULONG,
103     ) -> HRESULT;
104 }
105