BluetoothRegisterForAuthenticationEx 函数 (bluetoothapis.h)

BluetoothRegisterForAuthenticationEx 函数为 Pin 请求、数字比较和回调函数注册应用程序。

注意 Windows Vista SP2 和 Windows 7 支持此 API。
 

语法

DWORD BluetoothRegisterForAuthenticationEx(
  [in, optional] const BLUETOOTH_DEVICE_INFO            *pbtdiIn,
  [out]          HBLUETOOTH_AUTHENTICATION_REGISTRATION *phRegHandleOut,
  [in, optional] PFN_AUTHENTICATION_CALLBACK_EX         pfnCallbackIn,
  [in, optional] PVOID                                  pvParam
);

参数

[in, optional] pbtdiIn

指向 BLUETOOTH_DEVICE_INFO 结构的指针,该结构指定要用于比较的蓝牙地址。

[out] phRegHandleOut

指向与已注册的应用程序关联的 HBLUETOOTH_AUTHENTICATION_REGISTRATION 句柄的指针。 调用 BluetoothUnregisterAuthentication 以关闭句柄。

[in, optional] pfnCallbackIn

身份验证事件发生时将调用的函数。 此函数应与 PFN_AUTHENTICATION_CALLBACK_EX 的原型匹配。

[in, optional] pvParam

要传递到 pfnCallbackIn 指定的回调函数的可选参数。 此参数可以是应用程序需要定义的任何内容。

返回值

成功完成后返回ERROR_SUCCESS;失败时返回以下错误代码:

返回代码 说明
ERROR_OUTOFMEMORY
内存不足。
Win32 错误
提供的注册句柄无效。

注解

调用方必须提供有效的回调地址,并且必须在不再需要通知后注销回调。 通过调用 BluetoothUnregisterAuthentication,可以取消注册经过身份验证的设备。

如果应用程序多次注册身份验证,则在身份验证正在进行时,只会在应用程序中调用通过此函数注册的第一个回调函数。

要求

要求
最低受支持的客户端 Windows Vista、Windows XP 和 SP2 [仅限桌面应用]
最低受支持的服务器 无受支持的版本
目标平台 Windows
标头 bluetoothapis.h (包括 Bthsdpdef.h、BluetoothAPIs.h)
Library Bthprops.lib
DLL bthprops.cpl

另请参阅

BluetoothRegisterForAuthentication

BluetoothUnregisterAuthentication