bt_gatt_server_passkey_set()

bt_gatt_server_passkey_set()

Description

Sets a passkey for the GATT server and elevates the upcoming connection security to level 4.

Syntax

bt_gatt_server_passkey_set(passkey);

Parameters

Variable

Input

Variable

Input

passkey

A 6 digit passkey for pairing with the desired connection. Valid range 0-999999.

Returns

Return value

Return explanation

SCRIPT_OPERATION_SUCCESS

Successfully set passkey for connection.

SCRIPT_PARAM_INVALID

Invalid passkey range.

SCRIPT_OPERATION_FAILED

Failed to set passkey.

SCRIPT_NO_ACCESS

Bluetooth GATT server is not initialized.

Function call example

#include <io> #include <read> #include <float> #include <string> #include <core> #include <write> #include <define> #include <socket> #include <bluetooth> #define PAIR_PASSKEY 123456 main() { bt_init(); bt_gatt_server_init(); bt_gatt_server_passkey_set(PAIR_PASSKEY); for(;;) { Delay(100); } }