Detect and abort if we received the end of a message without the beginning.
Detect and abort if we received the end of a message without the beginning.

The first write from Android, we always get the end but not the beginning. This
gets the packet buffer in a funky state where it'll keep try and combining the
end of a message with the beginning of another. To get around that, we detect if
we:

    1. Weren't able to parse a JSON message
    2. Found a NULL character in the message (meaning the end of the message).

and if this is true, we wipe the packet buffer.

Next question - why does every initial transfer from Android get truncated?

mgiannikouris/vi-firmware,openxc/vi-firmware,ene-ilies/vi-firmware,openxc/vi-firmware,openxc/vi-firmware,mgiannikouris/vi-firmware,mgiannikouris/vi-firmware,ene-ilies/vi-firmware,ene-ilies/vi-firmware,openxc/vi-firmware,mgiannikouris/vi-firmware,ene-ilies/vi-firmware