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

Where is the data in throughput example?

I am working with the throughput example for the nRF52840 demo board.
I have found all sorts of control structures which include the counts of bytes sent. I have not found the actual data sent. I am working with a sniffer and would like to confirm the data is not encrypted and that the sniffer is working.

Dumb question, where is the data loaded into the transmit for the "BOARD_TESTER" and where can I find it on the "BOARD_DUMMY" side?

  • Hi,

    The data that is being sent is just random values. The data is declared in the char_notification_send() function in the amts.c file:

    static void char_notification_send(nrf_ble_amts_t * p_ctx)
    {
        uint8_t            data[256];
        uint16_t           payload_len = p_ctx->max_payload_len;
        .
        .
        .
    

    Since the data is only declared, and not initialized, the array will contain random values.

  • Thanks Sigurd, where is the data 'read' when received? I know it isn't actually read as the content is of no interest, but if I wanted to read it, where would I do that from?

  • Hi greyed,

    When a central/client receives a notification from the peripheral/server, it will get an event BLE_GATTC_EVT_HVX. In amtc.c in the function nrf_ble_amtc_on_ble_evt(), we are checking for this event, and when we get the event we call the function on_hvx(). Here we process the data, and generate an event called NRF_BLE_AMT_C_EVT_NOTIFICATION that we use to keep track of the amount of data we have received. We pick the information from the BLE_GATTC_EVT_HVX event we are interested in, and send this to the amtc_evt_handler() in main.c, when we call p_ctx->evt_handler(p_ctx, &amt_c_evt);

    In the throughput example, we don’t use the data itself for anything, but we can find the data in p_ble_evt->evt.gattc_evt.params.hvx.data when we are in the on_hvx() function. The length of the data(this we use), is found in p_ble_evt->evt.gattc_evt.params.hvx.len.

    We have examples where we actually use the data itself to something more meaningful, such as the ble_app_uart_c example.

Related