BthSetLinkKey (Compact 2013)
3/26/2014
This function stores the link key for the remote device.
Syntax
int BthSetLinkKey (
BT_ADDR *pba,
unsigned char key[16]
);
Parameters
- pba
[in] A pointer to the address of the device.
- key
[in] Stores the link key for the Bluetooth device identified in pba. An active connection to the device is not necessary, nor is the presence of the Bluetooth controller necessary.
Return Value
The following table shows the possible return values.
Value |
Description |
---|---|
ERROR_SUCCESS |
Success. |
ERROR_SERVICE_NOT_ACTIVE |
The Bluetooth stack is not present. |
Other standard HRESULT error codes may be returned as appropriate.
Remarks
The link key is preserved in the registry until BthRevokeLinkKey is called.
The Bluetooth stack automatically manages link keys. For example, it stores them when they are created. This function is useful primarily for backup purposes.
While a link key is stored, it is automatically supplied when the authentication mechanism issues the link key request. If the link key is incorrect, the controller initiates a renegotiation that involves the PIN. In this case, the PIN code may be requested from the user.
Link keys are 16 bytes long and can only be generated by the controller.
Note
To preserve Microsoft Win32 compatibility, consider using the Winsock equivalent of this function. To do so, set the optname parameter in the setsockopt function to SO_BTH_SET_LINK.
Requirements
Header |
bt_api.h |
Library |
Btdrt.lib |
See Also
Reference
Bluetooth API Security Management Functions
Bluetooth AG Service Functions
BthRevokeLinkKey