bjb преди 3 седмици
родител
ревизия
085638f0d6
променени са 2 файла, в които са добавени 12 реда и са изтрити 1 реда
  1. 11 0
      app/src/main/java/com/iscs/comm/MainActivity.kt
  2. 1 1
      app/src/main/res/values/strings.xml

+ 11 - 0
app/src/main/java/com/iscs/comm/MainActivity.kt

@@ -70,6 +70,8 @@ class MainActivity : ComponentActivity() {
                             Button({ ctrlKeySlotCharge(0, true) }) { Text("0-开充电") }
                             Spacer(modifier = Modifier.width(10.dp))
                             Button({ ctrlKeySlotCharge(0, false) }) { Text("0-关充电") }
+                            Spacer(modifier = Modifier.width(10.dp))
+                            Button({ ctrlKeyAllSlot(-1, false, false) }) { Text("全开关充电") }
                         }
                         Row {
                             Button({ ctrlKeySlotLock(1, false) }) { Text("1-开锁") }
@@ -79,6 +81,8 @@ class MainActivity : ComponentActivity() {
                             Button({ ctrlKeySlotCharge(1, true) }) { Text("1-开充电") }
                             Spacer(modifier = Modifier.width(10.dp))
                             Button({ ctrlKeySlotCharge(1, false) }) { Text("1-关充电") }
+                            Spacer(modifier = Modifier.width(10.dp))
+                            Button({ ctrlKeyAllSlot(-1, true, true) }) { Text("全关开充电") }
                         }
                     }
                 }
@@ -110,6 +114,13 @@ class MainActivity : ComponentActivity() {
         }
     }
 
+    fun ctrlKeyAllSlot(ch: Int, isLock: Boolean, isCharge: Boolean) {
+        val device = list.find { it.frame.cmd == 0x0601 }
+        if (device is DeviceKeySlot) {
+            CommManager.write(device.ctrlSlotLockAndCharge(ch, isLock, isCharge))
+        }
+    }
+
     /**
      * 初始化ISCS SDK 操作
      */

+ 1 - 1
app/src/main/res/values/strings.xml

@@ -1,3 +1,3 @@
 <resources>
-    <string name="app_name">CommunicationDemo</string>
+    <string name="app_name">ISCS_SDK</string>
 </resources>