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
  • Hi

    Please disregard my last reply, as I clearly misunderstood what you are trying to accomplish. Sorry about that.

    How are you confirming that you are receiving all 19 characters. Where are you reading the 19 characters? 

    This should be the way to obtain 3 characters on the receiving end, but can you try to set the data length in your receiving application as max 3 as well?

    Best regards,

    Simon

Reply
  • Hi

    Please disregard my last reply, as I clearly misunderstood what you are trying to accomplish. Sorry about that.

    How are you confirming that you are receiving all 19 characters. Where are you reading the 19 characters? 

    This should be the way to obtain 3 characters on the receiving end, but can you try to set the data length in your receiving application as max 3 as well?

    Best regards,

    Simon

Children
No Data
Related