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");
}

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 .
