Partager via


Fonction BluetoothRegisterForAuthentication (bluetoothapis.h)

La fonction BluetoothRegisterForAuthentication inscrit une fonction de rappel appelée lorsqu’un appareil Bluetooth particulier demande l’authentification.

Note Lors du développement pour Windows Vista SP2 et Windows 7, l’utilisation de BluetoothRegisterForAuthenticationEx est recommandée.
 

Syntaxe

DWORD BluetoothRegisterForAuthentication(
  const BLUETOOTH_DEVICE_INFO            *pbtdi,
  HBLUETOOTH_AUTHENTICATION_REGISTRATION *phRegHandle,
  PFN_AUTHENTICATION_CALLBACK            pfnCallback,
  PVOID                                  pvParam
);

Paramètres

pbtdi

Pointeur vers une structure BLUETOOTH_DEVICE_INFO . Le membre Address est utilisé pour la comparaison.

phRegHandle

Pointeur vers une structure dans laquelle le HANDLE d’inscription est stocké. Appelez bluetoothUnregisterAuthentication pour fermer le handle.

pfnCallback

Fonction à appeler lorsque l’événement d’authentification se produit. La fonction doit correspondre au prototype décrit dans PFN_AUTHENTICATION_CALLBACK.

pvParam

Paramètre facultatif à passer via la fonction de rappel.

Valeur retournée

Retourne ERROR_SUCCESS en cas de réussite et un handle d’inscription valide a été retourné dans phRegHandle. Toute autre valeur de retour indique un échec.

Appelez la fonction GetLastError pour obtenir plus d’informations sur l’erreur. Le tableau suivant décrit une erreur courante :

Code de retour Description
ERROR_OUTOFMEMORY
Mémoire insuffisante.

Configuration requise

Condition requise Valeur
Client minimal pris en charge Windows Vista, Windows XP avec SP2 [applications de bureau uniquement]
Serveur minimal pris en charge Aucun pris en charge
Plateforme cible Windows
En-tête bluetoothapis.h (inclure Bthsdpdef.h, BluetoothAPIs.h)
Bibliothèque Bthprops.lib
DLL bthprops.cpl

Voir aussi

BLUETOOTH_DEVICE_INFO

BluetoothAuthenticateDevice

BluetoothAuthenticateMultipleDevices

BluetoothEnableDiscovery

BluetoothEnableIncomingConnections

BluetoothIsConnectable

BluetoothIsDiscoverable

BluetoothRegisterForAuthentication

BluetoothSendAuthenticationResponse

BluetoothUnregisterAuthentication