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

ble_nus_data_send data length information

Hello.

I am testing UART using ble_nus_data_send function.

However, it has different length data was sending from each trial.(ex. 0, 4095...)

In the ble_nus_data_send API, it has p_length parameter which represents the string length.

But, the received value is just string value (sometimes with different length each trial).

So, I want to send the length information in the ble_nus_data_send. Is it possible to include this information?

or it already possible? (if it cannot be used, why this parameter is include the function parameter?)

Thank you

Best Regards,

Yclee.

Parents
  • Hi Yclee,

    The lenght information is also sent. If you take a look at the ble_app_uart_c and ble_app_uart examples on the SDK. You can see that the function ble_nus_data_send() uses the p_lenght parameter in order to construct the p_hvx_params structure to send the notification to a peer, which needs the lenght in bytes to be written as one of the parameters. If also uses the length parameter to check that the data to send fits the size of the packet.

    In the ble_app_uart_c example you then have ble_nus_chars_received_uart_print() which handles the characters received by the NUS and also receives the lenght. The data length is then printed in the UART peripheral by app_uart_put(). If you want you can also use app_uart_put() to print the lenght after the string.

    Best regards,

    Marjeris

  • Thank you for your reply.

    I understand how can I check the data length..

    Best Regards,

    Yclee.

Reply Children
Related