]> git.basschouten.com Git - openhab-addons.git/commitdiff
[omnikinverter] Remove org.apache.common (#14418)
authorlsiepel <leosiepel@gmail.com>
Sun, 19 Feb 2023 20:19:09 +0000 (21:19 +0100)
committerGitHub <noreply@github.com>
Sun, 19 Feb 2023 20:19:09 +0000 (21:19 +0100)
Signed-off-by: lsiepel <leosiepel@gmail.com>
bundles/org.openhab.binding.omnikinverter/src/main/java/org/openhab/binding/omnikinverter/internal/OmnikInverter.java

index 0a1dc725f43185a4be859e10d00328f8f7779e10..c36f52070aa7e88b770b1ffef3b51748dbf9a405 100644 (file)
@@ -16,7 +16,6 @@ import java.io.IOException;
 import java.net.Socket;
 import java.nio.ByteBuffer;
 
-import org.apache.commons.lang3.ArrayUtils;
 import org.eclipse.jdt.annotation.NonNullByDefault;
 
 /**
@@ -55,7 +54,13 @@ public class OmnikInverter {
     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) {