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

getting gatts value with nRF51822

Hi There,

I want the functionality of my device to change when a value is written to a gatt characteristic. I've written an event handler that gets called whenever a write is made to the characteristic. This works correctly, but the problem is that I then can't get the value of the characteristic within this handler. I'm trying to use the sd_ble_gatts_value_get() function, and every time it is called the chip gets reset.

Thanks for any help you can give.

Here's my code:


void hex_evt_handler(ble_hex_t * p_hex, ble_hex_evt_t * p_ble_evt)
{

    uint32_t err_code = NRF_SUCCESS;

    uint8_t new_hex_status = 0;
    uint16_t len = sizeof(uint8_t);

    err_code = sd_ble_gatts_value_get(p_hex->hex_status_handles.value_handle,
	                                      0,
	                                      &len,
	                                      &new_hex_status);

    if (err_code != NRF_SUCCESS)
    {
        return;
    }

    ...
}


Related