There has been a lot of flakiness in the way the AOA connection was handled, mostly due to many things in the connection process that can go wrong, which results in a fairly complex state machine. To avoid this complexity, the entire connection process has been collapsed to a single method which attempts the entire connection process as one atomic linear sequence and the waitForConnect() process simply involves invoking it repeatedly until it succeeds. While being slightly less efficient, it is more obviously correct and appears to address the unreliability issues.
Remove this static dependency of the core library on platform-specific libraries. Instead, this becomes a runtime dependency. This will allow us to refactor IOIOLib so that the platform independent pieces are separate. Credit to Thanos Fisherman for the idea and initial implementation!
Useful for extracting the versions.
Each connetion type knows best how to buffer its input stream. The protocol should no longer do this buffering, but rather each connection type should do what makes sense for it.
Thanks to Maxwell Doherty for finding the fix! It turns out the Nexus 5 only supports read operations of length that are multiples of 64. Added a class that guarantees that. Using 1024B reads might boost performance a little and would be harmless otherwise, except for taking a KB of RAM.