|
|
@@ -3,7 +3,6 @@ package com.iscs.comm
|
|
|
import android.content.Context
|
|
|
import android.content.Intent
|
|
|
import android.os.Bundle
|
|
|
-import android.util.Log
|
|
|
import androidx.activity.ComponentActivity
|
|
|
import androidx.activity.compose.setContent
|
|
|
import androidx.activity.enableEdgeToEdge
|
|
|
@@ -122,7 +121,8 @@ class CtrlActivity : ComponentActivity() {
|
|
|
rfid.value = it.rfid
|
|
|
if (it.isChanged && rfid.value.isNotEmpty() && rfid.value != lastRFID) {
|
|
|
lastRFID = rfid.value
|
|
|
- dev.ctrlSlotLock(state.ch, true).writeByFrame()
|
|
|
+ // 硬件逻辑已经存在
|
|
|
+ dev.ctrlSlotLockAndCharge(state.ch, true, true).writeByFrame()
|
|
|
} else if (rfid.value.isEmpty()) {
|
|
|
lastRFID = ""
|
|
|
}
|
|
|
@@ -156,14 +156,26 @@ class CtrlActivity : ComponentActivity() {
|
|
|
}
|
|
|
Spacer(modifier = Modifier.weight(1f))
|
|
|
Row {
|
|
|
- Button({ dev.ctrlSlotLock(state.ch, false).writeByFrame() }) { Text("打开锁") }
|
|
|
+ Button(
|
|
|
+ { dev.ctrlSlotLockAndCharge(state.ch, false, false).writeByFrame() },
|
|
|
+ contentPadding = PaddingValues(horizontal = 6.dp, vertical = 0.dp)
|
|
|
+ ) { Text("打开锁") }
|
|
|
Spacer(modifier = Modifier.weight(1f))
|
|
|
- Button({ dev.ctrlSlotLock(state.ch, true).writeByFrame() }) { Text("关闭锁") }
|
|
|
+ Button(
|
|
|
+ { dev.ctrlSlotLockAndCharge(state.ch, true, true).writeByFrame() },
|
|
|
+ contentPadding = PaddingValues(horizontal = 6.dp, vertical = 0.dp)
|
|
|
+ ) { Text("关闭锁") }
|
|
|
}
|
|
|
Row {
|
|
|
- Button({ dev.ctrlSlotCharge(state.ch, true).writeByFrame() }) { Text("开充电") }
|
|
|
+ Button(
|
|
|
+ { dev.ctrlSlotCharge(state.ch, true).writeByFrame() },
|
|
|
+ contentPadding = PaddingValues(horizontal = 6.dp, vertical = 0.dp)
|
|
|
+ ) { Text("开充电") }
|
|
|
Spacer(modifier = Modifier.weight(1f))
|
|
|
- Button({ dev.ctrlSlotCharge(state.ch, false).writeByFrame() }) { Text("关充电") }
|
|
|
+ Button(
|
|
|
+ { dev.ctrlSlotCharge(state.ch, false).writeByFrame() },
|
|
|
+ contentPadding = PaddingValues(horizontal = 6.dp, vertical = 0.dp)
|
|
|
+ ) { Text("关充电") }
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
@@ -208,7 +220,8 @@ class CtrlActivity : ComponentActivity() {
|
|
|
// 这里可以做一些其他逻辑,比如如果当前有锁存在,但是没上锁,这里可执行上锁操作
|
|
|
if (it.isChanged && rfid.value.isNotEmpty() && rfid.value != lastRFID) {
|
|
|
lastRFID = rfid.value
|
|
|
- dev.ctrlSlotLock(state.ch, true).writeByFrame()
|
|
|
+ // 硬件逻辑已存在
|
|
|
+ // dev.ctrlSlotLock(state.ch, true).writeByFrame()
|
|
|
} else if (rfid.value.isEmpty()) {
|
|
|
lastRFID = ""
|
|
|
}
|