2 * Copyright (C) 2016 Austin English
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
18 #ifndef __BLUETOOTHAPIS_H
19 #define __BLUETOOTHAPIS_H
25 typedef ULONGLONG BTH_ADDR
;
27 typedef struct _BLUETOOTH_ADDRESS
{
32 } BLUETOOTH_ADDRESS_STRUCT
;
34 #define BLUETOOTH_ADDRESS BLUETOOTH_ADDRESS_STRUCT
35 #define BLUETOOTH_NULL_ADDRESS ((ULONGLONG) 0x0)
37 #define BLUETOOTH_MAX_NAME_SIZE (248)
38 #define BLUETOOTH_MAX_PASSKEY_SIZE (16)
39 #define BLUETOOTH_MAX_PASSKEY_BUFFER_SIZE (BLUETOOTH_MAX_PASSKEY_SIZE + 1)
41 #define BLUETOOTH_SERVICE_DISABLE 0x00
42 #define BLUETOOTH_SERVICE_ENABLE 0x01
43 #define BLUETOOTH_SERVICE_MASK (BLUETOOTH_ENABLE_SERVICE | BLUETOOTH_DISABLE_SERVICE)
45 typedef struct _BLUETOOTH_FIND_RADIO_PARAMS
{
47 } BLUETOOTH_FIND_RADIO_PARAMS
;
49 typedef struct _BLUETOOTH_RADIO_INFO
{
51 BLUETOOTH_ADDRESS address
;
52 WCHAR szName
[BLUETOOTH_MAX_NAME_SIZE
];
53 ULONG ulClassofDevice
;
56 } BLUETOOTH_RADIO_INFO
, *PBLUETOOTH_RADIO_INFO
;
58 typedef struct _BLUETOOTH_DEVICE_INFO
{
60 BLUETOOTH_ADDRESS Address
;
61 ULONG ulClassofDevice
;
65 SYSTEMTIME stLastSeen
;
66 SYSTEMTIME stLastUsed
;
67 WCHAR szName
[BLUETOOTH_MAX_NAME_SIZE
];
68 } BLUETOOTH_DEVICE_INFO
, BLUETOOTH_DEVICE_INFO_STRUCT
, *PBLUETOOTH_DEVICE_INFO
;
70 typedef struct _BLUETOOTH_DEVICE_SEARCH_PARAMS
{
72 BOOL fReturnAuthenticated
;
73 BOOL fReturnRemembered
;
75 BOOL fReturnConnected
;
77 UCHAR cTimeoutMultiplier
;
79 } BLUETOOTH_DEVICE_SEARCH_PARAMS
;
81 typedef HANDLE HBLUETOOTH_AUTHENTICATION_REGISTRATION
;
82 typedef HANDLE HBLUETOOTH_CONTAINER_ELEMENT
;
83 typedef HANDLE HBLUETOOTH_DEVICE_FIND
;
84 typedef HANDLE HBLUETOOTH_RADIO_FIND
;
86 typedef struct _BLUETOOTH_COD_PAIRS
{
88 const WCHAR
*pcszDescription
;
89 } BLUETOOTH_COD_PAIRS
;
91 typedef BOOL (WINAPI
*PFN_DEVICE_CALLBACK
)(void *pvParam
, const BLUETOOTH_DEVICE_INFO
*pDevice
);
93 typedef struct _BLUETOOTH_SELECT_DEVICE_PARAMS
{
96 BLUETOOTH_COD_PAIRS
*prgClassOfDevices
;
99 BOOL fForceAuthentication
;
100 BOOL fShowAuthenticated
;
101 BOOL fShowRemembered
;
103 BOOL fAddNewDeviceWizard
;
104 BOOL fSkipServicesPage
;
105 PFN_DEVICE_CALLBACK pfnDeviceCallback
;
108 PBLUETOOTH_DEVICE_INFO pDevices
;
109 } BLUETOOTH_SELECT_DEVICE_PARAMS
;
111 typedef BOOL (WINAPI
*PFN_AUTHENTICATION_CALLBACK
)(void *, PBLUETOOTH_DEVICE_INFO
);
113 #define BLUETOOTH_DEVICE_INFO BLUETOOTH_DEVICE_INFO_STRUCT
115 typedef BLUETOOTH_DEVICE_INFO
*PBLUETOOTH_DEVICE_INFO
;
117 typedef enum _BLUETOOTH_AUTHENTICATION_METHOD
{
118 BLUETOOTH_AUTHENTICATION_METHOD_LEGACY
= 0x1,
119 BLUETOOTH_AUTHENTICATION_METHOD_OOB
,
120 BLUETOOTH_AUTHENTICATION_METHOD_NUMERIC_COMPARISON
,
121 BLUETOOTH_AUTHENTICATION_METHOD_PASSKEY_NOTIFICATION
,
122 BLUETOOTH_AUTHENTICATION_METHOD_PASSKEY
,
123 } BLUETOOTH_AUTHENTICATION_METHOD
, *PBLUETOOTH_AUTHENTICATION_METHOD
;
125 typedef enum _BLUETOOTH_IO_CAPABILITY
{
126 BLUETOOTH_IO_CAPABILITY_DISPLAYONLY
= 0x00,
127 BLUETOOTH_IO_CAPABILITY_DISPLAYYESNO
= 0x01,
128 BLUETOOTH_IO_CAPABILITY_KEYBOARDONLY
= 0x02,
129 BLUETOOTH_IO_CAPABILITY_NOINPUTNOOUTPUT
= 0x03,
130 BLUETOOTH_IO_CAPABILITY_UNDEFINED
= 0xff,
131 } BLUETOOTH_IO_CAPABILITY
;
133 typedef enum _BLUETOOTH_AUTHENTICATION_REQUIREMENTS
{
134 BLUETOOTH_MITM_ProtectionNotRequired
= 0,
135 BLUETOOTH_MITM_ProtectionRequired
= 0x1,
136 BLUETOOTH_MITM_ProtectionNotRequiredBonding
= 0x2,
137 BLUETOOTH_MITM_ProtectionRequiredBonding
= 0x3,
138 BLUETOOTH_MITM_ProtectionNotRequiredGeneralBonding
= 0x4,
139 BLUETOOTH_MITM_ProtectionRequiredGeneralBonding
= 0x5,
140 BLUETOOTH_MITM_ProtectionNotDefined
= 0xff,
141 } BLUETOOTH_AUTHENTICATION_REQUIREMENTS
;
143 typedef struct _BLUETOOTH_AUTHENTICATION_CALLBACK_PARAMS
{
144 BLUETOOTH_DEVICE_INFO deviceInfo
;
145 BLUETOOTH_AUTHENTICATION_METHOD authenticationMethod
;
146 BLUETOOTH_IO_CAPABILITY ioCapability
;
147 BLUETOOTH_AUTHENTICATION_REQUIREMENTS authenticationRequirements
;
152 } BLUETOOTH_AUTHENTICATION_CALLBACK_PARAMS
, *PBLUETOOTH_AUTHENTICATION_CALLBACK_PARAMS
;
154 typedef BOOL (CALLBACK
*PFN_AUTHENTICATION_CALLBACK_EX
)(void *, BLUETOOTH_AUTHENTICATION_CALLBACK_PARAMS
*);
156 typedef struct _SDP_ELEMENT_DATA
{
158 SDP_SPECIFICTYPE specificType
;
160 SDP_LARGE_INTEGER_16 int128
;
166 SDP_ULARGE_INTEGER_16 uint128
;
198 } SDP_ELEMENT_DATA
, *PSDP_ELEMENT_DATA
;
200 typedef struct _SDP_STRING_TYPE_DATA
{
204 } SDP_STRING_TYPE_DATA
, *PSDP_STRING_TYPE_DATA
;
206 typedef BOOL (CALLBACK
*PFN_BLUETOOTH_ENUM_ATTRIBUTES_CALLBACK
)(
212 DWORD WINAPI
BluetoothAuthenticateDevice(HWND
, HANDLE
, BLUETOOTH_DEVICE_INFO
*, WCHAR
*, ULONG
);
213 DWORD WINAPI
BluetoothAuthenticateMultipleDevices(HWND
, HANDLE
, DWORD
, BLUETOOTH_DEVICE_INFO
*);
214 BOOL WINAPI
BluetoothDisplayDeviceProperties(HWND
, BLUETOOTH_DEVICE_INFO
*);
215 BOOL WINAPI
BluetoothEnableDiscovery(HANDLE
, BOOL
);
216 BOOL WINAPI
BluetoothEnableIncomingConnections(HANDLE
, BOOL
);
217 DWORD WINAPI
BluetoothEnumerateInstalledServices(HANDLE
, BLUETOOTH_DEVICE_INFO
*, DWORD
*, GUID
*);
218 BOOL WINAPI
BluetoothFindDeviceClose(HBLUETOOTH_DEVICE_FIND
);
219 HBLUETOOTH_DEVICE_FIND WINAPI
BluetoothFindFirstDevice(BLUETOOTH_DEVICE_SEARCH_PARAMS
*, BLUETOOTH_DEVICE_INFO
*);
220 HBLUETOOTH_RADIO_FIND WINAPI
BluetoothFindFirstRadio(BLUETOOTH_FIND_RADIO_PARAMS
*, HANDLE
*);
221 BOOL WINAPI
BluetoothFindNextDevice(HBLUETOOTH_DEVICE_FIND
, BLUETOOTH_DEVICE_INFO
*);
222 BOOL WINAPI
BluetoothFindNextRadio(HBLUETOOTH_RADIO_FIND
, HANDLE
*);
223 BOOL WINAPI
BluetoothFindRadioClose(HBLUETOOTH_RADIO_FIND
);
224 DWORD WINAPI
BluetoothGetDeviceInfo(HANDLE
, BLUETOOTH_DEVICE_INFO
*);
225 DWORD WINAPI
BluetoothGetRadioInfo(HANDLE
, PBLUETOOTH_RADIO_INFO
);
226 BOOL WINAPI
BluetoothIsConnectable(HANDLE
);
227 BOOL WINAPI
BluetoothIsDiscoverable(HANDLE
);
228 DWORD WINAPI
BluetoothRegisterForAuthentication(const BLUETOOTH_DEVICE_INFO
*, HBLUETOOTH_AUTHENTICATION_REGISTRATION
*, PFN_AUTHENTICATION_CALLBACK
, void *);
229 DWORD WINAPI
BluetoothRegisterForAuthenticationEx(const BLUETOOTH_DEVICE_INFO
*, HBLUETOOTH_AUTHENTICATION_REGISTRATION
*, PFN_AUTHENTICATION_CALLBACK_EX
, void *);
230 DWORD WINAPI
BluetoothRemoveDevice(BLUETOOTH_ADDRESS
*);
231 #define BluetoothEnumAttributes BluetoothSdpEnumAttributes
232 BOOL WINAPI
BluetoothSdpEnumAttributes(BYTE
*, ULONG
, PFN_BLUETOOTH_ENUM_ATTRIBUTES_CALLBACK
, void *);
233 DWORD WINAPI
BluetoothSdpGetAttributeValue(BYTE
*, ULONG
, USHORT
, PSDP_ELEMENT_DATA
);
234 DWORD WINAPI
BluetoothSdpGetContainerElementData(BYTE
*, ULONG
, HBLUETOOTH_CONTAINER_ELEMENT
*, PSDP_ELEMENT_DATA
);
235 DWORD WINAPI
BluetoothSdpGetElementData(BYTE
*, ULONG
, PSDP_ELEMENT_DATA
);
236 DWORD WINAPI
BluetoothSdpGetString(BYTE
*, ULONG
, PSDP_STRING_TYPE_DATA
, USHORT
, WCHAR
*, ULONG
*);
237 BOOL WINAPI
BluetoothSelectDevices(BLUETOOTH_SELECT_DEVICE_PARAMS
*);
238 BOOL WINAPI
BluetoothSelectDevicesFree(BLUETOOTH_SELECT_DEVICE_PARAMS
*);
239 DWORD WINAPI
BluetoothSendAuthenticationResponse(HANDLE
, BLUETOOTH_DEVICE_INFO
*, WCHAR
*);
240 DWORD WINAPI
BluetoothSetServiceState(HANDLE
, BLUETOOTH_DEVICE_INFO
*, GUID
*, DWORD
);
241 BOOL WINAPI
BluetoothUnregisterAuthentication(HBLUETOOTH_AUTHENTICATION_REGISTRATION
);
242 DWORD WINAPI
BluetoothUpdateDeviceRecord(BLUETOOTH_DEVICE_INFO
*);
248 #endif /* __BLUETOOTHAPIS_H */