#1: TODO: Доделать отмонтирование Samba
This commit is contained in:
@@ -167,8 +167,8 @@ class USBVirusScanner {
|
|||||||
}
|
}
|
||||||
|
|
||||||
SystemState.SAMBA -> {
|
SystemState.SAMBA -> {
|
||||||
blinkLed(greenLed, 1000)
|
blinkLed(greenLed, 200)
|
||||||
blinkLed(yellowLed, 1000)
|
blinkLed(yellowLed, 200)
|
||||||
redLed.setValue(0)
|
redLed.setValue(0)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -228,6 +228,7 @@ class USBVirusScanner {
|
|||||||
if (result.infectedFiles.size > 10) {
|
if (result.infectedFiles.size > 10) {
|
||||||
println(if (isDebug) " ... и ещё ${result.infectedFiles.size - 10} файлов" else "")
|
println(if (isDebug) " ... и ещё ${result.infectedFiles.size - 10} файлов" else "")
|
||||||
}
|
}
|
||||||
|
unmount()
|
||||||
} else if (result.error != null) {
|
} else if (result.error != null) {
|
||||||
println(if (isDebug) "❌ Ошибка сканирования: ${result.error}" else "")
|
println(if (isDebug) "❌ Ошибка сканирования: ${result.error}" else "")
|
||||||
} else {
|
} else {
|
||||||
@@ -259,7 +260,16 @@ class USBVirusScanner {
|
|||||||
currentState = SystemState.SAMBA
|
currentState = SystemState.SAMBA
|
||||||
sambaStartSharing()
|
sambaStartSharing()
|
||||||
|
|
||||||
while (isUsbSharing()) {}
|
val buttonListener = ButtonListener()
|
||||||
|
var isEventHappened = false
|
||||||
|
|
||||||
|
buttonListener.addLongPressListener { event ->
|
||||||
|
isEventHappened = true
|
||||||
|
}
|
||||||
|
buttonListener.startListening()
|
||||||
|
while (!isEventHappened) {
|
||||||
|
delay(500.milliseconds)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
currentState = SystemState.IDLE
|
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() {
|
suspend fun sambaStartSharing() {
|
||||||
try {
|
try {
|
||||||
currentState = SystemState.SAMBA
|
currentState = SystemState.SAMBA
|
||||||
|
|||||||
Reference in New Issue
Block a user