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

Reduce the number of characters transmitted through a notification.

So I run SDK 15.0. I have a notification channel, and I want to transmit some data on it.

I run this code

    hvx_params.handle = gatt_notify_handlers[index].gatt_handle;
    hvx_params.type   = BLE_GATT_HVX_NOTIFICATION;
    hvx_params.offset = 0;
    hvx_params.p_len  = &datalength;
    hvx_params.p_data = data;

    err_code=sd_ble_gatts_hvx(generic_ble_conn_handle, &hvx_params);


hvx_parmas.p_len is set to 3, which corresponds correctly to the value inside datalength.

The notification channel was initialised to a 19 character buffer that I use for my data handle.

I then use the nRF connect app to receive the notification, and I reliably receive all 19 characters in my buffer on my notification request.

However, that's not really what I wanted. I wanted to transmit only the 3 first characters. Is this not possible or is this just not the way to do it?
Parents Reply Children
  • ble_nus.c doesn't seem to have any references to add_char_params in SDK 15.0. I found some other service files, but unless I'm reading them wrong, they are using add_char_params to limit the max length of the transmission as I create the characteristic. Surely I'm not meant to remove my characteristic and creating it again between every notification if I wish to vary the notification length? Am I misunderstanding what you're saying?

Related