This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

How to add more services with 128b UUID - ble_advdata_set() returns error 12 (exceed data limit)

Hi, I'm trying to add more user services to LBS demo. I generated 128b UUIDs for my services. Then I should add them to list returned by scan response in function advertising_init() - there are 2 structs: ble_advdata_t advdata, scanrsp; the secon one is filled by ble_uuid_t adv_uuids[]={ {LBS_UUID_SERVICE, BLE_UUID_TYPE_VENDOR_BEGIN}, {MY_UUID_SERVICE, BLE_UUID_TYPE_VENDOR_BEGIN} }; then the struct array is passed to err_code=ble_advdata_set(&advdata, &scanrsp); APP_ERROR_CHECK(err_code); and I got assert with error 12 - NRF_ERROR_DATA_SIZE What is maximum size of scanrsp? What should I do if my service doesn't fit in? Is it important to return scanrsp at all? In other examples (heartrate demo) I can see that 16b short UUIDs are used that fits but I have to use 128b UUIDs.

The second question is about how to dynamically change some manufacturer specific data in advertise packet that I want to transmitt to all clients that will only listen. I found that it is possible to add some data to ble_advdata_t advdata; sctructure into field advdata.p_manuf_specific_data=&adv_spec_data_s; - There's no much space but I need only few bytes. I filled ble_advdata_manuf_data_t adv_spec_data_s; and point an array with 2 bytes. It seems to work but I cannot see this data by any existing smartphone BLE app. I can use BLE sniffer to see that my user bytes are near the end of adv. packet. This will probably need some custom programming on smartphone to extract this data. I need to know to update this data by some call from main loop. Should I use ble_advdata_set() again or is there some specific function to do this? And the data array is passed as a pointer - are they buffered in the BLE stack or I must keep them as global or static variable?

Related