cancel
Showing results for 
Search instead for 
Did you mean: 

WICED Studio Bluetooth

PeEr_3832806
New Contributor

Hello,

we want to include part of the bluetooth mac address in the device's local name.

Currently the local device name is passed to the stack in the wiced_bt_stack_init() function.  At that point, wiced_bt_dev_read_local_addr() does not yet return the mac address correctly, making the name update in that phase impossible?

Some versions of the Wiced API has had a function called wiced_bt_dev_set_local_name().  Is there an equivalent for 20719?  Or any other ideas how to accomplish the 'mac as a device local name' goal?

Br, Pekka

0 Likes
1 Solution
AnjanaM_61
Moderator
Moderator

Hi Pekka,

Currently we do no have an API for setting local name.

However you can update the wiced_bt_cfg_settings_t structure parameter device_name in the main.c file after Bt stack init.

Eg:

in bt config file,

wiced_bt_cfg_settings_t db_cfg_settings =

{

    .device_name                         = (uint8_t *)WICED_DEVICE_NAME,                             // Local device name (NULL terminated)

    .device_class                        = { 0x00, 0x00, 0x00 },                                     // Local device class

    .security_requirement_mask

:

in main.c file, after the BT stack init , change the device name structure parameter

db_cfg_settings.device_name

Could you please try that?

Thanks,
Anjana

View solution in original post

3 Replies
AnjanaM_61
Moderator
Moderator

Hi Pekka,

Currently we do no have an API for setting local name.

However you can update the wiced_bt_cfg_settings_t structure parameter device_name in the main.c file after Bt stack init.

Eg:

in bt config file,

wiced_bt_cfg_settings_t db_cfg_settings =

{

    .device_name                         = (uint8_t *)WICED_DEVICE_NAME,                             // Local device name (NULL terminated)

    .device_class                        = { 0x00, 0x00, 0x00 },                                     // Local device class

    .security_requirement_mask

:

in main.c file, after the BT stack init , change the device name structure parameter

db_cfg_settings.device_name

Could you please try that?

Thanks,
Anjana

View solution in original post

PeEr_3832806
New Contributor

Hi,

the device name update to wiced_bt_cfg_settings_t .device_name shows up ok in the scanning phase (eir data is correct).  But somehow the initial .device_name (set pre wiced_bt_stack_init()) shows up in the paired device list.  Does the stack create a copy of the .device_name string when wiced_bt_stack_init() is called?

UPDATE: Android seems to update the bonded device name with the one in the eir data when the scanning is done once again after pairing.  The updated .device_name shows correctly on the paired device list.

Br, Pekka

0 Likes
AnjanaM_61
Moderator
Moderator

Hi Pekka,

I didn't understand your query correctly.

You mean for the first time, the device name was showing as the one which set in wiced bt config .c file?

If then, please try update the device name db_cfg_settings.device_name before the very first call of start advertisement API

Thanks,

Anjana

0 Likes