jwabluetoothapis.pas 68 KB

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