| C# | Visual Basic |
public static bool SetPin( BluetoothAddress device, string pin )
Public Shared Function SetPin ( _ device As BluetoothAddress, _ pin As String _ ) As Boolean
- device (BluetoothAddress)
- Address of remote device.
- pin (String)
- Pin, alphanumeric string of between 1 and 16 ASCII characters.
On Windows CE platforms this calls BthSetPIN, its MSDN remarks say:
“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.”
See also RevokePin(BluetoothAddress)