bt_adv_name_set()

bt_adv_name_set()

Description

This function sets a name in the Bluetooth scan response data packet. The bt_adv_config() function with the BT_ADV_OPT_SCANNABLE advertisement option needs to be called in order to advertise scan response data.

Syntax

bt_adv_name_set(name_array[], name_len);

Parameters

Variable

Input

Variable

Input

name_array[]

Array which consists of your desired name.

name_len

Length of your name.

Returns

Return value

Return explanation

SCRIPT_OPERATION_SUCCESS

Successfully added advertisement name.

SCRIPT_OPERATION_FAILED

Failed to add advertisement name.

SCRIPT_ERROR_BOUNDARY

Given name length is bigger than name array.

SCRIPT_NO_ACCESS

This error signifies that Bluetooth communication was not initialized.

Function call example

#include <io> #include <read> #include <float> #include <string> #include <core> #include <write> #include <define> #include <socket> #include <bluetooth> new demo_adv_name[17] = ''My_XG_Beacon''; main() { bt_init(); bt_adv_config(BT_ADV_OPT_SCANNABLE, BT_GAP_ADV_INT_FAST_MIN_2, BT_GAP_ADV_INT_FAST_MAX_2); bt_adv_name_set(demo_adv_name, strlen(demo_adv_name)); for(;;) { Delay(100); } }