Hi,
I am using nrf mesh sdk v3.2.0 and I would like to combine our custom service within the mesh server example (includes the proxy service). Using info from other threads, I integrated the BLE NUS service and it seems to work. I can scan and connect to device with NUS service visible. After the device has been provisioned and configured, my windows BLE application is not able to find the node all the time. My application identifies for the device using the "device name" and some manufacturer specific data. Below is the scanning results:
Sometimes the device is not found in the scan for 1 minutes or so. Is this normal behavior? I am new to BLE mesh and I am not very familiar how scanning works in mesh proxy application.
Second question: Is it feasible to have an extra advertising packets every 1 second or so only containing the device name and some manufacturer data? My preference is to use passive scanning if possible. I already tried to make a method to create such advertising packet and call the method from mesh_adv_start function in mesh_adv.c file. However, I see the special advertising packet just once and not repeated on advertisement interval. See the sample code below
void mesh_adv_data_set2() { memset(&m_gap_adv_data, 0, sizeof(m_gap_adv_data)); m_gap_adv_data.adv_data.p_data = m_advdata_raw[m_adv_set_index]; m_gap_adv_data.scan_rsp_data.p_data = m_srdata_raw[m_adv_set_index]; m_gap_adv_data.adv_data.len = sizeof(m_advdata_raw[0]); m_gap_adv_data.scan_rsp_data.len = sizeof(m_srdata_raw[m_adv_set_index]); m_adv_set_index = (m_adv_set_index + 1) & 1; ble_advdata_t advdata; memset(&advdata, 0, sizeof(advdata)); advdata.flags = BLE_GAP_ADV_FLAGS_LE_ONLY_GENERAL_DISC_MODE; advdata.name_type = BLE_ADVDATA_FULL_NAME; // Variables used for manufacturer specific data ble_advdata_manuf_data_t adv_manuf_data; uint8_array_t adv_manuf_data_array; uint8_t adv_manuf_data_data[10]; // --------------------------------------------- // Configuration of manufacturer specific data memcpy(adv_manuf_data_data, CustomData, 10); adv_manuf_data_array.p_data = adv_manuf_data_data; adv_manuf_data_array.size = 10; adv_manuf_data.company_identifier = 0x06CF; adv_manuf_data.data = adv_manuf_data_array; advdata.p_manuf_specific_data = &adv_manuf_data; APP_ERROR_CHECK(ble_advdata_encode(&advdata, m_gap_adv_data.adv_data.p_data, &m_gap_adv_data.adv_data.len)); #if NRF_SD_BLE_API_VERSION >= 6 uint32_t err_code = sd_ble_gap_adv_set_configure(&m_adv_handle, &m_gap_adv_data, &m_adv_params); if (err_code == NRF_ERROR_INVALID_STATE) { err_code = sd_ble_gap_adv_set_configure(&m_adv_handle, &m_gap_adv_data, NULL); } #else uint32_t err_code = sd_ble_gap_adv_data_set(m_gap_adv_data.adv_data.p_data, m_gap_adv_data.adv_data.len, m_gap_adv_data.scan_rsp_data.p_data, m_gap_adv_data.scan_rsp_data.len); #endif /* NRF_SD_BLE_API_VERSION >= 6 */ APP_ERROR_CHECK(err_code); } void mesh_adv_start(void) { mesh_adv_data_set2(); __LOG(LOG_SRC_APP, LOG_LEVEL_INFO, "mesh_adv_start\n"); #if NRF_SD_BLE_API_VERSION >= 6 APP_ERROR_CHECK(sd_ble_gap_adv_start(m_adv_handle, MESH_SOFTDEVICE_CONN_CFG_TAG)); #else APP_ERROR_CHECK(sd_ble_gap_adv_start(&m_adv_params, MESH_SOFTDEVICE_CONN_CFG_TAG)); #endif /* We restart the mesh timeslot to yield time for the softdevice advertiser to start. */ timeslot_restart(TIMESLOT_PRIORITY_LOW); }
Thanks for your support.