18 lines
576 B
Kotlin
18 lines
576 B
Kotlin
import kotlinx.coroutines.GlobalScope
|
|
import kotlinx.coroutines.delay
|
|
import kotlinx.coroutines.launch
|
|
import kotlinx.coroutines.runBlocking
|
|
|
|
fun main() = runBlocking{
|
|
GlobalScope.launch {
|
|
val mqtt = MqttSubscriber()
|
|
mqtt.connect()
|
|
val waitTime = System.getenv("WAITTIME").toLong()
|
|
delay(waitTime)
|
|
val resultMap = mqtt.disconnect()
|
|
val resultProcessor = ProcessResults()
|
|
resultProcessor.mapToProcess=resultMap
|
|
resultProcessor.process()
|
|
}
|
|
delay(System.getenv("WAITTIME").toLong()*2)
|
|
} |