This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts
This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Sending log data over BLE through custom UUID Service

Hi Nordic Dev Team,

I am trying to send my log data from my flash memory into Android Phone. I followed this example :

github.com/.../nRF5x-custom-ble-service-tutorial

So I have already set up a custom UUID Service and Characteristics for this purpose, so whenever the command is triggered. My unit is going to write its flash data into the characteristics, so I tried to look at how ble_nus_data_send() is implemented and kinda copied it but I got confused with the 

err_code = blcm_link_ctx_get(p_nus->p_link_ctx_storage, conn_handle, (void *) &p_client);

So scenario is like:

1. Detect the amount of flash memory data that is going to be send.

2. Call err_code = sd_ble_gatts_hvx(p_cus->conn_handle, &hvx_params); 

3. Send continuously until the end of flash memory data.

I kept getting NRF_ERROR_DATA_SIZE on sd_ble_gatts_hvx(p_cus->conn_handle, &hvx_params), since I try to convert the data that I stored (uint32_t and uint32_t) into uint8_t buffer[8]; everything is already converted to byte arrays and I just passed the value and the length.

I wonder if there's any example that does this? It's so confusing

Parents
  • Hi 

    Any reason you couldn't just use the ble_app_uart example directly, rather than copying this functionality into something else?

    This example is made for applications where you want to send proprietary (user defined) data of varying sizes over BLE. 

    If you plan to go to production with this implementation you can simply change the 128-bit service UUID in order to not represent your device as a Nordic NUS device. 

    Best regards
    Torbjørn

  • Hi Torbjorn,

    I planned to have DFU, Nordic NUS and Custom Log Transfer data services. So NUS is for regular data transfer channel and the custom service for a log data transfer (potentially huge amount of data) channel. Maybe similar like DFU Service implementation.

    I am not sure whether it's a redundant thing to create my custom service for this?

  • Hi 

    In that case I would probably just copy the ble_nus implementation, and rename it to something else (ble_log_service for instance). 

    As long as you make sure to rename all the non static functions and structs, and ensure that your log service uses a different UUID, it doesn't matter that you have two essentially identical services running side by side. 

    Alternatively you could simply add a new characteristic to your existing service, but it is probably more logical to separate the log functionality in a separate service. 

    Best regards
    Torbjørn

Reply
  • Hi 

    In that case I would probably just copy the ble_nus implementation, and rename it to something else (ble_log_service for instance). 

    As long as you make sure to rename all the non static functions and structs, and ensure that your log service uses a different UUID, it doesn't matter that you have two essentially identical services running side by side. 

    Alternatively you could simply add a new characteristic to your existing service, but it is probably more logical to separate the log functionality in a separate service. 

    Best regards
    Torbjørn

Children
No Data
Related