public void send ( byte [ ] data , int id ) { boolean isFirstPacket = ( packets . size ( ) == 0 ) ; packets . add ( data ) ; ids . add ( id ) ; if ( isFirstPacket ) { scheduleSendTask ( true ) ; } Log . d ( TAG , "Added packet " + id + " to buffer; " + packets . size ( ) + " packets in buffer" ) ; }
Add a packet to the buffer to be sent . If no other packets are in the buffer it will be sent immediately .