|
|
@ -26,6 +26,11 @@ class TestDriver(private val secondLength: Duration) : ActiveDriver() { |
|
|
|
) |
|
|
|
|
|
|
|
override suspend fun onCommand(command: Command, output: FlowBus<Event>) { |
|
|
|
if (!connected && command !is ConnectCommand) { |
|
|
|
// Don't interfere with other drivers |
|
|
|
return |
|
|
|
} |
|
|
|
|
|
|
|
log.info("Received command: $command") |
|
|
|
val ev = when (command) { |
|
|
|
is ConnectCommand -> { |
|
|
@ -56,8 +61,8 @@ class TestDriver(private val secondLength: Duration) : ActiveDriver() { |
|
|
|
|
|
|
|
SkipCommand -> null |
|
|
|
|
|
|
|
StartCommand -> if (connected) Started.also { running = true } else null |
|
|
|
StopCommand -> if (connected) Stopped.also { running = false } else null |
|
|
|
StartCommand -> Started.also { running = true } |
|
|
|
StopCommand -> Stopped.also { running = false } |
|
|
|
} |
|
|
|
|
|
|
|
ev?.let { output.emit(it) } |
|
|
|