BthGetLinkKey

This function retrieves 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_GET_LINK as the optname value in getsockopt.

int BthGetLinkKey(
  BT_ADDR* pba,
  unsigned char key[16]
);

Parameters

  • pba
    [in] Pointer to the Bluetooth address.
  • key
    [in] Retrieves 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

Typically, the Bluetooth stack manages link keys automatically, such as storing them when they are created. This function is mainly useful for backup purposes.

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 Platform Development Functions | Bluetooth

Last updated on Wednesday, April 13, 2005

© 2005 Microsoft Corporation. All rights reserved.