Announcements
IMPORTANT: Cypress Developer Community is transitioning on October 20th. To learn more and be prepared for this change, check out our latest announcement.
cancel
Showing results for 
Search instead for 
Did you mean: 

WICED Studio Bluetooth

MiCh_2098196
New Contributor II

Hello Cypress,

I am designing a device for my client who wants the device name of each device to be 'unique enough' so that if there are a few of the same device within pairing range, they will appear unique relative to the others. I would like to have each device randomly generate and append two hex values (1 byte) to the end of their advertised device name, like so:

Product_name_XX

Ideally I would like to generate a random device address using the Make Target command "BT_DEVICE_ADDRESS=random", and then use the last byte of that generated address and append it to the device name that gets advertised, but I can not figure out how to do it. The most similar question I found to mine is here, but I could not understand what is going on here either: CYBT-423028-02 (CYW20719) device name and address . Could someone please walk me through achieving this device name formatting?

Thanks!

0 Likes
1 Solution
SheetalJ
Moderator
Moderator

Hi MiCh_2098196​,

I will consider you are working with CYW20719 device.

So you can generate a random number using functions available in /20719-B1_Bluetooth/include/20719/hal/wiced_hal_rand.h. The advertisement data is set using a function, for ex. hello_sensor_set_advertisement_data() in your project .c file. Here you can pass the desired device name and the required number instead of only device name.

View solution in original post

1 Reply
SheetalJ
Moderator
Moderator

Hi MiCh_2098196​,

I will consider you are working with CYW20719 device.

So you can generate a random number using functions available in /20719-B1_Bluetooth/include/20719/hal/wiced_hal_rand.h. The advertisement data is set using a function, for ex. hello_sensor_set_advertisement_data() in your project .c file. Here you can pass the desired device name and the required number instead of only device name.

View solution in original post