Hi,
I'm having trouble with the scan response. My product is advertising manufaturer data and need to advertise also a custom service UUID. As there is no room in the advertising packet i've seen that this could be done using scan response.
If I remove the manufacturer data and put the service UUID in the advertising packet I can see it correctly advertised using nrf connect (ios)
Here is my advertising_init()
static void advertising_init(void) { ret_code_t err_code; ble_advertising_init_t init; int8_t power_level = BLE_PWR_GAIN_DEF; memset(&init, 0, sizeof(init)); init.advdata.name_type = BLE_ADVDATA_FULL_NAME; init.advdata.include_appearance = false; init.advdata.flags = BLE_GAP_ADV_FLAGS_LE_ONLY_GENERAL_DISC_MODE; init.advdata.uuids_complete.uuid_cnt = sizeof(m_adv_uuids) / sizeof(m_adv_uuids[0]); init.advdata.uuids_complete.p_uuids = m_adv_uuids; init.advdata.p_tx_power_level = &power_level; init.srdata.uuids_complete.uuid_cnt = sizeof(m_adv_uuids) / sizeof(m_adv_uuids[0]); init.srdata.uuids_complete.p_uuids = m_adv_uuids; init.config.ble_adv_fast_enabled = APP_ADV_FAST_ENABLED; init.config.ble_adv_fast_interval = APP_ADV_FAST_INTERVAL; init.config.ble_adv_fast_timeout = APP_ADV_FAST_TIMEOUT_IN_SECONDS; init.config.ble_adv_slow_enabled = APP_ADV_SLOW_ENABLED; init.config.ble_adv_slow_interval = (uint32_t)(((float) nfc_get_ble_beacon_rate()) * 1.6); init.config.ble_adv_slow_timeout = APP_ADV_SLOW_TIMEOUT_IN_SECONDS; init.evt_handler = on_adv_evt; err_code = ble_advertising_init(&m_advertising, &init); APP_ERROR_CHECK(err_code); ble_advertising_conn_cfg_tag_set(&m_advertising, APP_BLE_CONN_CFG_TAG); sd_ble_gap_tx_power_set(BLE_GAP_TX_POWER_ROLE_ADV, &m_advertising, power_level); }
And here is the function updating the manufacturer data called every X seconds.
void App_UpdateBeacon(uint8_t *manfData, uint8_t len) { ret_code_t err_code; ble_advdata_manuf_data_t manuf_data; static uint8_t payload_index = 0; if(!nfc_get_ble_beacon_rate()) { return; } if (manfData) { memcpy(BLEManfData, manfData, len); new_advdata.p_manuf_specific_data = &manuf_data; // SMTC_HAL_TRACE_INFO("Updating advertising data!"); if( NFC_Data.bleAdvType == BLE_ADV_TYPE_DEFAULT ) { manuf_data.company_identifier = APP_COMPANY_IDENTIFIER_REF_TAGS; } else if( NFC_Data.bleAdvType == BLE_ADV_TYPE_SBEACON ) { manuf_data.company_identifier = APP_COMPANY_IDENTIFIER_BLUFI; } manuf_data.data.p_data = BLEManfData; manuf_data.data.size = len; new_advdata.short_name_len = 5; new_advdata.name_type = BLE_ADVDATA_SHORT_NAME; err_code = ble_advertising_advdata_update(&m_advertising, &new_advdata, NULL); APP_ERROR_CHECK(err_code); if (payload_index == TOP_INDEX) { payload_index = 0; } else { payload_index++; } } }
With this, on Nrf connect I can only see the manufacturer data but not the service UUID.
If someone knows where I'm wrong thanks for helping !