다음을 통해 공유


BthSetPIN (Windows CE 5.0)

Send Feedback

This function stores the personal identification number (PIN) for the Bluetooth device.

Note   To preserve Win32 compatibility, consider using the Winsock equivalent of this function. To do so, pass SO_BTH_SET_PIN as the optname value in setsockopt.

int BthSetPIN(  BT_ADDR* pba,  int cPinLength,  unsigned char* ppin);

Parameters

  • pba
    [in] Pointer to the Bluetooth address.
  • cPinLength
    [in] PIN length must be between 1 and 16 bytes.
  • ppin
    [in] Pointer to the PIN. The PIN is an ASCII string that is not terminated by \0. Although it can be any binary data, it is typically limited to digits that can be dialed on the phone (0-9) or typed on a computer keyboard (alphanumeric characters).

Return Values

This function returns ERROR_SUCCESS when it completes successfully.

A return value of ERROR_SERVICE_NOT_ACTIVE indicates that the Bluetooth stack is not present.

Other standard error codes may be returned as appropriate.

Remarks

Stores the pin for the Bluetooth device identified in pba. The active connection to the device is not necessary, nor is the presence of the Bluetooth controller. The PIN is persisted in the registry until BthRevokePIN is called.

While the PIN is stored, it is supplied automatically after the PIN request is issued by the authentication mechanism, so the user will not be prompted for it. Typically, for UI-based devices, you would set the PIN for the duration of authentication, and then revoke it after authentication is complete.

Requirements

OS Versions: Windows CE.NET 4.2 and later.
Header: Bt_api.h.
Link Library: Btdrt.lib.

See Also

Bluetooth OS Functions | Bluetooth Application Development | BthRevokePIN

Send Feedback on this topic to the authors

Feedback FAQs

© 2006 Microsoft Corporation. All rights reserved.