auto-sync
This commit is contained in:
parent
24aec31733
commit
3ffda1aecd
|
@ -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
|
||||
*
|
||||
|
|
Loading…
Reference in New Issue