Hello,
at the moment I try to add some more services to my BLE device. This goes wrong with err_code = 12 (NRF_ERROR_DATA_SIZE). With some search in the devZone I found out, that it is not possible to advertise more than two uuids because of the size limitation. Also I found out, that if I want to have more than two Services, I have to use uuids_more_available. But I did
t found a simple code example of how to do that. I tried it like this:
static void advertising_init(void){
uint32_t err_code;
ble_advdata_t advdata;
ble_advdata_t scanrsp;
ble_uuid_t adv_uuids[] = {{BLE_UUID_DEVICE_SERVICE, GRL_DEV_SERVICE_UUID_TYPE},{BLE_UUID_SERVICE_COMMAND, GRL_COM_SERVICE_UUID_TYPE}};
// Build and set advertising data.
memset(&advdata, 0, sizeof(advdata));
advdata.name_type = BLE_ADVDATA_FULL_NAME;
advdata.include_appearance = true;
advdata.flags = BLE_GAP_ADV_FLAGS_LE_ONLY_LIMITED_DISC_MODE;
memset(&scanrsp, 0, sizeof(scanrsp));
//scanrsp.uuids_complete.uuid_cnt = sizeof(adv_uuids) / sizeof(adv_uuids[0]);
//scanrsp.uuids_complete.p_uuids = adv_uuids;
scanrsp.uuids_more_available.uuid_cnt = 3; // new
scanrsp.uuids_more_available.p_uuids = adv_uuids;
ble_adv_modes_config_t options = {0};
options.ble_adv_fast_enabled = BLE_ADV_FAST_ENABLED;
options.ble_adv_fast_interval = APP_ADV_INTERVAL;
options.ble_adv_fast_timeout = APP_ADV_TIMEOUT_IN_SECONDS;
err_code = ble_advertising_init(&advdata, &scanrsp, &options, on_adv_evt, NULL);
APP_ERROR_CHECK(err_code);}
But that doesn`t work. Anyway I get the NRF_ERROR_DATA_SIZE when I come to my services_init() function and try to add my service with sd_ble_uuid_vs_add(&com_base_uuid, &p_com->uuid_type);.
Thanks for any help.
Regards, BTprogrammer