auto-sync

This commit is contained in:
rusEfi 2016-12-22 08:02:29 -05:00
parent 9a1e71ef90
commit 80ec7edf0c
1 changed files with 14 additions and 1 deletions

View File

@ -424,10 +424,23 @@ public class BinaryProtocol {
public static void sendCrcPacket(byte[] command, Logger logger, IoStream stream) throws IOException {
byte[] packet = IoHelper.makeCrc32Packet(command);
logger.info("Sending " + Arrays.toString(packet));
logger.info("Sending packet " + printHexBinary(command));
stream.write(packet);
}
private static final char[] hexCode = "0123456789ABCDEF".toCharArray();
private static String printHexBinary(byte[] data) {
StringBuilder r = new StringBuilder(data.length * 2);
for (byte b : data) {
r.append(hexCode[(b >> 4) & 0xF]);
r.append(hexCode[(b & 0xF)]);
r.append(' ');
}
return r.toString();
}
/**
* This method blocks until a confirmation is received
*