This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts
This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Add Device Name to “ble_app_beacon” example

Hello, I try to add the Device Name to the ble_app_beacon example but it does not work.

First, define the Name:

 #define DEVICE_NAME  "MyBeacon"

Next, add GAP Pararameters:

static void gap_params_init(void)
{
   uint32_t err_code;
   ble_gap_conn_sec_mode_t     sec_mode;
   BLE_GAP_CONN_SEC_MODE_SET_OPEN(&sec_mode);
   err_code = sd_ble_gap_device_name_set(&sec_mode, (const uint8_t *)DEVICE_NAME,
   strlen(DEVICE_NAME));
   APP_ERROR_CHECK(err_code);
}

Change

 advdata.name_type  = BLE_ADVDATA_NO_NAME

to

advdata.name_type  = BLE_ADVDATA_FULL_NAME

and insert gap_params_init in the main function:

int main(void)
{
// Initialize.
leds_init();
ble_stack_init();
gap_params_init();	
advertising_init();

// Start execution.
advertising_start();

// Enter main loop.
for (;;)
  {
     power_manage();
  }
}

But nothing happens! Is there something more to do?

Thank you and best Regards

Related