You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
23 lines
737 B
23 lines
737 B
package net.aiterp.git.ykonsole2.application.routes.ws
|
|
|
|
import net.aiterp.git.ykonsole2.application.routes.ValueDTO
|
|
import net.aiterp.git.ykonsole2.domain.models.Device
|
|
import net.aiterp.git.ykonsole2.domain.runtime.*
|
|
|
|
data class SocketInput(
|
|
val start: Boolean = false,
|
|
val stop: Boolean = false,
|
|
val connect: Boolean = false,
|
|
val disconnect: Boolean = false,
|
|
val skip: Boolean = false,
|
|
val setValue: ValueDTO? = null,
|
|
) {
|
|
fun makeCommands(device: Device) = buildList {
|
|
if (start) add(StartCommand)
|
|
if (stop) add(StopCommand)
|
|
if (connect) add(ConnectCommand(device))
|
|
if (disconnect) add(DisconnectCommand)
|
|
if (skip) add(SkipCommand)
|
|
setValue?.toValues()?.forEach { add(SetValueCommand(it)) }
|
|
}
|
|
}
|