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

S130 long characteristic values

Hi,

I'm facing a little problem with custom service characteristic. I've set char settings as follows

attr_char_value.init_len     = sizeof(uint8_t);
attr_char_value.init_offs    = 0;
attr_char_value.max_len      = 5;
attr_char_value.p_value      = NULL;

When I try to write the characteristic through NRF Connect app, it seems fine. But when I try to update characteristic value with this code:

gatts_value.len	= len;
gatts_value.offset = 0;
gatts_value.p_value = data;  // pointer to data array

err_code = sd_ble_gatts_value_set(p_ctrl->conn_handle,
								  p_ctrl->config_char_handles.value_handle,
								  &gatts_value);

Code executes without errors, but the value read from characteristic don't change. Any ideas what is wrong?

Parents
  • I see.

    When you use BLE_GATTS_VLOC_USER the attribute Value is located in user memory. This requires you to maintain a valid buffer through the lifetime of the attribute, since the stack will read and write directly to the memory using the pointer provided in the APIs.

Reply
  • I see.

    When you use BLE_GATTS_VLOC_USER the attribute Value is located in user memory. This requires you to maintain a valid buffer through the lifetime of the attribute, since the stack will read and write directly to the memory using the pointer provided in the APIs.

Children
No Data