Browse Source

测试CAN钥匙底座

bjb 3 weeks ago
parent
commit
085638f0d6

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

@@ -70,6 +70,8 @@ class MainActivity : ComponentActivity() {
                             Button({ ctrlKeySlotCharge(0, true) }) { Text("0-开充电") }
                             Button({ ctrlKeySlotCharge(0, true) }) { Text("0-开充电") }
                             Spacer(modifier = Modifier.width(10.dp))
                             Spacer(modifier = Modifier.width(10.dp))
                             Button({ ctrlKeySlotCharge(0, false) }) { Text("0-关充电") }
                             Button({ ctrlKeySlotCharge(0, false) }) { Text("0-关充电") }
+                            Spacer(modifier = Modifier.width(10.dp))
+                            Button({ ctrlKeyAllSlot(-1, false, false) }) { Text("全开关充电") }
                         }
                         }
                         Row {
                         Row {
                             Button({ ctrlKeySlotLock(1, false) }) { Text("1-开锁") }
                             Button({ ctrlKeySlotLock(1, false) }) { Text("1-开锁") }
@@ -79,6 +81,8 @@ class MainActivity : ComponentActivity() {
                             Button({ ctrlKeySlotCharge(1, true) }) { Text("1-开充电") }
                             Button({ ctrlKeySlotCharge(1, true) }) { Text("1-开充电") }
                             Spacer(modifier = Modifier.width(10.dp))
                             Spacer(modifier = Modifier.width(10.dp))
                             Button({ ctrlKeySlotCharge(1, false) }) { Text("1-关充电") }
                             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 操作
      * 初始化ISCS SDK 操作
      */
      */

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

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