4 Replies Latest reply on Jan 21, 2016 10:12 AM by MichaelF_56

    Sending 200 bytes, 20 bytes at a time in BLE ???

      I'm trying to send 200 bytes, by doing it 20 bytes at a time.  My questions is "How do I know it's OK to send the next 20 bytes?".

       

      Here's what I'm doing.  Is this correct?

       

      #define   ACCEL_DATA_SIZE      200

       

      // Loaded with data in the Accelerometer interrupt

      UINT8  accel_data[ACCEL_DATA_SIZE];

       

      UINT8 i = 0;

       

      while (i < ACCEL_DATA_SIZE) // Keep trying until all samples have been transmitted

      {

            if (blecm_getAvailableTxBuffers() > 0) // Only send if TX buffers available

            {

                 bleprofile_sendNotification(HDLC_LOOPD_SERVICE_ACCEL_DATA_VALUE, (accel_data + i), 20);

                 i += 20;

           }

      }

       

       

      But for some reason, the device just drops the connection in the middle of the transmission.

       

      Is using "blecm_getAvailableTxBuffers() " the right thing?  OR do I have to check or do something else?

       

      Thanks!!

       

      Gil