#1: TODO: Доделать отмонтирование Samba

This commit is contained in:
2026-04-16 00:09:03 +05:00
parent 2734c06fb1
commit 279a4bf802

View File

@@ -167,8 +167,8 @@ class USBVirusScanner {
}
SystemState.SAMBA -> {
blinkLed(greenLed, 1000)
blinkLed(yellowLed, 1000)
blinkLed(greenLed, 200)
blinkLed(yellowLed, 200)
redLed.setValue(0)
}
}
@@ -228,6 +228,7 @@ class USBVirusScanner {
if (result.infectedFiles.size > 10) {
println(if (isDebug) " ... и ещё ${result.infectedFiles.size - 10} файлов" else "")
}
unmount()
} else if (result.error != null) {
println(if (isDebug) "❌ Ошибка сканирования: ${result.error}" else "")
} else {
@@ -259,7 +260,16 @@ class USBVirusScanner {
currentState = SystemState.SAMBA
sambaStartSharing()
while (isUsbSharing()) {}
val buttonListener = ButtonListener()
var isEventHappened = false
buttonListener.addLongPressListener { event ->
isEventHappened = true
}
buttonListener.startListening()
while (!isEventHappened) {
delay(500.milliseconds)
}
}
currentState = SystemState.IDLE
@@ -453,12 +463,6 @@ class USBVirusScanner {
}
}
fun isUsbSharing(isActive: Boolean): Boolean {
var defaultState: Boolean = false
defaultState = isActive
return defaultState
}
suspend fun sambaStartSharing() {
try {
currentState = SystemState.SAMBA