How to purge incoming Xbee packets from the buffer?
It means there's a lot of latency between your issuing a command and getting a confirmation of the command's effect. When you send the command, it's best that you wait and read packets until you find the confirmation and then you return from the function or do whatever else you want to do. There is no need for a separate burnSerial() function, nor should you blindly discard data. So basically, the sequence of operations should be:


Send the command
Read packets until you find the 'confirmation' identification marker
Return or exit


This assumes that your transmitter only sends confirmation after it has halted the stream.