ZengTao
2024-05-20 103e41d02eaccd836870bce3e544bb794447e2ac
springboot-vue3/src/main/java/com/example/springboot/component/MessageHandler.java
@@ -24,6 +24,11 @@
        }
    }
    //写入bit
    public void writeBitToPLC(JSONArray messageArray, List<String> addresses, int index) {
        try {
@@ -204,6 +209,17 @@
    public short[] convertBooleanListToShortArray(List<Boolean> booleanList) {
        short[] shortArray = new short[booleanList.size()];
        for (int i = 0; i < booleanList.size(); i++) {
            boolean value = booleanList.get(i);
            shortArray[i] = value ? (short) 1 : (short) 0;
        }
        return shortArray;
    }