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

Parents
  • Nothing changes or nothing happends?

    If you mean that it doesn't advertise, I would guess it is simply because your advertisement packet is to big. You can use the debugger to find out, put a breakpoint in the app_error_handler() and find out what there error is a where it comes from.

    There is a reason the ble_app_beacon doesn't have a name, it is unnecessary. To maximize the information included in the packet, major and minor values are used. You could try to remove something from the packet, for example the Manufacturer specific data, see if anything happends then.

Reply
  • Nothing changes or nothing happends?

    If you mean that it doesn't advertise, I would guess it is simply because your advertisement packet is to big. You can use the debugger to find out, put a breakpoint in the app_error_handler() and find out what there error is a where it comes from.

    There is a reason the ble_app_beacon doesn't have a name, it is unnecessary. To maximize the information included in the packet, major and minor values are used. You could try to remove something from the packet, for example the Manufacturer specific data, see if anything happends then.

Children
No Data
Related