1 {******************************************************************************}
2 {                                                                              }
3 { BlueTooth API interface Unit for Object Pascal                               }
4 {                                                                              }
5 { Portions created by Microsoft are Copyright (C) 1995-2001 Microsoft          }
6 { Corporation. All Rights Reserved.                                            }
7 {                                                                              }
8 { Portions created by Marcel van Brakel are Copyright (C) 1999-2001            }
9 { Marcel van Brakel. All Rights Reserved.                                      }
10 {                                                                              }
11 { Contributors: John Penman                                                    }
12 {                                                                              }
13 { Obtained through: Joint Endeavour of Delphi Innovators (Project JEDI)        }
14 {                                                                              }
15 { You may retrieve the latest version of this file at the Project JEDI         }
16 { APILIB home page, located at http://jedi-apilib.sourceforge.net              }
17 {                                                                              }
18 { The contents of this file are used with permission, subject to the Mozilla   }
19 { Public License Version 1.1 (the "License"); you may not use this file except }
20 { in compliance with the License. You may obtain a copy of the License at      }
21 { http://www.mozilla.org/MPL/MPL-1.1.html                                      }
22 {                                                                              }
23 { Software distributed under the License is distributed on an "AS IS" basis,   }
24 { WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for }
25 { the specific language governing rights and limitations under the License.    }
26 {                                                                              }
27 { Alternatively, the contents of this file may be used under the terms of the  }
28 { GNU Lesser General Public License (the  "LGPL License"), in which case the   }
29 { provisions of the LGPL License are applicable instead of those above.        }
30 { If you wish to allow use of your version of this file only under the terms   }
31 { of the LGPL License and not to allow others to use your version of this file }
32 { under the MPL, indicate your decision by deleting  the provisions above and  }
33 { replace  them with the notice and other provisions required by the LGPL      }
34 { License.  If you do not delete the provisions above, a recipient may use     }
35 { your version of this file under either the MPL or the LGPL License.          }
36 {                                                                              }
37 { For more information about the LGPL: http://www.gnu.org/copyleft/lesser.html }
38 {                                                                              }
39 {******************************************************************************}
40 
41 // $Id: JwaBluetoothAPIs.pas,v 1.15 2007/09/06 14:57:11 marquardt Exp $
42 
43 {$IFNDEF JWA_OMIT_SECTIONS}
44 unit JwaBluetoothAPIs;
45 
46 {$WEAKPACKAGEUNIT}
47 
48 {$ENDIF JWA_OMIT_SECTIONS}
49 
50 {$HPPEMIT ''}
51 {$HPPEMIT '#include "bluetoothapis.h"'}
52 {$HPPEMIT ''}
53 
54 {$IFNDEF JWA_OMIT_SECTIONS}
55 {$I jediapilib.inc}
56 {$I jedi.inc} //used for D5 compiling
57 
58 interface
59 
60 uses
61   JwaWinType, JwaWinBase, JwaBthSdpDef;
62 
63 {$ENDIF JWA_OMIT_SECTIONS}
64 
65 {$IFNDEF JWA_IMPLEMENTATIONSECTION}
66 
67 const
68   BLUETOOTH_MAX_NAME_SIZE            = 248;
69   {$EXTERNALSYM BLUETOOTH_MAX_NAME_SIZE}
70   BLUETOOTH_MAX_PASSKEY_SIZE         = 16;
71   {$EXTERNALSYM BLUETOOTH_MAX_PASSKEY_SIZE}
72   BLUETOOTH_MAX_PASSKEY_BUFFER_SIZE  = BLUETOOTH_MAX_PASSKEY_SIZE + 1;
73   {$EXTERNALSYM BLUETOOTH_MAX_PASSKEY_BUFFER_SIZE}
74 
75 // ***************************************************************************
76 //
77 //  Bluetooth Address
78 //
79 // ***************************************************************************
80 
81 type
82   BTH_ADDR = Int64;
83   {$EXTERNALSYM BTH_ADDR}
84 
85   _BLUETOOTH_ADDRESS = record
86     case Integer of
87       0: (ullLong: BTH_ADDR);       //  easier to compare again BLUETOOTH_NULL_ADDRESS
88       1: (rgBytes: array [0..5] of Byte);   //  easier to format when broken out
89   end;
90   {$EXTERNALSYM _BLUETOOTH_ADDRESS}
91   BLUETOOTH_ADDRESS = _BLUETOOTH_ADDRESS;
92   {$EXTERNALSYM BLUETOOTH_ADDRESS}
93   TBlueToothAddress = BLUETOOTH_ADDRESS;
94   PBlueToothAddress = ^BLUETOOTH_ADDRESS;
95 
96 const
97   BLUETOOTH_NULL_ADDRESS: TBlueToothAddress = (ullLong: 0;);
98   {$EXTERNALSYM BLUETOOTH_NULL_ADDRESS}
99 
100 // ***************************************************************************
101 //
102 //  Radio Enumeration
103 //
104 //  Description:
105 //      This group of APIs enumerates the installed Bluetooth radios.
106 //
107 //  Sample Usage:
108 //      HANDLE hRadio;
109 //      BLUETOOTH_FIND_RADIO_PARAMS btfrp = { sizeof(btfrp) };
110 //
111 //      HBLUETOOTH_RADIO_FIND hFind = BluetoothFindFirstRadio( &btfrp, &hRadio );
112 //      if ( NULL != hFind )
113 //      {
114 //          do
115 //          {
116 //              //
117 //              //  TODO: Do something with the radio handle.
118 //              //
119 //
120 //              CloseHandle( hRadio );
121 //
122 //          } while( BluetoothFindNextRadio( hFind, &hRadio ) );
123 //
124 //          BluetoothFindRadioClose( hFind );
125 //      }
126 //
127 // ***************************************************************************
128 
129 type
130   _BLUETOOTH_FIND_RADIO_PARAMS = record
131     dwSize: DWORD;             //  IN  sizeof this structure
132   end;
133   {$EXTERNALSYM _BLUETOOTH_FIND_RADIO_PARAMS}
134   BLUETOOTH_FIND_RADIO_PARAMS = _BLUETOOTH_FIND_RADIO_PARAMS;
135   {$EXTERNALSYM BLUETOOTH_FIND_RADIO_PARAMS}
136   TBlueToothFindRadioParams = BLUETOOTH_FIND_RADIO_PARAMS;
137   PBlueToothFindRadioParams = ^BLUETOOTH_FIND_RADIO_PARAMS;
138 
139   HBLUETOOTH_RADIO_FIND = THandle;
140   {$EXTERNALSYM HBLUETOOTH_RADIO_FIND}
141 
142 //
143 //  Description:
144 //      Begins the enumeration of local Bluetooth radios.
145 //
146 //  Parameters:
147 //      pbtfrp
148 //          A pointer to a BLUETOOTH_FIND_RADIO_PARAMS structure. The dwSize
149 //          member of this structure must match the sizeof the of the structure.
150 //
151 //      phRadio
152 //          A pointer where the first radio HANDLE enumerated will be returned.
153 //
154 //  Return Values:
155 //      NULL
156 //          Error opening radios or no devices found. Use GetLastError() for
157 //          more info.
158 //
159 //          ERROR_INVALID_PARAMETER
160 //              pbtfrp parameter is NULL.
161 //
162 //          ERROR_REVISION_MISMATCH
163 //              The pbtfrp structure is not the right length.
164 //
165 //          ERROR_OUTOFMEMORY
166 //              Out of memory.
167 //
168 //          other Win32 errors.
169 //
170 //      any other
171 //          Success. The return handle is valid and phRadio points to a valid handle.
172 //
173 
BluetoothFindFirstRadionull174 function BluetoothFindFirstRadio(const pbtfrp: PBlueToothFindRadioParams; var phRadio: THandle): HBLUETOOTH_RADIO_FIND; stdcall;
175 {$EXTERNALSYM BluetoothFindFirstRadio}
176 
177 //
178 //  Description:
179 //      Finds the next installed Bluetooth radio.
180 //
181 //  Parameters:
182 //      hFind
183 //          The handle returned by BluetoothFindFirstRadio().
184 //
185 //      phRadio
186 //          A pointer where the next radio HANDLE enumerated will be returned.
187 //
188 //  Return Values:
189 //      TRUE
190 //          Next device succesfully found. pHandleOut points to valid handle.
191 //
192 //      FALSE
193 //          No device found. pHandleOut points to an invalid handle. Call
194 //          GetLastError() for more details.
195 //
196 //          ERROR_INVALID_HANDLE
197 //              The handle is NULL.
198 //
199 //          ERROR_NO_MORE_ITEMS
200 //              No more radios found.
201 //
202 //          ERROR_OUTOFMEMORY
203 //              Out of memory.
204 //
205 //          other Win32 errors
206 //
207 
BluetoothFindNextRadionull208 function BluetoothFindNextRadio(hFind: HBLUETOOTH_RADIO_FIND; var phRadio: THandle): BOOL; stdcall;
209 {$EXTERNALSYM BluetoothFindNextRadio}
210 
211 //
212 //  Description:
213 //      Closes the enumeration handle.
214 //
215 //  Parameters
216 //      hFind
217 //          The handle returned by BluetoothFindFirstRadio().
218 //
219 //  Return Values:
220 //      TRUE
221 //          Handle succesfully closed.
222 //
223 //      FALSE
224 //          Failure. Check GetLastError() for details.
225 //
226 //          ERROR_INVALID_HANDLE
227 //              The handle is NULL.
228 //
229 
BluetoothFindRadioClosenull230 function BluetoothFindRadioClose(hFind: HBLUETOOTH_RADIO_FIND): BOOL; stdcall;
231 {$EXTERNALSYM BluetoothFindRadioClose}
232 
233 // ***************************************************************************
234 //
235 //  Radio Information
236 //
237 // ***************************************************************************
238 
239 type
240   _BLUETOOTH_RADIO_INFO = record
241     dwSize: DWORD;                               // Size, in bytes, of this entire data structure
242     address: BLUETOOTH_ADDRESS;                  // Address of the local radio
243     szName: array [0..BLUETOOTH_MAX_NAME_SIZE - 1] of WideChar;    // Name of the local radio
244     ulClassofDevice: ULONG;                      // Class of device for the local radio
245     lmpSubversion: Word;                       // lmpSubversion, manufacturer specifc.
246     manufacturer: Word;                        // Manufacturer of the radio, BTH_MFG_Xxx value.  For the most up to date
247                                                 // list, goto the Bluetooth specification website and get the Bluetooth
248                                                 // assigned numbers document.
249   end;
250   {$EXTERNALSYM _BLUETOOTH_RADIO_INFO}
251   BLUETOOTH_RADIO_INFO = _BLUETOOTH_RADIO_INFO;
252   {$EXTERNALSYM BLUETOOTH_RADIO_INFO}
253   PBLUETOOTH_RADIO_INFO = ^BLUETOOTH_RADIO_INFO;
254   {$EXTERNALSYM PBLUETOOTH_RADIO_INFO}
255   TBlueToothRadioFind = BLUETOOTH_RADIO_INFO;
256   PBlueToothRadioFind = PBLUETOOTH_RADIO_INFO;
257 
258 //
259 //  Description:
260 //      Retrieves the information about the radio represented by the handle.
261 //
262 //  Parameters:
263 //      hRadio
264 //          Handle to a local radio retrieved through BluetoothFindFirstRadio()
265 //          et al or SetupDiEnumerateDeviceInterfaces()
266 //
267 //      pRadioInfo
268 //          Radio information to be filled in. The dwSize member must match the
269 //          size of the structure.
270 //
271 //  Return Values:
272 //      ERROR_SUCCESS
273 //          The information was retrieved successfully.
274 //
275 //      ERROR_INVALID_PARAMETER
276 //          pRadioInfo or hRadio is NULL.
277 //
278 //      ERROR_REVISION_MISMATCH
279 //          pRadioInfo->dwSize is invalid.
280 //
281 //      other Win32 error codes.
282 //
283 
BluetoothGetRadioInfonull284 function BluetoothGetRadioInfo(hRadio: THandle; var pRadioInfo: BLUETOOTH_RADIO_INFO): DWORD; stdcall;
285 {$EXTERNALSYM BluetoothGetRadioInfo}
286 
287 // ***************************************************************************
288 //
289 //  Device Information Stuctures
290 //
291 // ***************************************************************************
292 
293 type
294   _BLUETOOTH_DEVICE_INFO = record
295     dwSize: DWORD;                             //  size, in bytes, of this structure - must be the sizeof(BLUETOOTH_DEVICE_INFO)
296     Address: BLUETOOTH_ADDRESS;                  //  Bluetooth address
297     ulClassofDevice: ULONG;                    //  Bluetooth "Class of Device"
298     fConnected: BOOL;                         //  Device connected/in use
299     fRemembered: BOOL;                        //  Device remembered
300     fAuthenticated: BOOL;                     //  Device authenticated/paired/bonded
301     stLastSeen: SYSTEMTIME;                     //  Last time the device was seen
302     stLastUsed: SYSTEMTIME;                     //  Last time the device was used for other than RNR, inquiry, or SDP
303     szName: array [0..BLUETOOTH_MAX_NAME_SIZE - 1] of WideChar;  //  Name of the device
304   end;
305   {$EXTERNALSYM _BLUETOOTH_DEVICE_INFO}
306   BLUETOOTH_DEVICE_INFO = _BLUETOOTH_DEVICE_INFO;
307   {$EXTERNALSYM BLUETOOTH_DEVICE_INFO}
308   PBLUETOOTH_DEVICE_INFO = ^BLUETOOTH_DEVICE_INFO;
309   {$EXTERNALSYM PBLUETOOTH_DEVICE_INFO}
310   TBlueToothDeviceInfo = BLUETOOTH_DEVICE_INFO;
311   PBlueToothDeviceInfo = PBLUETOOTH_DEVICE_INFO;
312 
313 // ***************************************************************************
314 //
315 //  Device Enumeration
316 //
317 //  Description:
318 //      Enumerates the Bluetooth devices. The types of returned device depends
319 //      on the flags set in the BLUETOOTH_DEVICE_SEARCH_PARAMS (see structure
320 //      definition for details).
321 //
322 //  Sample Usage:
323 //      HBLUETOOTH_DEVICE_FIND hFind;
324 //      BLUETOOTH_DEVICE_SEARCH_PARAMS btsp = { sizeof(btsp) };
325 //      BLUETOOTH_DEVICE_INFO btdi = { sizeof(btdi) };
326 //
327 //      btsp.fReturnAuthenticated = TRUE;
328 //      btsp.fReturnRemembered    = TRUE;
329 //
330 //      hFind = BluetoothFindFirstDevice( &btsp, &btdi );
331 //      if ( NULL != hFind )
332 //      {
333 //          do
334 //          {
335 //              //
336 //              //  TODO:   Do something useful with the device info.
337 //              //
338 //
339 //          } while( BluetoothFindNextDevice( hFind, &btdi ) );
340 //
341 //          BluetoothFindDeviceClose( hFind );
342 //      }
343 //
344 // ***************************************************************************
345 
346 type
347   _BLUETOOTH_DEVICE_SEARCH_PARAMS = record
348     dwSize: DWORD;                 //  IN  sizeof this structure
349 
350     fReturnAuthenticated: BOOL;   //  IN  return authenticated devices
351     fReturnRemembered: BOOL;      //  IN  return remembered devices
352     fReturnUnknown: BOOL;         //  IN  return unknown devices
353     fReturnConnected: BOOL;       //  IN  return connected devices
354 
355     fIssueInquiry: BOOL;          //  IN  issue a new inquiry
356     cTimeoutMultiplier: UCHAR;     //  IN  timeout for the inquiry
357 
358     hRadio: THandle;                 //  IN  handle to radio to enumerate - NULL == all radios will be searched
359   end;
360   {$EXTERNALSYM _BLUETOOTH_DEVICE_SEARCH_PARAMS}
361   BLUETOOTH_DEVICE_SEARCH_PARAMS = _BLUETOOTH_DEVICE_SEARCH_PARAMS;
362   {$EXTERNALSYM BLUETOOTH_DEVICE_SEARCH_PARAMS}
363   TBlueToothDeviceSearchParams = BLUETOOTH_DEVICE_SEARCH_PARAMS;
364 
365   HBLUETOOTH_DEVICE_FIND = THandle;
366   {$EXTERNALSYM HBLUETOOTH_DEVICE_FIND}
367 
368 //
369 //  Description:
370 //      Begins the enumeration of Bluetooth devices.
371 //
372 //  Parameters:
373 //      pbtsp
374 //          A pointer to a BLUETOOTH_DEVICE_SEARCH_PARAMS structure. This
375 //          structure contains the flags and inputs used to conduct the search.
376 //          See BLUETOOTH_DEVICE_SEARCH_PARAMS for details.
377 //
378 //      pbtdi
379 //          A pointer to a BLUETOOTH_DEVICE_INFO structure to return information
380 //          about the first Bluetooth device found. Note that the dwSize member
381 //          of the structure must be the sizeof(BLUETOOTH_DEVICE_INFO) before
382 //          calling because the APIs hast to know the size of the buffer being
383 //          past in. The dwSize member must also match the exact
384 //          sizeof(BLUETOOTH_DEVICE_INFO) or the call will fail.
385 //
386 //  Return Values:
387 //      NULL
388 //          Error opening radios or not devices found. Use GetLastError for more info.
389 //
390 //          ERROR_INVALID_PARAMETER
391 //              pbtsp parameter or pbtdi parameter is NULL.
392 //
393 //          ERROR_REVISION_MISMATCH
394 //              The pbtfrp structure is not the right length.
395 //
396 //          other Win32 errors
397 //
398 //      any other value
399 //          Success. The return handle is valid and pbtdi points to valid data.
400 //
401 
BluetoothFindFirstDevicenull402 function BluetoothFindFirstDevice(const pbtsp: BLUETOOTH_DEVICE_SEARCH_PARAMS; var pbtdi: BLUETOOTH_DEVICE_INFO): HBLUETOOTH_DEVICE_FIND; stdcall;
403 {$EXTERNALSYM BluetoothFindFirstDevice}
404 
405 //
406 //  Description:
407 //      Finds the next Bluetooth device in the enumeration.
408 //
409 //  Parameters:
410 //      hFind
411 //          The handle returned from BluetoothFindFirstDevice().
412 //
413 //      pbtdi
414 //          A pointer to a BLUETOOTH_DEVICE_INFO structure to return information
415 //          about the first Bluetooth device found. Note that the dwSize member
416 //          of the structure must be the sizeof(BLUETOOTH_DEVICE_INFO) before
417 //          calling because the APIs hast to know the size of the buffer being
418 //          past in. The dwSize member must also match the exact
419 //          sizeof(BLUETOOTH_DEVICE_INFO) or the call will fail.
420 //
421 //  Return Values:
422 //      TRUE
423 //          Next device succesfully found. pHandleOut points to valid handle.
424 //
425 //      FALSE
426 //          No device found. pHandleOut points to an invalid handle. Call
427 //          GetLastError() for more details.
428 //
429 //          ERROR_INVALID_HANDLE
430 //              The handle is NULL.
431 //
432 //          ERROR_NO_MORE_ITEMS
433 //              No more radios found.
434 //
435 //          ERROR_OUTOFMEMORY
436 //              Out of memory.
437 //
438 //          other Win32 errors
439 //
440 
BluetoothFindNextDevicenull441 function BluetoothFindNextDevice(hFind: HBLUETOOTH_DEVICE_FIND; var pbtdi: BLUETOOTH_DEVICE_INFO): BOOL; stdcall;
442 {$EXTERNALSYM BluetoothFindNextDevice}
443 
444 //
445 //  Description:
446 //      Closes the enumeration handle.
447 //
448 //  Parameters:
449 //      hFind
450 //          The handle returned from BluetoothFindFirstDevice().
451 //
452 //  Return Values:
453 //      TRUE
454 //          Handle succesfully closed.
455 //
456 //      FALSE
457 //          Failure. Check GetLastError() for details.
458 //
459 //          ERROR_INVALID_HANDLE
460 //              The handle is NULL.
461 //
462 
BluetoothFindDeviceClosenull463 function BluetoothFindDeviceClose(hFind: HBLUETOOTH_DEVICE_FIND): BOOL; stdcall;
464 {$EXTERNALSYM BluetoothFindDeviceClose}
465 
466 //
467 //  Description:
468 //      Retrieves information about a remote device.
469 //
470 //      Fill in the dwSize and the Address members of the pbtdi structure
471 //      being passed in. On success, the rest of the members will be filled
472 //      out with the information that the system knows.
473 //
474 //  Parameters:
475 //      hRadio
476 //          Handle to a local radio retrieved through BluetoothFindFirstRadio()
477 //          et al or SetupDiEnumerateDeviceInterfaces()
478 //
479 //      pbtdi
480 //          A pointer to a BLUETOOTH_DEVICE_INFO structure to return information
481 //          about the first Bluetooth device found. The dwSize member of the
482 //          structure must be the sizeof the structure in bytes. The Address
483 //          member must be filled out with the Bluetooth address of the remote
484 //          device.
485 //
486 //  Return Values:
487 //      ERROR_SUCCESS
488 //          Success. Information returned.
489 //
490 //      ERROR_REVISION_MISMATCH
491 //          The size of the BLUETOOTH_DEVICE_INFO isn't compatible. Check
492 //          the dwSize member of the BLUETOOTH_DEVICE_INFO structure you
493 //          passed in.
494 //
495 //      ERROR_NOT_FOUND
496 //          The radio is not known by the system or the Address field of
497 //          the BLUETOOTH_DEVICE_INFO structure is all zeros.
498 //
499 //      ERROR_INVALID_PARAMETER
500 //          pbtdi is NULL.
501 //
502 //      other error codes
503 //
504 
505 function BluetoothGetDeviceInfo(hRadio: THandle; var pbtdi: BLUETOOTH_DEVICE_INFO): DWORD; stdcall;
506 {$EXTERNALSYM BluetoothGetDeviceInfo}
507 
508 //
509 //  Description:
510 //      Updates the computer local cache about the device.
511 //
512 //  Parameters:
513 //      pbtdi
514 //          A pointer to the BLUETOOTH_DEVICE_INFO structure to be updated.
515 //          The following members must be valid:
516 //              dwSize
517 //                  Must match the size of the structure.
518 //              Address
519 //                  Must be a previously found radio address.
520 //              szName
521 //                  New name to be stored.
522 //
523 //  Return Values:
524 //      ERROR_SUCCESS
525 //          The device information was updated successfully.
526 //
527 //      ERROR_INVALID_PARAMETER
528 //          pbtdi is NULL.
529 //
530 //      ERROR_REVISION_MISMATCH
531 //          pbtdi->dwSize is invalid.
532 //
533 //      other Win32 error codes.
534 //
535 
536 function BluetoothUpdateDeviceRecord(var pbtdi: BLUETOOTH_DEVICE_INFO): DWORD; stdcall;
537 {$EXTERNALSYM BluetoothUpdateDeviceRecord}
538 
539 //
540 //  Description:
541 //      Delete the authentication (aka "bond") between the computer and the
542 //      device. Also purges any cached information about the device.
543 //
544 //  Return Values:
545 //      ERROR_SUCCESS
546 //          The device was removed successfully.
547 //
548 //      ERROR_NOT_FOUND
549 //          The device was not found. If no Bluetooth radio is installed,
550 //          the devices could not be enumerated or removed.
551 //
552 
553 function BluetoothRemoveDevice(var pAddress: BLUETOOTH_ADDRESS): DWORD; stdcall;
554 {$EXTERNALSYM BluetoothRemoveDevice}
555 
556 // ***************************************************************************
557 //
558 //  Device Picker Dialog
559 //
560 //  Description:
561 //      Invokes a common dialog for selecting Bluetooth devices. The list
562 //      of devices displayed to the user is determined by the flags and
563 //      settings the caller specifies in the BLUETOOTH_SELECT_DEVICE_PARAMS
564 //      (see structure definition for more details).
565 //
566 //      If BluetoothSelectDevices() returns TRUE, the caller must call
567 //      BluetoothSelectDevicesFree() or memory will be leaked within the
568 //      process.
569 //
570 //  Sample Usage:
571 //
572 //      BLUETOOTH_SELECT_DEVICE_PARAMS btsdp = { sizeof(btsdp) };
573 //
574 //      btsdp.hwndParent = hDlg;
575 //      btsdp.fShowUnknown = TRUE;
576 //      btsdp.fAddNewDeviceWizard = TRUE;
577 //
578 //      BOOL b = BluetoothSelectDevices( &btsdp );
579 //      if ( b )
580 //      {
581 //          BLUETOOTH_DEVICE_INFO * pbtdi = btsdp.pDevices;
582 //          for ( ULONG cDevice = 0; cDevice < btsdp.cNumDevices; cDevice ++ )
583 //          {
584 //              if ( pbtdi->fAuthenticated || pbtdi->fRemembered )
585 //              {
586 //                  //
587 //                  //  TODO:   Do something useful with the device info
588 //                  //
589 //              }
590 //
591 //              pbtdi = (BLUETOOTH_DEVICE_INFO *) ((LPBYTE)pbtdi + pbtdi->dwSize);
592 //          }
593 //
594 //          BluetoothSelectDevicesFree( &btsdp );
595 //      }
596 //
597 // ***************************************************************************
598 
599 type
600   _BLUETOOTH_COD_PAIRS = record
601     ulCODMask: ULONG;                          //  ClassOfDevice mask to compare
602     pcszDescription: LPWSTR;                    //  Descriptive string of mask
603   end;
604   {$EXTERNALSYM _BLUETOOTH_COD_PAIRS}
605   BLUETOOTH_COD_PAIRS = _BLUETOOTH_COD_PAIRS;
606   {$EXTERNALSYM BLUETOOTH_COD_PAIRS}
607   TBlueToothCodPairs = BLUETOOTH_COD_PAIRS;
608   PBlueToothCodPairs = ^BLUETOOTH_COD_PAIRS;
609 
610   PFN_DEVICE_CALLBACK = function(pvParam: Pointer; pDevice: PBLUETOOTH_DEVICE_INFO): BOOL; stdcall;
611   {$EXTERNALSYM PFN_DEVICE_CALLBACK}
612 
613   _BLUETOOTH_SELECT_DEVICE_PARAMS = record
614     dwSize: DWORD;                             //  IN  sizeof this structure
615 
616     cNumOfClasses: ULONG;                      //  IN  Number in prgClassOfDevice - if ZERO search for all devices
617     prgClassOfDevices: PBlueToothCodPairs;    //  IN  Array of CODs to find.
618 
619     pszInfo: LPWSTR;                            //  IN  If not NULL, sets the "information" text
620 
621     hwndParent: HWND;                         //  IN  parent window - NULL == no parent
622 
623     fForceAuthentication: BOOL;               //  IN  If TRUE, authenication will be forced before returning
624     fShowAuthenticated: BOOL;                 //  IN  If TRUE, authenticated devices will be shown in the picker
625     fShowRemembered: BOOL;                    //  IN  If TRUE, remembered devices will be shown in the picker
626     fShowUnknown: BOOL;                       //  IN  If TRUE, unknown devices that are not authenticated or "remember" will be shown.
627 
628     fAddNewDeviceWizard: BOOL;                //  IN  If TRUE, invokes the add new device wizard.
629     fSkipServicesPage: BOOL;                  //  IN  If TRUE, skips the "Services" page in the wizard.
630 
631     pfnDeviceCallback: PFN_DEVICE_CALLBACK;      //  IN  If non-NULL, a callback that will be called for each device. If the
632                                                 //      the callback returns TRUE, the item will be added. If the callback is
633                                                 //      is FALSE, the item will not be shown.
634     pvParam: Pointer;                            //  IN  Parameter to be passed to pfnDeviceCallback as the pvParam.
635 
636     cNumDevices: DWORD;                        //  IN  number calles wants - ZERO == no limit.
637                                                 //  OUT the number of devices returned.
638 
639     pDevices: PBLUETOOTH_DEVICE_INFO;           //  OUT pointer to an array for BLUETOOTH_DEVICE_INFOs.
640                                                 //      call BluetoothSelectDevicesFree() to free
641   end;
642   {$EXTERNALSYM _BLUETOOTH_SELECT_DEVICE_PARAMS}
643   BLUETOOTH_SELECT_DEVICE_PARAMS = _BLUETOOTH_SELECT_DEVICE_PARAMS;
644   {$EXTERNALSYM BLUETOOTH_SELECT_DEVICE_PARAMS}
645   TBlueToothSelectDeviceParams = BLUETOOTH_SELECT_DEVICE_PARAMS;
646   PBlueToothSelectDeviceParams = ^BLUETOOTH_SELECT_DEVICE_PARAMS;
647 
648 //
649 //  Description:
650 //      (See header above)
651 //
652 //  Return Values:
653 //      TRUE
654 //          User selected a device. pbtsdp->pDevices points to valid data.
655 //          Caller should check the fAuthenticated && fRemembered flags to
656 //          determine which devices we successfuly authenticated or valid
657 //          selections by the user.
658 //
659 //          Use BluetoothSelectDevicesFree() to free the nessecary data
660 //          such as pDevices only if this function returns TRUE.
661 //
662 //      FALSE
663 //          No valid data returned. Call GetLastError() for possible details
664 //          of the failure. If GLE() is:
665 //
666 //          ERROR_CANCELLED
667 //              The user cancelled  the request.
668 //
669 //          ERROR_INVALID_PARAMETER
670 //              The pbtsdp is NULL.
671 //
672 //          ERROR_REVISION_MISMATCH
673 //              The structure passed in as pbtsdp is of an unknown size.
674 //
675 //          other WIN32 errors
676 //
677 
678 function BluetoothSelectDevices(pbtsdp: PBlueToothSelectDeviceParams): BOOL; stdcall;
679 {$EXTERNALSYM BluetoothSelectDevices}
680 
681 //
682 //  Description:
683 //      This function should only be called if BluetoothSelectDevices() returns
684 //      TRUE. This function will free any memory and resource returned by the
685 //      BluetoothSelectDevices() in the BLUETOOTH_SELECT_DEVICE_PARAMS
686 //      structure.
687 //
688 //  Return Values:
689 //      TRUE
690 //          Success.
691 //
692 //      FALSE
693 //          Nothing to free.
694 //
695 
696 function BluetoothSelectDevicesFree(pbtsdp: PBlueToothSelectDeviceParams): BOOL; stdcall;
697 {$EXTERNALSYM BluetoothSelectDevicesFree}
698 
699 // ***************************************************************************
700 //
701 //  Device Property Sheet
702 //
703 // ***************************************************************************
704 
705 //
706 //  Description:
707 //      Invokes the CPLs device info property sheet.
708 //
709 //  Parameters:
710 //      hwndParent
711 //          HWND to parent the property sheet.
712 //
713 //      pbtdi
714 //          A pointer to a BLUETOOTH_DEVICE_INFO structure of the device
715 //          to be displayed.
716 //
717 //  Return Values:
718 //      TRUE
719 //          The property page was successfully displayed.
720 //
721 //      FALSE
722 //          Failure. The property page was not displayed. Check GetLastError
723 //          for more details.
724 //
725 
726 function BluetoothDisplayDeviceProperties(hwndParent: HWND; pbtdi: PBLUETOOTH_DEVICE_INFO): BOOL; stdcall;
727 {$EXTERNALSYM BluetoothDisplayDeviceProperties}
728 
729 // ***************************************************************************
730 //
731 //  Radio Authentication
732 //
733 // ***************************************************************************
734 
735 //
736 //  Description:
737 //      Sends an authentication request to a remote device.
738 //
739 //      There are two modes of operation. "Wizard mode" and "Blind mode."
740 //
741 //      "Wizard mode" is invoked when the pszPasskey is NULL. This will cause
742 //      the "Bluetooth Connection Wizard" to be invoked. The user will be
743 //      prompted to enter a passkey during the wizard after which the
744 //      authentication request will be sent. The user will see the success
745 //      or failure of the authentication attempt. The user will also be
746 //      given the oppurtunity to try to fix a failed authentication.
747 //
748 //      "Blind mode" is invoked when the pszPasskey is non-NULL. This will
749 //      cause the computer to send a authentication request to the remote
750 //      device. No UI is ever displayed. The Bluetooth status code will be
751 //      mapped to a Win32 Error code.
752 //
753 //  Parameters:
754 //
755 //      hwndParent
756 //          The window to parent the authentication wizard. If NULL, the
757 //          wizard will be parented off the desktop.
758 //
759 //      hRadio
760 //          A valid local radio handle or NULL. If NULL, then all radios will
761 //          be tired. If any of the radios succeed, then the call will
762 //          succeed.
763 //
764 //      pbtdi
765 //          BLUETOOTH_DEVICE_INFO record of the device to be authenticated.
766 //
767 //      pszPasskey
768 //          PIN to be used to authenticate the device.  If NULL, then UI is
769 //          displayed and the user steps through the authentication process.
770 //          If not NULL, no UI is shown.  The passkey is NOT NULL terminated.
771 //
772 //      ulPasskeyLength
773 //          Length of szPassKey in bytes. The length must be less than or
774 //          equal to BLUETOOTH_MAX_PASSKEY_SIZE * sizeof(WCHAR).
775 //
776 //  Return Values:
777 //
778 //      ERROR_SUCCESS
779 //          Success.
780 //
781 //      ERROR_CANCELLED
782 //          User aborted the operation.
783 //
784 //      ERROR_INVALID_PARAMETER
785 //          The device structure in pbtdi is invalid.
786 //
787 //      ERROR_NO_MORE_ITEMS
788 //          The device in pbtdi is already been marked as authenticated.
789 //
790 //      other WIN32 error
791 //          Failure. Return value is the error code.
792 //
793 //      For "Blind mode," here is the current mapping of Bluetooth status
794 //      code to Win32 error codes:
795 //
796 //          { BTH_ERROR_SUCCESS,                ERROR_SUCCESS },
797 //          { BTH_ERROR_NO_CONNECTION,          ERROR_DEVICE_NOT_CONNECTED },
798 //          { BTH_ERROR_PAGE_TIMEOUT,           WAIT_TIMEOUT },
799 //          { BTH_ERROR_HARDWARE_FAILURE,       ERROR_GEN_FAILURE },
800 //          { BTH_ERROR_AUTHENTICATION_FAILURE, ERROR_NOT_AUTHENTICATED },
801 //          { BTH_ERROR_MEMORY_FULL,            ERROR_NOT_ENOUGH_MEMORY },
802 //          { BTH_ERROR_CONNECTION_TIMEOUT,     WAIT_TIMEOUT },
803 //          { BTH_ERROR_LMP_RESPONSE_TIMEOUT,   WAIT_TIMEOUT },
804 //          { BTH_ERROR_MAX_NUMBER_OF_CONNECTIONS, ERROR_REQ_NOT_ACCEP },
805 //          { BTH_ERROR_PAIRING_NOT_ALLOWED,    ERROR_ACCESS_DENIED },
806 //          { BTH_ERROR_UNSPECIFIED_ERROR,      ERROR_NOT_READY },
807 //          { BTH_ERROR_LOCAL_HOST_TERMINATED_CONNECTION, ERROR_VC_DISCONNECTED },
808 //
809 
810 function BluetoothAuthenticateDevice(
811     hwndParent: HWND;
812     hRadio: THandle;
813     pbtbi: PBLUETOOTH_DEVICE_INFO;
814     pszPasskey: PWideChar;
815     ulPasskeyLength: ULONG): DWORD; stdcall;
816 {$EXTERNALSYM BluetoothAuthenticateDevice}
817 
818 //
819 //  Description:
820 //      Allows the caller to prompt for multiple devices to be authenticated
821 //      within a single instance of the "Bluetooth Connection Wizard."
822 //
823 //  Parameters:
824 //
825 //      hwndParent
826 //          The window to parent the authentication wizard. If NULL, the
827 //          wizard will be parented off the desktop.
828 //
829 //      hRadio
830 //          A valid local radio handle or NULL. If NULL, then all radios will
831 //          be tired. If any of the radios succeed, then the call will
832 //          succeed.
833 //
834 //      cDevices
835 //          Number of devices in the rgbtdi array.
836 //
837 //      rgbtdi
838 //          An array BLUETOOTH_DEVICE_INFO records of the devices to be
839 //          authenticated.
840 //
841 //  Return Values:
842 //
843 //      ERROR_SUCCESS
844 //          Success. Check the fAuthenticate flag on each of the devices.
845 //
846 //      ERROR_CANCELLED
847 //          User aborted the operation. Check the fAuthenticate flags on
848 //          each device to determine if any of the devices were authenticated
849 //          before the user cancelled the operation.
850 //
851 //      ERROR_INVALID_PARAMETER
852 //          One of the items in the array of devices is invalid.
853 //
854 //      ERROR_NO_MORE_ITEMS
855 //          All the devices in the array of devices are already been marked as
856 //          being authenticated.
857 //
858 //      other WIN32 error
859 //          Failure. Return value is the error code.
860 //
861 
862 function BluetoothAuthenticateMultipleDevices(
863     hwndParent: HWND;
864     hRadio: THandle;
865     cDevices: DWORD;
866     pbtdi: PBLUETOOTH_DEVICE_INFO): DWORD; stdcall;
867 {$EXTERNALSYM BluetoothAuthenticateMultipleDevices}
868 
869 // ***************************************************************************
870 //
871 //  Bluetooth Services
872 //
873 // ***************************************************************************
874 
875 const
876   BLUETOOTH_SERVICE_DISABLE  = $00;
877   {$EXTERNALSYM BLUETOOTH_SERVICE_DISABLE}
878   BLUETOOTH_SERVICE_ENABLE   = $01;
879   {$EXTERNALSYM BLUETOOTH_SERVICE_ENABLE}
880   BLUETOOTH_SERVICE_MASK     = BLUETOOTH_SERVICE_ENABLE or BLUETOOTH_SERVICE_DISABLE;
881   {$EXTERNALSYM BLUETOOTH_SERVICE_MASK}
882 
883 //
884 //  Description:
885 //      Enables/disables the services for a particular device.
886 //
887 //      The system maintains a mapping of service guids to supported drivers for
888 //      Bluetooth-enabled devices. Enabling a service installs the corresponding
889 //      device driver. Disabling a service removes the corresponding device driver.
890 //
891 //      If a non-supported service is enabled, a driver will not be installed.
892 //
893 //  Parameters
894 //      hRadio
895 //          Handle of the local Bluetooth radio device.
896 //
897 //      pbtdi
898 //          Pointer to a BLUETOOTH_DEVICE_INFO record.
899 //
900 //      pGuidService
901 //          The service GUID on the remote device.
902 //
903 //      dwServiceFlags
904 //          Flags to adjust the service.
905 //              BLUETOOTH_SERVICE_DISABLE   -   disable the service
906 //              BLUETOOTH_SERVICE_ENABLE    -   enables the service
907 //
908 //  Return Values:
909 //      ERROR_SUCCESS
910 //          The call was successful.
911 //
912 //      ERROR_INVALID_PARAMETER
913 //          dwServiceFlags are invalid.
914 //
915 //      ERROR_SERVICE_DOES_NOT_EXIST
916 //          The GUID in pGuidService is not supported.
917 //
918 //      other WIN32 error
919 //          The call failed.
920 //
921 
922 function BluetoothSetServiceState(
923     hRadio: THandle;
924     pbtdi: PBLUETOOTH_DEVICE_INFO;
925     const pGuidService: TGUID;
926     dwServiceFlags: DWORD): DWORD; stdcall;
927 {$EXTERNALSYM BluetoothSetServiceState}
928 
929 //
930 //  Description:
931 //      Enumerates the services guids enabled on a particular device. If hRadio
932 //      is NULL, all device will be searched for the device and all the services
933 //      enabled will be returned.
934 //
935 //  Parameters:
936 //      hRadio
937 //          Handle of the local Bluetooth radio device. If NULL, it will search
938 //          all the radios for the address in the pbtdi.
939 //
940 //      pbtdi
941 //          Pointer to a BLUETOOTH_DEVICE_INFO record.
942 //
943 //      pcService
944 //          On input, the number of records pointed to by pGuidServices.
945 //          On output, the number of valid records return in pGuidServices.
946 //
947 //      pGuidServices
948 //          Pointer to memory that is at least *pcService in length.
949 //
950 //  Return Values:
951 //      ERROR_SUCCESS
952 //          The call succeeded. pGuidServices is valid.
953 //
954 //      ERROR_MORE_DATA
955 //          The call succeeded. pGuidService contains an incomplete list of
956 //          enabled service GUIDs.
957 //
958 //      other WIN32 errors
959 //          The call failed.
960 //
961 
962 function BluetoothEnumerateInstalledServices(
963     hRadio: THandle;
964     pbtdi: PBLUETOOTH_DEVICE_INFO;
965     var pcServices: DWORD;
966     pGuidServices: PGUID): DWORD; stdcall;
967 {$EXTERNALSYM BluetoothEnumerateInstalledServices}
968 
969 //
970 //  Description:
971 //      Change the discovery state of the local radio(s).
972 //      If hRadio is NULL, all the radios will be set.
973 //
974 //      Use BluetoothIsDiscoverable() to determine the radios current state.
975 //
976 //      The system ensures that a discoverable system is connectable, thus
977 //      the radio must allow incoming connections (see
978 //      BluetoothEnableIncomingConnections) prior to making a radio
979 //      discoverable. Failure to do so will result in this call failing
980 //      (returns FALSE).
981 //
982 //  Parameters:
983 //      hRadio
984 //          If not NULL, changes the state of a specific radio.
985 //          If NULL, the API will interate through all the radios.
986 //
987 //      fEnabled
988 //          If FALSE, discovery will be disabled.
989 //
990 //  Return Values
991 //      TRUE
992 //          State was successfully changed. If the caller specified NULL for
993 //          hRadio, at least of the radios accepted the state change.
994 //
995 //      FALSE
996 //          State was not changed. If the caller specified NULL for hRadio, all
997 //          of the radios did not accept the state change.
998 //
999 
1000 function BluetoothEnableDiscovery(hRadio: THandle; fEnabled: BOOL): BOOL; stdcall;
1001 {$EXTERNALSYM BluetoothEnableDiscovery}
1002 
1003 //
1004 //  Description:
1005 //      Determines if the Bluetooth radios are discoverable. If there are
1006 //      multiple radios, the first one to say it is discoverable will cause
1007 //      this function to return TRUE.
1008 //
1009 //  Parameters:
1010 //      hRadio
1011 //          Handle of the radio to check. If NULL, it will check all local
1012 //          radios.
1013 //
1014 //  Return Values:
1015 //      TRUE
1016 //          A least one radio is discoverable.
1017 //
1018 //      FALSE
1019 //          No radios are discoverable.
1020 //
1021 
1022 function BluetoothIsDiscoverable(hRadio: THandle): BOOL; stdcall;
1023 {$EXTERNALSYM BluetoothIsDiscoverable}
1024 
1025 //
1026 //  Description:
1027 //      Enables/disables the state of a radio to accept incoming connections.
1028 //      If hRadio is NULL, all the radios will be set.
1029 //
1030 //      Use BluetoothIsConnectable() to determine the radios current state.
1031 //
1032 //      The system enforces that a radio that is not connectable is not
1033 //      discoverable too. The radio must be made non-discoverable (see
1034 //      BluetoothEnableDiscovery) prior to making a radio non-connectionable.
1035 //      Failure to do so will result in this call failing (returns FALSE).
1036 //
1037 //  Parameters:
1038 //      hRadio
1039 //          If not NULL, changes the state of a specific radio.
1040 //          If NULL, the API will interate through all the radios.
1041 //
1042 //      fEnabled
1043 //          If FALSE, incoming connection will be disabled.
1044 //
1045 //  Return Values
1046 //      TRUE
1047 //          State was successfully changed. If the caller specified NULL for
1048 //          hRadio, at least of the radios accepted the state change.
1049 //
1050 //      FALSE
1051 //          State was not changed. If the caller specified NULL for hRadio, all
1052 //          of the radios did not accept the state change.
1053 //
1054 
1055 function BluetoothEnableIncomingConnections(hRadio: THandle; fEnabled: BOOL): BOOL; stdcall;
1056 {$EXTERNALSYM BluetoothEnableIncomingConnections}
1057 
1058 //
1059 //  Description:
1060 //      Determines if the Bluetooth radios are connectable. If there are
1061 //      multiple radios, the first one to say it is connectable will cause
1062 //      this function to return TRUE.
1063 //
1064 //  Parameters:
1065 //      hRadio
1066 //          Handle of the radio to check. If NULL, it will check all local
1067 //          radios.
1068 //
1069 //  Return Values:
1070 //      TRUE
1071 //          A least one radio is allowing incoming connections.
1072 //
1073 //      FALSE
1074 //          No radios are allowing incoming connections.
1075 //
1076 
1077 function BluetoothIsConnectable(hRadio: THandle): BOOL; stdcall;
1078 {$EXTERNALSYM BluetoothIsConnectable}
1079 
1080 // ***************************************************************************
1081 //
1082 //  Authentication Registration
1083 //
1084 // ***************************************************************************
1085 
1086 type
1087   HBLUETOOTH_AUTHENTICATION_REGISTRATION = THandle;
1088   {$EXTERNALSYM HBLUETOOTH_AUTHENTICATION_REGISTRATION}
1089 
1090   PFN_AUTHENTICATION_CALLBACK = function(pvParam: Pointer; pDevice: PBLUETOOTH_DEVICE_INFO): BOOL; stdcall;
1091   {$EXTERNALSYM PFN_AUTHENTICATION_CALLBACK}
1092 
1093 //
1094 //  Description:
1095 //      Registers a callback function to be called when a particular device
1096 //      requests authentication. The request is sent to the last application
1097 //      that requested authentication for a particular device.
1098 //
1099 //  Parameters:
1100 //      pbtdi
1101 //          A pointer to a BLUETOOTH_DEVICE_INFO structure. The Bluetooth
1102 //          address will be used for comparision.
1103 //
1104 //      phRegHandle
1105 //          A pointer to where the registration HANDLE value will be
1106 //          stored. Call BluetoothUnregisterAuthentication() to close
1107 //          the handle.
1108 //
1109 //      pfnCallback
1110 //          The function that will be called when the authentication event
1111 //          occurs. This function should match PFN_AUTHENTICATION_CALLBACK's
1112 //          prototype.
1113 //
1114 //      pvParam
1115 //          Optional parameter to be past through to the callback function.
1116 //          This can be anything the application was to define.
1117 //
1118 //  Return Values:
1119 //      ERROR_SUCCESS
1120 //          Success. A valid registration handle was returned.
1121 //
1122 //      ERROR_OUTOFMEMORY
1123 //          Out of memory.
1124 //
1125 //      other Win32 error.
1126 //          Failure. The registration handle is invalid.
1127 //
1128 
BluetoothRegisterForAuthenticationnull1129 function BluetoothRegisterForAuthentication(
1130     pbtdi: PBLUETOOTH_DEVICE_INFO;
1131     var phRegHandle: HBLUETOOTH_AUTHENTICATION_REGISTRATION;
1132     pfnCallback: PFN_AUTHENTICATION_CALLBACK;
1133     pvParam: Pointer): DWORD; stdcall;
1134 {$EXTERNALSYM BluetoothRegisterForAuthentication}
1135 
1136 //
1137 //  Description:
1138 //      Unregisters an authentication callback and closes the handle. See
1139 //      BluetoothRegisterForAuthentication() for more information about
1140 //      authentication registration.
1141 //
1142 //  Parameters:
1143 //      hRegHandle
1144 //          Handle returned by BluetoothRegisterForAuthentication().
1145 //
1146 //  Return Value:
1147 //      TRUE
1148 //          The handle was successfully closed.
1149 //
1150 //      FALSE
1151 //          The handle was not successfully closed. Check GetLastError for
1152 //          more details.
1153 //
1154 //          ERROR_INVALID_HANDLE
1155 //              The handle is NULL.
1156 //
1157 //          other Win32 errors.
1158 //
1159 
BluetoothUnregisterAuthenticationnull1160 function BluetoothUnregisterAuthentication(hRegHandle: HBLUETOOTH_AUTHENTICATION_REGISTRATION): BOOL; stdcall;
1161 {$EXTERNALSYM BluetoothUnregisterAuthentication}
1162 
1163 //
1164 //  Description:
shouldnull1165 //      This function should be called after receiving an authentication request
1166 //      to send the passkey response.
1167 //
1168 //  Parameters:
1169 //
1170 //      hRadio
1171 //          Optional handle to the local radio. If NULL, the function will try
1172 //          each radio until one succeeds.
1173 //
1174 //      pbtdi
1175 //          A pointer to a BLUETOOTH_DEVICE_INFO structure describing the device
1176 //          being authenticated. This can be the same structure passed to the
1177 //          callback function.
1178 //
1179 //      pszPasskey
1180 //          A pointer to UNICODE zero-terminated string of the passkey response
1181 //          that should be sent back to the authenticating device.
1182 //
1183 //  Return Values:
1184 //      ERROR_SUCESS
1185 //          The device accepted the passkey response. The device is authenticated.
1186 //
1187 //      ERROR_CANCELED
1188 //          The device denied the passkey reponse. This also will returned if there
1189 //          is a communications problem with the local radio.
1190 //
1191 //      E_FAIL
1192 //          The device returned a failure code during authentication.
1193 //
1194 //      other Win32 error codes
1195 //
1196 
1197 function BluetoothSendAuthenticationResponse(
1198     hRadio: THandle;
1199     pbtdi: PBLUETOOTH_DEVICE_INFO;
1200     pszPasskey: LPWSTR): DWORD; stdcall;
1201 {$EXTERNALSYM BluetoothSendAuthenticationResponse}
1202 
1203 // ***************************************************************************
1204 //
1205 //  SDP Parsing Functions
1206 //
1207 // ***************************************************************************
1208 
1209 type
1210   TSpdElementDataString = record
1211     // raw string buffer, may not be encoded as ANSI, use
1212     // BluetoothSdpGetString to convert the value if it is described
1213     // by the base language attribute ID list
1214     value: PBYTE;
1215     // raw length of the string, may not be NULL terminuated
1216     length: ULONG;
1217   end;
1218 
1219   TSpdElementDataUrl = record
1220     value: PBYTE;
1221     length: ULONG;
1222   end;
1223 
1224   // type == SDP_TYPE_SEQUENCE
1225   TSpdElementDataSequence = record
1226     // raw sequence, starts at sequence element header
1227     value: PBYTE;
1228     // raw sequence length
1229     length: ULONG;
1230   end;
1231 
1232   // type == SDP_TYPE_ALTERNATIVE
1233   TSpdElementDataAlternative = record
1234     // raw alternative, starts at alternative element header
1235     value: PBYTE;
1236     // raw alternative length
1237     length: ULONG;
1238   end;
1239 
1240   _SDP_ELEMENT_DATA = record
1241     //
1242     // Enumeration of SDP element types.  Generic element types will have a
1243     // specificType value other then SDP_ST_NONE.  The generic types are:
1244     // o SDP_TYPE_UINT
1245     // o SDP_TYPE_INT
1246     // o SDP_TYPE_UUID
1247     //
1248     type_: SDP_TYPE;
1249 
1250     //
1251     // Specific types for the generic SDP element types.
1252     //
1253     specificType: SDP_SPECIFICTYPE;
1254 
1255     //
1256     // Union of all possible data types.  type and specificType will indicate
1257     // which field is valid.  For types which do not have a valid specificType,
1258     // specific type will be SDP_ST_NONE.
1259     //
1260     case Integer of
1261         // type == SDP_TYPE_INT
1262         0: (int128: SDP_LARGE_INTEGER_16);        // specificType == SDP_ST_INT128
1263         1: (int64: LONGLONG);                     // specificType == SDP_ST_INT64
1264         2: (int32: Integer);                         // specificType == SDP_ST_INT32
1265         3: (int16: SHORT);                        // specificType == SDP_ST_INT16
1266         4: (int8: CHAR);                          // specificType == SDP_ST_INT8
1267 
1268         // type == SDP_TYPE_UINT
1269         5: (uint128: SDP_ULARGE_INTEGER_16);      // specificType == SDP_ST_UINT128
1270         6: (uint64: Int64);                   // specificType == SDP_ST_UINT64
1271         7: (uint32: ULONG);                       // specificType == SDP_ST_UINT32
1272         8: (uint16: Word);                      // specificType == SDP_ST_UINT16
1273         9: (uint8: UCHAR);                        // specificType == SDP_ST_UINT8
1274 
1275         // type == SDP_TYPE_BOOLEAN
1276         10: (booleanVal: UCHAR);
1277 
1278         // type == SDP_TYPE_UUID
1279         11: (uuid128: TGUID);                       // specificType == SDP_ST_UUID128
1280         12: (uuid32: ULONG);                       // specificType == SDP_ST_UUID32
1281         13: (uuid16: Word);                      // specificType == SDP_ST_UUID32
1282 
1283         // type == SDP_TYPE_STRING
1284         14: (string_: TSpdElementDataString);
1285         // type == SDP_TYPE_URL
1286         15: (url: TSpdElementDataUrl);
1287 
1288         // type == SDP_TYPE_SEQUENCE
1289         16: (sequence: TSpdElementDataSequence);
1290 
1291         // type == SDP_TYPE_ALTERNATIVE
1292         17: (alternative: TSpdElementDataAlternative);
1293   end;
1294   {$EXTERNALSYM _SDP_ELEMENT_DATA}
1295   SDP_ELEMENT_DATA = _SDP_ELEMENT_DATA;
1296   {$EXTERNALSYM SDP_ELEMENT_DATA}
1297   PSDP_ELEMENT_DATA = ^SDP_ELEMENT_DATA;
1298   {$EXTERNALSYM PSDP_ELEMENT_DATA}
1299   TSdpElementData = SDP_ELEMENT_DATA;
1300   PSdpElementData = PSDP_ELEMENT_DATA;
1301 
1302 //
1303 // Description:
1304 //      Retrieves and parses the element found at pSdpStream
1305 //
1306 // Parameters:
1307 //      IN pSdpStream
1308 //          pointer to valid SDP stream
1309 //
1310 //      IN cbSdpStreamLength
1311 //          length of pSdpStream in bytes
1312 //
1313 //      OUT pData
1314 //          pointer to be filled in with the data of the SDP element at the
1315 //          beginning of pSdpStream
1316 //
1317 // Return Values:
1318 //      ERROR_INVALID_PARAMETER
1319 //          one of required parameters is NULL or the pSdpStream is invalid
1320 //
1321 //      ERROR_SUCCESS
1322 //          the sdp element was parsed correctly
1323 //
1324 
BluetoothSdpGetElementDatanull1325 function BluetoothSdpGetElementData(
1326     pSdpStream: PBYTE;
1327     cbSdpStreamLength: ULONG;
1328     pData: PSDP_ELEMENT_DATA): DWORD; stdcall;
1329 {$EXTERNALSYM BluetoothSdpGetElementData}
1330 
1331 type
1332   HBLUETOOTH_CONTAINER_ELEMENT = THandle;
1333   {$EXTERNALSYM HBLUETOOTH_CONTAINER_ELEMENT}
1334 
1335 //
1336 // Description:
1337 //      Iterates over a container stream, returning each elemetn contained with
1338 //      in the container element at the beginning of pContainerStream
1339 //
1340 // Parameters:
1341 //      IN pContainerStream
1342 //          pointer to valid SDP stream whose first element is either a sequence
1343 //          or alternative
1344 //
1345 //      IN cbContainerlength
1346 //          length in bytes of pContainerStream
1347 //
1348 //      IN OUT pElement
1349 //          Value used to keep track of location within the stream.  The first
isnull1350 //          time this function is called for a particular container, *pElement
1351 //          should equal NULL.  Upon subsequent calls, the value should be
1352 //          unmodified.
1353 //
1354 //      OUT pData
1355 //          pointer to be filled in with the data of the SDP element at the
1356 //          current element of pContainerStream
1357 //
1358 //  Return Values:
1359 //      ERROR_SUCCESS
1360 //          The call succeeded, pData contains the data
1361 //
1362 //      ERROR_NO_MORE_ITEMS
1363 //          There are no more items in the list, the caller should cease calling
1364 //          BluetoothSdpGetContainerElementData for this container.
1365 //
1366 //      ERROR_INVALID_PARAMETER
1367 //          A required pointer is NULL or the container is not a valid SDP
1368 //          stream
1369 //
1370 // Usage example:
1371 //
1372 // HBLUETOOTH_CONTAINER_ELEMENT element;
1373 // SDP_ELEMENT_DATA data;
1374 // ULONG result;
1375 //
1376 // element = NULL;
1377 //
1378 // while (TRUE) {
1379 //      result = BluetoothSdpGetContainerElementData(
1380 //          pContainer, ulContainerLength, &element, &data);
1381 //
1382 //      if (result == ERROR_NO_MORE_ITEMS) {
1383 //          // We are done
1384 //          break;
1385 //      }
1386 //      else if (result != ERROR_SUCCESS) {
1387 //          // error
1388 //      }
1389 //
1390 //      // do something with data ...
1391 // }
1392 //
1393 //
1394 
1395 function BluetoothSdpGetContainerElementData(
1396     pContainerStream: PBYTE;
1397     cbContainerLength: ULONG;
1398     var pElement: HBLUETOOTH_CONTAINER_ELEMENT;
1399     pData: PSDP_ELEMENT_DATA): DWORD; stdcall;
1400 {$EXTERNALSYM BluetoothSdpGetContainerElementData}
1401 
1402 //
1403 // Description:
1404 //      Retrieves the attribute value for the given attribute ID.  pRecordStream
1405 //      must be an SDP stream that is formatted as an SDP record, a SEQUENCE
1406 //      containing UINT16 + element pairs.
1407 //
1408 // Parameters:
1409 //      IN pRecordStream
1410 //          pointer to a valid SDP stream which is formatted as a singl SDP
1411 //          record
1412 //
1413 //      IN cbRecordlnegh
1414 //          length of pRecordStream in bytes
1415 //
1416 //      IN usAttributeId
1417 //          the attribute ID to search for.  see bthdef.h for SDP_ATTRIB_Xxx
1418 //          values.
1419 //
1420 //      OUT pAttributeData
1421 //          pointer that will contain the attribute ID's value
1422 //
1423 // Return Values:
1424 //      ERRROR_SUCCESS
1425 //          Call succeeded, pAttributeData contains the attribute value
1426 //
1427 //      ERROR_INVALID_PARAMETER
1428 //          One of the required pointers was NULL, pRecordStream was not a valid
1429 //          SDP stream, or pRecordStream was not a properly formatted SDP record
1430 //
1431 //      ERROR_FILE_NOT_FOUND
1432 //          usAttributeId was not found in the record
1433 //
1434 // Usage:
1435 //
1436 // ULONG result;
1437 // SDP_DATA_ELEMENT data;
1438 //
1439 // result = BluetoothSdpGetAttributeValue(
1440 //      pRecordStream, cbRecordLength, SDP_ATTRIB_RECORD_HANDLE, &data);
1441 // if (result == ERROR_SUCCESS) {
1442 //      printf("record handle is 0x%x\n", data.data.uint32);
1443 // }
1444 //
1445 
1446 function BluetoothSdpGetAttributeValue(
1447     pRecordStream: PBYTE;
1448     cbRecordLength: ULONG;
1449     usAttributeId: Word;
1450     pAttributeData: PSDP_ELEMENT_DATA): DWORD; stdcall;
1451 {$EXTERNALSYM BluetoothSdpGetAttributeValue}
1452 
1453 //
1454 // These three fields correspond one to one with the triplets defined in the
1455 // SDP specification for the language base attribute ID list.
1456 //
1457 
1458 type
1459   _SDP_STRING_TYPE_DATA = record
1460     //
1461     // How the string is encoded according to ISO 639:1988 (E/F): "Code
1462     // for the representation of names of languages".
1463     //
1464     encoding: Word;
1465 
1466     //
1467     // MIBE number from IANA database
1468     //
1469     mibeNum: Word;
1470 
1471     //
1472     // The base attribute where the string is to be found in the record
1473     //
1474     attributeId: Word;
1475   end;
1476   {$EXTERNALSYM _SDP_STRING_TYPE_DATA}
1477   SDP_STRING_TYPE_DATA = _SDP_STRING_TYPE_DATA;
1478   {$EXTERNALSYM SDP_STRING_TYPE_DATA}
1479   PSDP_STRING_TYPE_DATA = ^SDP_STRING_TYPE_DATA;
1480   {$EXTERNALSYM PSDP_STRING_TYPE_DATA}
1481   TSdpStringTypeData = SDP_STRING_TYPE_DATA;
1482   PSdpStringTypeData = PSDP_STRING_TYPE_DATA;
1483 
1484 //
1485 // Description:
1486 //      Converts a raw string embedded in the SDP record into a UNICODE string
1487 //
1488 // Parameters:
1489 //      IN pRecordStream
1490 //          a valid SDP stream which is formatted as an SDP record
1491 //
1492 //      IN cbRecordLength
1493 //          length of pRecordStream in bytes
1494 //
1495 //      IN pStringData
1496 //          if NULL, then the calling thread's locale will be used to search
1497 //          for a matching string in the SDP record.  If not NUL, the mibeNum
1498 //          and attributeId will be used to find the string to convert.
1499 //
1500 //      IN usStringOffset
1501 //          the SDP string type offset to convert.  usStringOffset is added to
1502 //          the base attribute id of the string.   SDP specification defined
1503 //          offsets are: STRING_NAME_OFFSET, STRING_DESCRIPTION_OFFSET, and
1504 //          STRING_PROVIDER_NAME_OFFSET (found in bthdef.h).
1505 //
1506 //      OUT pszString
1507 //          if NULL, pcchStringLength will be filled in with the required number
1508 //          of characters (not bytes) to retrieve the converted string.
1509 //
1510 //      IN OUT pcchStringLength
1511 //          Upon input, if pszString is not NULL, will contain the length of
1512 //          pszString in characters.  Upon output, it will contain either the
1513 //          number of required characters including NULL if an error is returned
1514 //          or the number of characters written to pszString (including NULL).
1515 //
1516 //  Return Values:
1517 //      ERROR_SUCCES
1518 //          Call was successful and pszString contains the converted string
1519 //
1520 //      ERROR_MORE_DATA
1521 //          pszString was NULL or too small to contain the converted string,
1522 //          pccxhStringLength contains the required length in characters
1523 //
1524 //      ERROR_INVALID_DATA
1525 //          Could not perform the conversion
1526 //
1527 //      ERROR_NO_SYSTEM_RESOURCES
1528 //          Could not allocate memory internally to perform the conversion
1529 //
1530 //      ERROR_INVALID_PARAMETER
1531 //          One of the rquired pointers was NULL, pRecordStream was not a valid
1532 //          SDP stream, pRecordStream was not a properly formatted record, or
1533 //          the desired attribute + offset was not a string.
1534 //
1535 //      Other HRESULTs returned by COM
1536 //
1537 
BluetoothSdpGetStringnull1538 function BluetoothSdpGetString(
1539     pRecordStream: PBYTE;
1540     cbRecordLength: ULONG;
1541     pStringData: PSDP_STRING_TYPE_DATA;
1542     usStringOffset: Word;
1543     pszString: PWideChar;
1544     pcchStringLength: PULONG): DWORD; stdcall;
1545 {$EXTERNALSYM BluetoothSdpGetString}
1546 
1547 // ***************************************************************************
1548 //
1549 //  Raw Attribute  Enumeration
1550 //
1551 // ***************************************************************************
1552 
1553 type
1554   PFN_BLUETOOTH_ENUM_ATTRIBUTES_CALLBACK = function(
uAttribIdnull1555     uAttribId: ULONG;
1556     pValueStream: PBYTE;
1557     cbStreamSize: ULONG;
1558     pvParam: Pointer): BOOL; stdcall;
1559   {$EXTERNALSYM PFN_BLUETOOTH_ENUM_ATTRIBUTES_CALLBACK}
1560 
1561 //
1562 //  Description:
1563 //      Enumerates through the SDP record stream calling the Callback function
1564 //      for each attribute in the record. If the Callback function returns
1565 //      FALSE, the enumeration is stopped.
1566 //
1567 //  Return Values:
1568 //      TRUE
1569 //          Success! Something was enumerated.
1570 //
1571 //      FALSE
1572 //          Failure. GetLastError() could be one of the following:
1573 //
1574 //          ERROR_INVALID_PARAMETER
1575 //              pSDPStream or pfnCallback is NULL.
1576 //
1577 //          ERROR_INVALID_DATA
1578 //              The SDP stream is corrupt.
1579 //
1580 //          other Win32 errors.
1581 //
1582 
1583 function BluetoothSdpEnumAttributes(
1584     pSDPStream: PBYTE;
1585     cbStreamSize: ULONG;
1586     pfnCallback: PFN_BLUETOOTH_ENUM_ATTRIBUTES_CALLBACK;
1587     pvParam: Pointer): BOOL; stdcall;
1588 {$EXTERNALSYM BluetoothSdpEnumAttributes}
1589 
1590 // (rom) MACRO
BluetoothEnumAttributesnull1591 function BluetoothEnumAttributes(
1592     pSDPStream: PBYTE;
1593     cbStreamSize: ULONG;
1594     pfnCallback: PFN_BLUETOOTH_ENUM_ATTRIBUTES_CALLBACK;
1595     pvParam: Pointer): BOOL;
1596 {$EXTERNALSYM BluetoothEnumAttributes}
1597 
1598 {$ENDIF JWA_IMPLEMENTATIONSECTION}
1599 
1600 {$IFNDEF JWA_OMIT_SECTIONS}
1601 implementation
1602 //uses ...
1603 {$ENDIF JWA_OMIT_SECTIONS}
1604 
1605 {$IFNDEF JWA_INTERFACESECTION}
1606 
1607 {$IFNDEF JWA_INCLUDEMODE}
1608 const
1609   btapi = 'irprops.cpl';
1610 {$ENDIF JWA_INCLUDEMODE}
1611 
1612 // (rom) MACRO implementation
BluetoothEnumAttributesnull1613 function BluetoothEnumAttributes(pSDPStream: PBYTE; cbStreamSize: ULONG;
1614   pfnCallback: PFN_BLUETOOTH_ENUM_ATTRIBUTES_CALLBACK; pvParam: Pointer): BOOL;
1615 begin
1616   Result := BluetoothSdpEnumAttributes(pSDPStream, cbStreamSize, pfnCallback, pvParam);
1617 end;
1618 
1619 {$IFDEF DYNAMIC_LINK}
1620 
1621 var
1622   _BluetoothFindFirstRadio: Pointer;
1623 
BluetoothFindFirstRadionull1624 function BluetoothFindFirstRadio;
1625 begin
1626   GetProcedureAddress(_BluetoothFindFirstRadio, btapi, 'BluetoothFindFirstRadio');
1627   asm
1628         MOV     ESP, EBP
1629         POP     EBP
1630         JMP     [_BluetoothFindFirstRadio]
1631   end;
1632 end;
1633 
1634 var
1635   _BluetoothFindNextRadio: Pointer;
1636 
BluetoothFindNextRadionull1637 function BluetoothFindNextRadio;
1638 begin
1639   GetProcedureAddress(_BluetoothFindNextRadio, btapi, 'BluetoothFindNextRadio');
1640   asm
1641         MOV     ESP, EBP
1642         POP     EBP
1643         JMP     [_BluetoothFindNextRadio]
1644   end;
1645 end;
1646 
1647 var
1648   _BluetoothFindRadioClose: Pointer;
1649 
BluetoothFindRadioClosenull1650 function BluetoothFindRadioClose;
1651 begin
1652   GetProcedureAddress(_BluetoothFindRadioClose, btapi, 'BluetoothFindRadioClose');
1653   asm
1654         MOV     ESP, EBP
1655         POP     EBP
1656         JMP     [_BluetoothFindRadioClose]
1657   end;
1658 end;
1659 
1660 var
1661   _BluetoothGetRadioInfo: Pointer;
1662 
BluetoothGetRadioInfonull1663 function BluetoothGetRadioInfo;
1664 begin
1665   GetProcedureAddress(_BluetoothGetRadioInfo, btapi, 'BluetoothGetRadioInfo');
1666   asm
1667         MOV     ESP, EBP
1668         POP     EBP
1669         JMP     [_BluetoothGetRadioInfo]
1670   end;
1671 end;
1672 
1673 var
1674   _BluetoothFindFirstDevice: Pointer;
1675 
BluetoothFindFirstDevicenull1676 function BluetoothFindFirstDevice;
1677 begin
1678   GetProcedureAddress(_BluetoothFindFirstDevice, btapi, 'BluetoothFindFirstDevice');
1679   asm
1680         MOV     ESP, EBP
1681         POP     EBP
1682         JMP     [_BluetoothFindFirstDevice]
1683   end;
1684 end;
1685 
1686 var
1687   _BluetoothFindNextDevice: Pointer;
1688 
BluetoothFindNextDevicenull1689 function BluetoothFindNextDevice;
1690 begin
1691   GetProcedureAddress(_BluetoothFindNextDevice, btapi, 'BluetoothFindNextDevice');
1692   asm
1693         MOV     ESP, EBP
1694         POP     EBP
1695         JMP     [_BluetoothFindNextDevice]
1696   end;
1697 end;
1698 
1699 var
1700   _BluetoothFindDeviceClose: Pointer;
1701 
BluetoothFindDeviceClosenull1702 function BluetoothFindDeviceClose;
1703 begin
1704   GetProcedureAddress(_BluetoothFindDeviceClose, btapi, 'BluetoothFindDeviceClose');
1705   asm
1706         MOV     ESP, EBP
1707         POP     EBP
1708         JMP     [_BluetoothFindDeviceClose]
1709   end;
1710 end;
1711 
1712 var
1713   _BluetoothGetDeviceInfo: Pointer;
1714 
BluetoothGetDeviceInfonull1715 function BluetoothGetDeviceInfo;
1716 begin
1717   GetProcedureAddress(_BluetoothGetDeviceInfo, btapi, 'BluetoothGetDeviceInfo');
1718   asm
1719         MOV     ESP, EBP
1720         POP     EBP
1721         JMP     [_BluetoothGetDeviceInfo]
1722   end;
1723 end;
1724 
1725 var
1726   _BluetoothUpdateDeviceRecord: Pointer;
1727 
BluetoothUpdateDeviceRecordnull1728 function BluetoothUpdateDeviceRecord;
1729 begin
1730   GetProcedureAddress(_BluetoothUpdateDeviceRecord, btapi, 'BluetoothUpdateDeviceRecord');
1731   asm
1732         MOV     ESP, EBP
1733         POP     EBP
1734         JMP     [_BluetoothUpdateDeviceRecord]
1735   end;
1736 end;
1737 
1738 var
1739   _BluetoothRemoveDevice: Pointer;
1740 
BluetoothRemoveDevicenull1741 function BluetoothRemoveDevice;
1742 begin
1743   GetProcedureAddress(_BluetoothRemoveDevice, btapi, 'BluetoothRemoveDevice');
1744   asm
1745         MOV     ESP, EBP
1746         POP     EBP
1747         JMP     [_BluetoothRemoveDevice]
1748   end;
1749 end;
1750 
1751 var
1752   _BluetoothSelectDevices: Pointer;
1753 
BluetoothSelectDevicesnull1754 function BluetoothSelectDevices;
1755 begin
1756   GetProcedureAddress(_BluetoothSelectDevices, btapi, 'BluetoothSelectDevices');
1757   asm
1758         MOV     ESP, EBP
1759         POP     EBP
1760         JMP     [_BluetoothSelectDevices]
1761   end;
1762 end;
1763 
1764 var
1765   _BluetoothSelectDevicesFree: Pointer;
1766 
BluetoothSelectDevicesFreenull1767 function BluetoothSelectDevicesFree;
1768 begin
1769   GetProcedureAddress(_BluetoothSelectDevicesFree, btapi, 'BluetoothSelectDevicesFree');
1770   asm
1771         MOV     ESP, EBP
1772         POP     EBP
1773         JMP     [_BluetoothSelectDevicesFree]
1774   end;
1775 end;
1776 
1777 var
1778 {$IFDEF SUPPORT_LONG_VARNAMES}
1779   _BluetoothDisplayDeviceProperties: Pointer;
1780 {$ELSE}
1781   _BluetoothDisplayDProperties: Pointer;
1782 {$ENDIF}
1783 
1784 
BluetoothDisplayDevicePropertiesnull1785 function BluetoothDisplayDeviceProperties;
1786 begin
1787 {$IFDEF SUPPORT_LONG_VARNAMES}
1788   GetProcedureAddress(_BluetoothDisplayDeviceProperties, btapi, 'BluetoothDisplayDeviceProperties');
1789 {$ELSE}
1790   GetProcedureAddress(_BluetoothDisplayDProperties, btapi, 'BluetoothDisplayDeviceProperties');
1791 {$ENDIF}
1792 
1793 
1794   asm
1795         MOV     ESP, EBP
1796         POP     EBP
1797 {$IFDEF SUPPORT_LONG_VARNAMES}
1798         JMP     [_BluetoothDisplayDeviceProperties]
1799 {$ELSE}
1800        JMP     [_BluetoothDisplayDProperties]
1801 {$ENDIF}
1802 
1803   end;
1804 
1805 end;
1806 
1807 var
1808   _BluetoothAuthenticateDevice: Pointer;
1809 
BluetoothAuthenticateDevicenull1810 function BluetoothAuthenticateDevice;
1811 begin
1812   GetProcedureAddress(_BluetoothAuthenticateDevice, btapi, 'BluetoothAuthenticateDevice');
1813   asm
1814         MOV     ESP, EBP
1815         POP     EBP
1816         JMP     [_BluetoothAuthenticateDevice]
1817   end;
1818 end;
1819 
1820 var
1821 {$IFDEF SUPPORT_LONG_VARNAMES}
1822   _BluetoothAuthenticateMultipleDevices: Pointer;
1823 {$ELSE}
1824   _BluetoothAuthenticateMDevices: Pointer;
1825 {$ENDIF}
1826 
1827 
BluetoothAuthenticateMultipleDevicesnull1828 function BluetoothAuthenticateMultipleDevices;
1829 begin
1830 {$IFDEF SUPPORT_LONG_VARNAMES}
1831   GetProcedureAddress(_BluetoothAuthenticateMultipleDevices, btapi, 'BluetoothAuthenticateMultipleDevices');
1832 {$ELSE}
1833   GetProcedureAddress(_BluetoothAuthenticateMDevices, btapi, 'BluetoothAuthenticateMultipleDevices');
1834 {$ENDIF}
1835 
1836   asm
1837         MOV     ESP, EBP
1838         POP     EBP
1839 {$IFDEF SUPPORT_LONG_VARNAMES}
1840         JMP     [_BluetoothAuthenticateMultipleDevices]
1841 {$ELSE}
1842        JMP     [_BluetoothAuthenticateMDevices]
1843 {$ENDIF}
1844 
1845   end;
1846 end;
1847 
1848 var
1849   _BluetoothSetServiceState: Pointer;
1850 
BluetoothSetServiceStatenull1851 function BluetoothSetServiceState;
1852 begin
1853   GetProcedureAddress(_BluetoothSetServiceState, btapi, 'BluetoothSetServiceState');
1854   asm
1855         MOV     ESP, EBP
1856         POP     EBP
1857         JMP     [_BluetoothSetServiceState]
1858   end;
1859 end;
1860 
1861 var
1862 {$IFDEF SUPPORT_LONG_VARNAMES}
1863   _BluetoothEnumerateInstalledServices: Pointer;
1864 {$ELSE}
1865   _BluetoothEnumerateIS: Pointer;
1866 {$ENDIF}
1867 
1868 
BluetoothEnumerateInstalledServicesnull1869 function BluetoothEnumerateInstalledServices;
1870 begin
1871 {$IFDEF SUPPORT_LONG_VARNAMES}
1872   GetProcedureAddress(_BluetoothEnumerateInstalledServices, btapi, 'BluetoothEnumerateInstalledServices');
1873 {$ELSE}
1874   GetProcedureAddress(_BluetoothEnumerateIS, btapi, 'BluetoothEnumerateInstalledServices');
1875 {$ENDIF}
1876 
1877   asm
1878         MOV     ESP, EBP
1879         POP     EBP
1880 {$IFDEF SUPPORT_LONG_VARNAMES}
1881         JMP     [_BluetoothEnumerateInstalledServices]
1882 {$ELSE}
1883        JMP     [_BluetoothEnumerateIS]
1884 {$ENDIF}
1885 
1886   end;
1887 end;
1888 
1889 var
1890   _BluetoothEnableDiscovery: Pointer;
1891 
BluetoothEnableDiscoverynull1892 function BluetoothEnableDiscovery;
1893 begin
1894   GetProcedureAddress(_BluetoothEnableDiscovery, btapi, 'BluetoothEnableDiscovery');
1895   asm
1896         MOV     ESP, EBP
1897         POP     EBP
1898         JMP     [_BluetoothEnableDiscovery]
1899   end;
1900 end;
1901 
1902 var
1903   _BluetoothIsDiscoverable: Pointer;
1904 
BluetoothIsDiscoverablenull1905 function BluetoothIsDiscoverable;
1906 begin
1907   GetProcedureAddress(_BluetoothIsDiscoverable, btapi, 'BluetoothIsDiscoverable');
1908   asm
1909         MOV     ESP, EBP
1910         POP     EBP
1911         JMP     [_BluetoothIsDiscoverable]
1912   end;
1913 end;
1914 
1915 var
1916 {$IFDEF SUPPORT_LONG_VARNAMES}
1917   _BluetoothEnableIncomingConnections: Pointer;
1918 {$ELSE}
1919   _BluetoothEnableIC: Pointer;
1920 {$ENDIF}
1921 
BluetoothEnableIncomingConnectionsnull1922 function BluetoothEnableIncomingConnections;
1923 begin
1924 {$IFDEF SUPPORT_LONG_VARNAMES}
1925   GetProcedureAddress(_BluetoothEnableIncomingConnections, btapi, 'BluetoothEnableIncomingConnections');
1926 {$ELSE}
1927   GetProcedureAddress(_BluetoothEnableIC, btapi, 'BluetoothEnableIncomingConnections');
1928 {$ENDIF}
1929 
1930   asm
1931         MOV     ESP, EBP
1932         POP     EBP
1933 {$IFDEF SUPPORT_LONG_VARNAMES}
1934         JMP     [_BluetoothEnableIncomingConnections]
1935 {$ELSE}
1936        JMP     [_BluetoothEnableIC]
1937 {$ENDIF}
1938 
1939   end;
1940 end;
1941 
1942 var
1943   _BluetoothIsConnectable: Pointer;
1944 
BluetoothIsConnectablenull1945 function BluetoothIsConnectable;
1946 begin
1947   GetProcedureAddress(_BluetoothIsConnectable, btapi, 'BluetoothIsConnectable');
1948   asm
1949         MOV     ESP, EBP
1950         POP     EBP
1951         JMP     [_BluetoothIsConnectable]
1952   end;
1953 end;
1954 
1955 var
1956 {$IFDEF SUPPORT_LONG_VARNAMES}
1957   _BluetoothRegisterForAuthentication: Pointer;
1958 {$ELSE}
1959   _BluetoothRegisterFA: Pointer;
1960 {$ENDIF}
1961 
1962 
BluetoothRegisterForAuthenticationnull1963 function BluetoothRegisterForAuthentication;
1964 begin
1965 {$IFDEF SUPPORT_LONG_VARNAMES}
1966   GetProcedureAddress(_BluetoothRegisterForAuthentication, btapi, 'BluetoothRegisterForAuthentication');
1967 {$ELSE}
1968   GetProcedureAddress(_BluetoothRegisterFA, btapi, 'BluetoothRegisterForAuthentication');
1969 {$ENDIF}
1970 
1971   asm
1972         MOV     ESP, EBP
1973         POP     EBP
1974 
1975 {$IFDEF SUPPORT_LONG_VARNAMES}
1976         JMP     [_BluetoothRegisterForAuthentication]
1977 {$ELSE}
1978         JMP     [_BluetoothRegisterFA]
1979 {$ENDIF}
1980 
1981   end;
1982 end;
1983 
1984 var
1985 {$IFDEF SUPPORT_LONG_VARNAMES}
1986   _BluetoothUnregisterAuthentication: Pointer;
1987 {$ELSE}
1988   _BluetoothUA: Pointer;
1989 {$ENDIF}
1990 
BluetoothUnregisterAuthenticationnull1991 function BluetoothUnregisterAuthentication;
1992 begin
1993 {$IFDEF SUPPORT_LONG_VARNAMES}
1994   GetProcedureAddress(_BluetoothUnregisterAuthentication, btapi, 'BluetoothUnregisterAuthentication');
1995 {$ELSE}
1996   GetProcedureAddress(_BluetoothUA, btapi, 'BluetoothUnregisterAuthentication');
1997 {$ENDIF}
1998 
1999   asm
2000         MOV     ESP, EBP
2001         POP     EBP
2002 {$IFDEF SUPPORT_LONG_VARNAMES}
2003         JMP     [_BluetoothUnregisterAuthentication]
2004 {$ELSE}
2005         JMP     [_BluetoothUA]
2006 {$ENDIF}
2007 
2008   end;
2009 end;
2010 
2011 var
2012 {$IFDEF SUPPORT_LONG_VARNAMES}
2013   _BluetoothSendAuthenticationResponse: Pointer;
2014 {$ELSE}
2015   _BluetoothSendAR: Pointer;
2016 {$ENDIF}
2017 
2018 
BluetoothSendAuthenticationResponsenull2019 function BluetoothSendAuthenticationResponse;
2020 begin
2021 {$IFDEF SUPPORT_LONG_VARNAMES}
2022   GetProcedureAddress(_BluetoothSendAuthenticationResponse, btapi, 'BluetoothSendAuthenticationResponse');
2023 {$ELSE}
2024   GetProcedureAddress(_BluetoothSendAR, btapi, 'BluetoothSendAuthenticationResponse');
2025 {$ENDIF}
2026 
2027   asm
2028         MOV     ESP, EBP
2029         POP     EBP
2030 {$IFDEF SUPPORT_LONG_VARNAMES}
2031         JMP     [_BluetoothSendAuthenticationResponse]
2032 {$ELSE}
2033         JMP     [_BluetoothSendAR]
2034 {$ENDIF}
2035 
2036   end;
2037 end;
2038 
2039 var
2040   _BluetoothSdpGetElementData: Pointer;
2041 
BluetoothSdpGetElementDatanull2042 function BluetoothSdpGetElementData;
2043 begin
2044   GetProcedureAddress(_BluetoothSdpGetElementData, btapi, 'BluetoothSdpGetElementData');
2045   asm
2046         MOV     ESP, EBP
2047         POP     EBP
2048         JMP     [_BluetoothSdpGetElementData]
2049   end;
2050 end;
2051 
2052 var
2053 {$IFDEF SUPPORT_LONG_VARNAMES}
2054   _BluetoothSdpGetContainerElementData: Pointer;
2055 {$ELSE}
2056   _BluetoothSdpGetCED: Pointer;
2057 {$ENDIF}
2058 
BluetoothSdpGetContainerElementDatanull2059 function BluetoothSdpGetContainerElementData;
2060 begin
2061 {$IFDEF SUPPORT_LONG_VARNAMES}
2062   GetProcedureAddress(_BluetoothSdpGetContainerElementData, btapi, 'BluetoothSdpGetContainerElementData');
2063 {$ELSE}
2064   GetProcedureAddress(_BluetoothSdpGetCED, btapi, 'BluetoothSdpGetContainerElementData');
2065 {$ENDIF}
2066 
2067   asm
2068         MOV     ESP, EBP
2069         POP     EBP
2070 {$IFDEF SUPPORT_LONG_VARNAMES}
2071         JMP     [_BluetoothSdpGetContainerElementData]
2072 {$ELSE}
2073         JMP     [_BluetoothSdpGetCED]
2074 {$ENDIF}
2075 
2076   end;
2077 end;
2078 
2079 var
2080   _BluetoothSdpGetAttributeValue: Pointer;
2081 
BluetoothSdpGetAttributeValuenull2082 function BluetoothSdpGetAttributeValue;
2083 begin
2084   GetProcedureAddress(_BluetoothSdpGetAttributeValue, btapi, 'BluetoothSdpGetAttributeValue');
2085   asm
2086         MOV     ESP, EBP
2087         POP     EBP
2088         JMP     [_BluetoothSdpGetAttributeValue]
2089   end;
2090 end;
2091 
2092 var
2093   _BluetoothSdpGetString: Pointer;
2094 
BluetoothSdpGetStringnull2095 function BluetoothSdpGetString;
2096 begin
2097   GetProcedureAddress(_BluetoothSdpGetString, btapi, 'BluetoothSdpGetString');
2098   asm
2099         MOV     ESP, EBP
2100         POP     EBP
2101         JMP     [_BluetoothSdpGetString]
2102   end;
2103 end;
2104 
2105 var
2106   _BluetoothSdpEnumAttributes: Pointer;
2107 
BluetoothSdpEnumAttributesnull2108 function BluetoothSdpEnumAttributes;
2109 begin
2110   GetProcedureAddress(_BluetoothSdpEnumAttributes, btapi, 'BluetoothSdpEnumAttributes');
2111   asm
2112         MOV     ESP, EBP
2113         POP     EBP
2114         JMP     [_BluetoothSdpEnumAttributes]
2115   end;
2116 end;
2117 
2118 {$ELSE}
2119 
BluetoothFindFirstRadionull2120 function BluetoothFindFirstRadio; external btapi name 'BluetoothFindFirstRadio';
BluetoothFindNextRadionull2121 function BluetoothFindNextRadio; external btapi name 'BluetoothFindNextRadio';
BluetoothFindRadioClosenull2122 function BluetoothFindRadioClose; external btapi name 'BluetoothFindRadioClose';
BluetoothGetRadioInfonull2123 function BluetoothGetRadioInfo; external btapi name 'BluetoothGetRadioInfo';
BluetoothFindFirstDevicenull2124 function BluetoothFindFirstDevice; external btapi name 'BluetoothFindFirstDevice';
BluetoothFindNextDevicenull2125 function BluetoothFindNextDevice; external btapi name 'BluetoothFindNextDevice';
BluetoothFindDeviceClosenull2126 function BluetoothFindDeviceClose; external btapi name 'BluetoothFindDeviceClose';
BluetoothGetDeviceInfonull2127 function BluetoothGetDeviceInfo; external btapi name 'BluetoothGetDeviceInfo';
BluetoothUpdateDeviceRecordnull2128 function BluetoothUpdateDeviceRecord; external btapi name 'BluetoothUpdateDeviceRecord';
BluetoothRemoveDevicenull2129 function BluetoothRemoveDevice; external btapi name 'BluetoothRemoveDevice';
BluetoothSelectDevicesnull2130 function BluetoothSelectDevices; external btapi name 'BluetoothSelectDevices';
BluetoothSelectDevicesFreenull2131 function BluetoothSelectDevicesFree; external btapi name 'BluetoothSelectDevicesFree';
BluetoothDisplayDevicePropertiesnull2132 function BluetoothDisplayDeviceProperties; external btapi name 'BluetoothDisplayDeviceProperties';
BluetoothAuthenticateDevicenull2133 function BluetoothAuthenticateDevice; external btapi name 'BluetoothAuthenticateDevice';
BluetoothAuthenticateMultipleDevicesnull2134 function BluetoothAuthenticateMultipleDevices; external btapi name 'BluetoothAuthenticateMultipleDevices';
BluetoothSetServiceStatenull2135 function BluetoothSetServiceState; external btapi name 'BluetoothSetServiceState';
BluetoothEnumerateInstalledServicesnull2136 function BluetoothEnumerateInstalledServices; external btapi name 'BluetoothEnumerateInstalledServices';
BluetoothEnableDiscoverynull2137 function BluetoothEnableDiscovery; external btapi name 'BluetoothEnableDiscovery';
BluetoothIsDiscoverablenull2138 function BluetoothIsDiscoverable; external btapi name 'BluetoothIsDiscoverable';
BluetoothEnableIncomingConnectionsnull2139 function BluetoothEnableIncomingConnections; external btapi name 'BluetoothEnableIncomingConnections';
BluetoothIsConnectablenull2140 function BluetoothIsConnectable; external btapi name 'BluetoothIsConnectable';
BluetoothRegisterForAuthenticationnull2141 function BluetoothRegisterForAuthentication; external btapi name 'BluetoothRegisterForAuthentication';
BluetoothUnregisterAuthenticationnull2142 function BluetoothUnregisterAuthentication; external btapi name 'BluetoothUnregisterAuthentication';
BluetoothSendAuthenticationResponsenull2143 function BluetoothSendAuthenticationResponse; external btapi name 'BluetoothSendAuthenticationResponse';
BluetoothSdpGetElementDatanull2144 function BluetoothSdpGetElementData; external btapi name 'BluetoothSdpGetElementData';
BluetoothSdpGetContainerElementDatanull2145 function BluetoothSdpGetContainerElementData; external btapi name 'BluetoothSdpGetContainerElementData';
BluetoothSdpGetAttributeValuenull2146 function BluetoothSdpGetAttributeValue; external btapi name 'BluetoothSdpGetAttributeValue';
BluetoothSdpGetStringnull2147 function BluetoothSdpGetString; external btapi name 'BluetoothSdpGetString';
BluetoothSdpEnumAttributesnull2148 function BluetoothSdpEnumAttributes; external btapi name 'BluetoothSdpEnumAttributes';
2149 
2150 {$ENDIF DYNAMIC_LINK}
2151 
2152 {$ENDIF JWA_INTERFACESECTION}
2153 
2154 {$IFNDEF JWA_OMIT_SECTIONS}
2155 end.
2156 {$ENDIF JWA_OMIT_SECTIONS}
2157