btDevicePair (Function) |
Top Previous Next |
This function makes the adapter start pairing with a remote device.
Depending on the status of the remote device, it may trigger a _BT_EVENT_PAIR_REQ event, which must be handled before the pairing is successful. To be able to handle the event, btWaitEvent must either be called from a different thread than btDevicePair or the auto_accept parameter must be set to TRUE, which will automatically send the confirmation for the device without triggering the event.
If the device does not need confirmation, btDevicePair can be called from the same thread as btWaitEvent without problems.
The PIN code is used for legacy devices that typically requires a fixed 4-digit PIN code such as "0000" or "1234", which is described in the documentation for it.
Input: dev : STRING The address of the device to pair with.
auto_accept : BOOL (default FALSE) Set to true to automatically accept the device instead of triggering the _BT_EVENT_PAIR_REQ event. The passkey will not be made available in btHandlePairRequest and can therefore not be compared with the passkey on the remote device, which must instead just assume that it matches.
PIN : STRING The PIN code to use for legacy pairing.
Returns: INT
Declaration: FUNCTION btDevicePair : INT;
Example: INCLUDE rtcu.inc |