winapi_ui_automation/um/
bluetoothleapis.rs

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.
6use shared::minwindef::{ULONG, USHORT};
7use shared::winerror::HRESULT;
8use 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};
14use um::winnt::{HANDLE, PVOID};
15extern "system" {
16    pub fn BluetoothGATTGetServices(
17        hDevice: HANDLE,
18        ServicesBufferCount: USHORT,
19        ServicesBuffer: PBTH_LE_GATT_SERVICE,
20        ServicesBufferActual: *mut USHORT,
21        Flags: ULONG,
22    ) -> HRESULT;
23    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;
31    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;
39    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;
47    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;
55    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;
63    pub fn BluetoothGATTBeginReliableWrite(
64        hDevice: HANDLE,
65        ReliableWriteContext: PBTH_LE_GATT_RELIABLE_WRITE_CONTEXT,
66        Flags: ULONG,
67    ) -> HRESULT;
68    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;
75    pub fn BluetoothGATTEndReliableWrite(
76        hDevice: HANDLE,
77        ReliableWriteContext: BTH_LE_GATT_RELIABLE_WRITE_CONTEXT,
78        Flags: ULONG,
79    ) -> HRESULT;
80    pub fn BluetoothGATTAbortReliableWrite(
81        hDevice: HANDLE,
82        ReliableWriteContext: BTH_LE_GATT_RELIABLE_WRITE_CONTEXT,
83        Flags: ULONG,
84    ) -> HRESULT;
85    pub fn BluetoothGATTSetDescriptorValue(
86        hDevice: HANDLE,
87        Descriptor: PBTH_LE_GATT_DESCRIPTOR,
88        DescriptorValue: PBTH_LE_GATT_DESCRIPTOR_VALUE,
89        Flags: ULONG,
90    ) -> HRESULT;
91    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;
100    pub fn BluetoothGATTUnregisterEvent(
101        EventHandle: BLUETOOTH_GATT_EVENT_HANDLE,
102        Flags: ULONG,
103    ) -> HRESULT;
104}