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

Unique BLE device name

Hi,

I am currently writing the firmware of one of our products that will be produced in mass market, and now my goal is to have a unique BLE device name for every sample. I try to use the DEVICEADDR register to generate a 16 bit number that will be concatenated to a string that will be the base of the device name. But for know, the code doesn't compile and I'm not even sure that I'm doing this the right way.

Here is my code I wrote in gap_params_int() function :

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));*/

ble_gap_addr_t *p_addr;

sd_ble_gap_address_get(p_addr);

uint8_t* device_addr = (p_addr->addr + BLE_GAP_ADDR_LEN - 2);

const uint8_t* device_name = {*DEVICE_NAME, *device_addr};

err_code = sd_ble_gap_device_name_set(&sec_mode,
                                      device_name,
                                      strlen(device_name));
APP_ERROR_CHECK(err_code);

Here are the following errors :

'p_addr' is used uninitialized in this function [-Werror=uninitialized]

(near initialization for 'device_name') [-Werror]

excess elements in scalar initializer [-Werror]

initialization makes pointer from integer without a cast [-Werror]

pointer targets in passing argument 1 of 'strlen' differ in signedness [-Werror=pointer-sign]

Could you please tell me what am I doing wrong, or how to do what I am trying to do ?

PS : My target is an nRF51822 QFAC, I use SDK v11.0 and softdevice S130

Best regards,

Guillaume

Parents Reply Children
No Data
Related