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; }