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

Setting Custom Gatt characteristic data.

Hi,

I want to set a custom value to my Gatt characteristic value. I can do this by writing to the characteristic in my app or the NRF_connect application. 

What I want to do is based on an event or the data I receive to change the GATT characteristic data for my app to receive. I tried using this code which, did not change the data.

Fullscreen
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
//err_code = ble_cus_custom_value_update(p_cus, p_ble_evt,m_custom_value);
//APP_ERROR_CHECK(err_code);
//I pass in a fixed value for testing into m_custom_value
uint32_t ble_cus_custom_value_update(ble_cus_t * p_cus, ble_evt_t const * p_ble_evt, uint8_t custom_value)
{
NRF_LOG_INFO("In ble_cus_custom_value_update. \r\n");
if (p_cus == NULL)
{
return NRF_ERROR_NULL;
}
uint32_t err_code = NRF_SUCCESS;
ble_gatts_value_t gatts_value;
// Initialize value struct.
memset(&gatts_value, 0, sizeof(gatts_value));
gatts_value.len = sizeof(uint8_t);
gatts_value.offset = 0;
gatts_value.p_value = &custom_value;
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

What I need to know is how to update this data value so I can transfer useful data between the two devices (mobile application and nordic board).

Note I am trying to do this within my GATT connection itself.

Note using SDK15 , PCA10056 NRF52840-dk Segger,

Thanks