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 typedef struct _SDP_ELEMENT_DATA
{
115 SDP_SPECIFICTYPE specificType
;
117 SDP_LARGE_INTEGER_16 int128
;
123 SDP_ULARGE_INTEGER_16 uint128
;
155 } SDP_ELEMENT_DATA
, *PSDP_ELEMENT_DATA
;
157 typedef struct _SDP_STRING_TYPE_DATA
{
161 } SDP_STRING_TYPE_DATA
, *PSDP_STRING_TYPE_DATA
;
163 typedef BOOL (CALLBACK
*PFN_BLUETOOTH_ENUM_ATTRIBUTES_CALLBACK
)(
169 DWORD WINAPI
BluetoothAuthenticateDevice(HWND
, HANDLE
, BLUETOOTH_DEVICE_INFO
*, WCHAR
*, ULONG
);
170 DWORD WINAPI
BluetoothAuthenticateMultipleDevices(HWND
, HANDLE
, DWORD
, BLUETOOTH_DEVICE_INFO
*);
171 BOOL WINAPI
BluetoothDisplayDeviceProperties(HWND
, BLUETOOTH_DEVICE_INFO
*);
172 BOOL WINAPI
BluetoothEnableDiscovery(HANDLE
, BOOL
);
173 BOOL WINAPI
BluetoothEnableIncomingConnections(HANDLE
, BOOL
);
174 DWORD WINAPI
BluetoothEnumerateInstalledServices(HANDLE
, BLUETOOTH_DEVICE_INFO
*, DWORD
*, GUID
*);
175 BOOL WINAPI
BluetoothFindDeviceClose(HBLUETOOTH_DEVICE_FIND
);
176 HBLUETOOTH_DEVICE_FIND WINAPI
BluetoothFindFirstDevice(BLUETOOTH_DEVICE_SEARCH_PARAMS
*, BLUETOOTH_DEVICE_INFO
*);
177 HBLUETOOTH_RADIO_FIND WINAPI
BluetoothFindFirstRadio(BLUETOOTH_FIND_RADIO_PARAMS
*, HANDLE
*);
178 BOOL WINAPI
BluetoothFindNextDevice(HBLUETOOTH_DEVICE_FIND
, BLUETOOTH_DEVICE_INFO
*);
179 BOOL WINAPI
BluetoothFindNextRadio(HBLUETOOTH_RADIO_FIND
, HANDLE
*);
180 BOOL WINAPI
BluetoothFindRadioClose(HBLUETOOTH_RADIO_FIND
);
181 DWORD WINAPI
BluetoothGetDeviceInfo(HANDLE
, BLUETOOTH_DEVICE_INFO
*);
182 DWORD WINAPI
BluetoothGetRadioInfo(HANDLE
, PBLUETOOTH_RADIO_INFO
);
183 BOOL WINAPI
BluetoothIsConnectable(HANDLE
);
184 BOOL WINAPI
BluetoothIsDiscoverable(HANDLE
);
185 DWORD WINAPI
BluetoothRegisterForAuthentication(BLUETOOTH_DEVICE_INFO
*, HBLUETOOTH_AUTHENTICATION_REGISTRATION
*, PFN_AUTHENTICATION_CALLBACK
, void *);
186 DWORD WINAPI
BluetoothRemoveDevice(BLUETOOTH_ADDRESS
*);
187 #define BluetoothEnumAttributes BluetoothSdpEnumAttributes
188 BOOL WINAPI
BluetoothSdpEnumAttributes(BYTE
*, ULONG
, PFN_BLUETOOTH_ENUM_ATTRIBUTES_CALLBACK
, void *);
189 DWORD WINAPI
BluetoothSdpGetAttributeValue(BYTE
*, ULONG
, USHORT
, PSDP_ELEMENT_DATA
);
190 DWORD WINAPI
BluetoothSdpGetContainerElementData(BYTE
*, ULONG
, HBLUETOOTH_CONTAINER_ELEMENT
*, PSDP_ELEMENT_DATA
);
191 DWORD WINAPI
BluetoothSdpGetElementData(BYTE
*, ULONG
, PSDP_ELEMENT_DATA
);
192 DWORD WINAPI
BluetoothSdpGetString(BYTE
*, ULONG
, PSDP_STRING_TYPE_DATA
, USHORT
, WCHAR
*, ULONG
*);
193 BOOL WINAPI
BluetoothSelectDevices(BLUETOOTH_SELECT_DEVICE_PARAMS
*);
194 BOOL WINAPI
BluetoothSelectDevicesFree(BLUETOOTH_SELECT_DEVICE_PARAMS
*);
195 DWORD WINAPI
BluetoothSendAuthenticationResponse(HANDLE
, BLUETOOTH_DEVICE_INFO
*, WCHAR
*);
196 DWORD WINAPI
BluetoothSetServiceState(HANDLE
, BLUETOOTH_DEVICE_INFO
*, GUID
*, DWORD
);
197 BOOL WINAPI
BluetoothUnregisterAuthentication(HBLUETOOTH_AUTHENTICATION_REGISTRATION
);
198 DWORD WINAPI
BluetoothUpdateDeviceRecord(BLUETOOTH_DEVICE_INFO
*);
204 #endif /* __BLUETOOTHAPIS_H */