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

ATT_MTU event handler

Hi everyone,

So Im trying to modify the event handler of the ATT_MTU example file to have it so that it logs every time a byte is sent / instead of KB but for some reason when I change the defined 

AMT_BYTE_TRANSFER_CNT to 247 (just to try and send a single packet). the program only detects that 4 bytes are sent throughout the running process even though it acknowledges that the test was succesfully completed. 
        if (p_ctx->bytes_sent != bytecounter)
            {
             evt.evt_type        = NRF_BLE_AMTS_EVT_TRANSFER_1B;     
             bytecounter = p_ctx->bytes_sent;
             p_ctx->evt_handler(evt);  
            }
What I did:
  1. What I did was add a new Event in the events enum in amt.h 
  2. In the amts.c I initialised an integer with a value of 0 with the name bytecounter and within static void char_notification_send(nrf_ble_amts_t * p_ctx) I added the code above 
  3. In the main.c event handler I added the option to log on the UART interface when a byte is sent 

I also tried to do the same with an event that would tell me when a complete packet is sent and so within the amts.c (after the amt.h enum declaration) I added the code

 if (p_ctx->bytes_sent % 240 ==0)
        {
            evt.evt_type = NRF_BLE_AMTS_EVT_PACKET_TRANSFER;
            p_ctx->evt_handler(evt);
        }
(this is assuming a packet is 240 bytes)

but somehow it only logged a packet being sent only a few times when I sent a throughput of a Megabyte

Could you please point me in the direction of figuring out what went wrong or how I could implement this functionality 

Kind Regards,

Youssef 

 
Related