BluetoothRegisterForAuthenticationEx function

The BluetoothRegisterForAuthenticationEx function registers an application for a pin request, numeric comparison and callback function.

Note  This API is supported in Windows Vista SP2 and Windows 7.
 

Syntax

DWORD BluetoothRegisterForAuthenticationEx(
  const BLUETOOTH_DEVICE_INFO            *pbtdiIn,
  HBLUETOOTH_AUTHENTICATION_REGISTRATION *phRegHandleOut,
  PFN_AUTHENTICATION_CALLBACK_EX         pfnCallbackIn,
  PVOID                                  pvParam
);

Parameters

pbtdiIn

A pointer to a BLUETOOTH_DEVICE_INFO structure that specifies the bluetooth address to be utilized for comparison.

phRegHandleOut

A pointer to a HBLUETOOTH_AUTHENTICATION_REGISTRATION handle associated with the registered application. Call BluetoothUnregisterAuthentication to close the handle.

pfnCallbackIn

The function that will be called when the authentication event occurs. This function should match the prototype of PFN_AUTHENTICATION_CALLBACK_EX.

pvParam

Optional parameter to be passed through to the callback function specified by pfnCallbackIn. This parameter can be anything the application is required to define.

Return Value

Returns ERROR_SUCCESS upon successful completion; returns the following error codes upon failure:

Return code Description
ERROR_OUTOFMEMORY
Out of memory.
Win32 Error
The registration handle that was provided is invalid.

Remarks

The caller must provide a valid callback address and must unregister the callback once notification is no longer required. The deregistration of an authenticated device can be accomplished by calling BluetoothUnregisterAuthentication.

In scenarios where an application registers for authentication more than once, only the first callback function registered via this function will be called in the application while authentication is in progress.

Requirements

   
Minimum supported client Windows Vista, Windows XP with SP2 [desktop apps only]
Minimum supported server None supported
Target Platform Windows
Header bluetoothapis.h (include Bthsdpdef.h, BluetoothAPIs.h)
Library Bthprops.lib
DLL Bthprops.dll

See Also

BluetoothRegisterForAuthentication

BluetoothUnregisterAuthentication