BthSetLinkKey (Windows CE 5.0)
This function stores the link key for the Bluetooth device.
Note To preserve Win32 compatibility, consider using the Winsock equivalent of this function. To do so, pass SO_BTH_SET_LINK as the optname value in setsockopt.
int BthSetLinkKey ( BT_ADDR* pba, unsigned char key[16]);
Parameters
- pba
[in] A pointer to the Bluetooth address. - key
[in] Stores the link key for the Bluetooth device identified in pba. The active connection to the device is not necessary, nor is the presence of the Bluetooth controller.
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
The link key is persisted in registry until BthRevokeLinkKey is called.
Typically, the Bluetooth stack manages link keys automatically, for example, it stores them when they are created. This function is useful primarily for backup purposes.
While link key is stored, it will be automatically supplied once the link key request is issued by the authentication mechanism. If the link key is incorrect, the renegotiation that involves the PIN is initiated by the Bluetooth adapter, and the PIN code may be requested from the user.
The link key length is 16 bytes. You cannot create link keys; they are generated by the Bluetooth hardware.
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 | BthRevokeLinkKey
Send Feedback on this topic to the authors