Hello,
What SDK version do you use? Can you check what the on_adv_report() does when it picks up the advertisements from the phone? You can also see inside this function what it is looking for, whether it is a UUID or an advertising name (or something else).
It is a bit hard to pinpoint exactly where it checks for this, as it differs between the different SDK versions, but do a search for "on_adv_rep" in your project, and see if you can find out what function that is called when the scanner receives an advertisement report.
Thank you for answer.
I am using s132 on pca10040 in version 15.3.
I am using the nrf52832 chip.
It is difficult to verify that the on_adv_rep function works
Peripheral is the uart, Central is the.
I tried to match UUID and device_name but it does not work. Help
As long as it doesn't return 0, the message is not sent.
Can you check where in ble_nus_data_send it returns 5? 5 = NRF_ERROR_NOT_FOUND. It should be in ble_nus.c. Either it is
if ((conn_handle == BLE_CONN_HANDLE_INVALID) || (p_client == NULL)) { return NRF_ERROR_NOT_FOUND; }
or the softdevice call:
return sd_ble_gatts_hvx(conn_handle, &hvx_params);
It may be easiest to debug and set breakpoints to figure out which one it is, since NRF_LOG is not enabled by default. Alternatively you can enable it by setting BLE_NUS_CONFIG_LOG_ENABLED to 1 in sdk_config.h to be able to use NRF_LOG_INFO in ble_nus.c.
It is a bit tricky to port the ble_app_uart example to support multiple connections. You have to handle all your connection handles correctly. I suggest you take a look in the ble_app_multiperipheral example in SDK\examples\ble_peripheral\experimental\ble_app_multiperipheral.
Especially in the on_connected() funtion in main, where nrf_ble_qwr_conn_handle_assign() is called in this example. The conn handles is an array. It should be the same in your example. You can also see how it uses the connection handle in led_status_send_to_all().
Best regards,
Edvin
Thank you for answer.
Found a place to return 5. Within the ble_nus.c file.
This is the statement in the ble_nus_data_send () function.
err_code = blcm_link_ctx_get (p_nus-> p_link_ctx_storage, conn_handle, (void *) & p_client);
See the screenshot below.
Thank you
Yes. It is the reason I explained in the previous answer. You are not sending a valid connection handle into ble_nusdata_send(). Look at the multiperipheral example how it should be done.
Thank you. Where can I get a multiperipheral example?
Edvin said:SDK\examples\ble_peripheral\experimental\ble_app_multiperipheral.
Edvin said:SDK\examples\ble_peripheral\experimental\ble_app_multiperipheral.