Skip to content

Commit

Permalink
[omnikinverter] Remove org.apache.common (openhab#14418)
Browse files Browse the repository at this point in the history
Signed-off-by: lsiepel <[email protected]>
  • Loading branch information
lsiepel authored and renescherer committed Mar 23, 2023
1 parent 68478e2 commit 6b32b5e
Showing 1 changed file with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
import java.net.Socket;
import java.nio.ByteBuffer;

import org.apache.commons.lang3.ArrayUtils;
import org.eclipse.jdt.annotation.NonNullByDefault;

/**
Expand Down Expand Up @@ -55,7 +54,13 @@ public OmnikInverterMessage pullCurrentStats() throws IOException {
private byte[] generateMagicPacket() {
ByteBuffer serialByteBuffer = ByteBuffer.allocate(8).putInt(serialNumber).putInt(serialNumber);
byte[] serialBytes = serialByteBuffer.array();
ArrayUtils.reverse(serialBytes);

// reverse array
for (int i = 0; i < serialBytes.length / 2; i++) {
byte temp = serialBytes[i];
serialBytes[i] = serialBytes[serialBytes.length - i - 1];
serialBytes[serialBytes.length - i - 1] = temp;
}

byte checksumCount = 115;
for (byte b : serialBytes) {
Expand Down

0 comments on commit 6b32b5e

Please sign in to comment.