Skip to main content
Mich1
Associate III
October 1, 2019
Solved

BlueNRG : how to set the device name in the advertising

  • October 1, 2019
  • 4 replies
  • 3305 views

I tried the Cube BLE exemple to tried to set the device name for the advertising message but I can only see the advertising address. How could I do to set the name?

 /* Update device name */
 ret = aci_gatt_update_char_value(service_handle, dev_name_char_handle, 0, sizeof(device_name), device_name);
 if(ret != BLE_STATUS_SUCCESS) {
 PRINTF("aci_gatt_update_char_value() failed: 0x%02x\r\n", ret);
 return ret;
 }

Best answer by KnarfB

It works for me. I set the name in aci_gap_set_discoverable(...) and change it later on by aci_gatt_update_char_value(...)

A BLE scanner app shows the first name. But, when connected, the Generic access service shows the second name as Device Name.

(CubeMX 5.3.0 + X-CUBE-BLE1 4.4.0 generated code skeleton)

4 replies

KnarfB
Super User
October 1, 2019

Hi Mich,

use strlen(device_name) for the length of the name string.

Mich1
Mich1Author
Associate III
October 2, 2019

Thanks a lot for the correction of this cube issue.

The problem is still here: no name in the advertising.

KnarfB
KnarfBBest answer
Super User
October 4, 2019

It works for me. I set the name in aci_gap_set_discoverable(...) and change it later on by aci_gatt_update_char_value(...)

A BLE scanner app shows the first name. But, when connected, the Generic access service shows the second name as Device Name.

(CubeMX 5.3.0 + X-CUBE-BLE1 4.4.0 generated code skeleton)

Visitor II
May 1, 2025

Can you provide code for this:

'I set the name in aci_gap_set_discoverable(...) and change it later on by aci_gatt_update_char_value(...)'

 

PSzab.1
Associate II
November 5, 2023

What does 0x42 return value mean?

I got this when I wanted to change the name:

aci_gatt_update_char_value_ext() failed: 0x42
RC_DeviceInit() failed: 0x42