Skip to main content
Mich1
Associate III
Oct 1, 2019 4:03 PM UTC
Solved

BlueNRG : how to set the device name in the advertising

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;
 }

This topic has been closed for replies.
KnarfB
KnarfBBest answer
Super User
Oct 4, 2019 6:34 PM UTC

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)

5 replies

KnarfB
Super User
Oct 1, 2019 4:15 PM UTC

Hi Mich,

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

Mich1
Mich1Author
Associate III
Oct 2, 2019 6:46 AM UTC

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
Oct 4, 2019 6:34 PM UTC

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 4:26 PM UTC

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
Nov 5, 2023 12:12 PM UTC

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