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

keep read same characteristic

Hi, all

I'm using nRF52832 pca10040, s132.

I successfully read peripheral characteristic using 'ble_app_uart_c' example.

However, I read once only when the connection is successful because I read the characteristic while doing service discovery.

(So I have to reconnect with the peripheral to read the characteristics again.)

case BLE_NUS_C_EVT_DISCOVERY_COMPLETE:
    NRF_LOG_INFO("Discovery complete.");
    err_code = ble_nus_c_handles_assign(p_ble_nus_c, p_ble_nus_evt->conn_handle, &p_ble_nus_evt->handles);
    APP_ERROR_CHECK(err_code);

    nrf_delay_ms(3000);
    ble_uuid_t p_uuid = {.uuid = 0x1601, .type = BLE_UUID_TYPE_BLE};
    ble_gattc_handle_range_t p_handle_range = {.start_handle = 0x0001, .end_handle = 0xFFFF};

    err_code = sd_ble_gattc_char_value_by_uuid_read(p_ble_nus_evt->conn_handle, &p_uuid, &p_handle_range);

    if(err_code != NRF_SUCCESS)
    {
        NRF_LOG_INFO("Failed to send read request to peer error = %d", err_code);
    }

    break;

If I use notification, I can continue to read the value of peripheral characteristic.

But in my case, I have to use 'read' and I don't know what to do with using 'read'.

Should I keep calling " line 10 : err_code = sd_ble_gattc_char_value_by_uuid_read(p_ble_nus_evt->conn_handle, &p_uuid, &p_handle_range) " somehow?

BR,

lyrics

Related