BthSetEncryption

Other versions of this page are also available for the following:

Windows Mobile Not SupportedWindows Embedded CE Supported

8/28/2008

This function requests that the encryption mode on an existing connection is switched with the peer device.

Note

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

Syntax

int BthSetEncryption(
  BT_ADDR* pba,
  int fOn
);

Parameters

  • pba
    [in] Pointer to the Bluetooth address.
  • fOn
    [in] Request to switch the encryption mode on an existing connection with the peer device specified by its Bluetooth address.

Return Value

This function returns ERROR_SUCCESS when it completes successfully.

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

A return value of ERROR_NOT_FOUND indicates that an active ACL connection to the peer that is specified by the Bluetooth address does not exist.

Other standard error codes may be returned as appropriate.

Remarks

To manage security settings for the connections that the device makes, use the Bluetooth Winsock API. For more information, see Winsock Extensions.

Requirements

Header bt_api.h
Library Btdrt.lib
Windows Embedded CE Windows CE .NET 4.2 and later

See Also

Reference

Bluetooth OS Functions

Concepts

Winsock Extensions

Other Resources

Bluetooth Application Development