process images cleanup

This commit is contained in:
Alexander Nozik 2023-06-05 17:12:01 +03:00
parent 166cc03fe2
commit bfeeed00d5
2 changed files with 7 additions and 2 deletions

View File

@ -3,6 +3,7 @@ package space.kscience.controls.ports
import kotlinx.coroutines.*
import space.kscience.dataforge.context.Context
import space.kscience.dataforge.context.error
import space.kscience.dataforge.context.info
import space.kscience.dataforge.context.logger
import space.kscience.dataforge.meta.*
import java.net.InetSocketAddress
@ -118,6 +119,7 @@ public object UdpPort : PortFactory {
localPort?.let { bind(InetSocketAddress(localHost, localPort)) }
//connect to remote port to send messages
connect(InetSocketAddress(remoteHost, remotePort))
context.logger.info { "Connected to UDP $remotePort on $remoteHost" }
}
}

View File

@ -45,7 +45,7 @@ public class DeviceToModbusMapping<D : Device> private constructor(
}
}
public fun <D: Device> DeviceToModbusMapping(block: DeviceToModbusMapping.Builder<D>.()->Unit): DeviceToModbusMapping<D> =
public inline fun <D: Device> DeviceToModbusMapping(block: DeviceToModbusMapping.Builder<D>.()->Unit): DeviceToModbusMapping<D> =
DeviceToModbusMapping.Builder<D>().apply(block).build()
@Suppress("UNCHECKED_CAST")
@ -143,3 +143,6 @@ public fun <D : Device> D.toProcessImage(mapping: DeviceToModbusMapping<D>): Pro
}
return image
}
public inline fun <D : Device> D.toProcessImage(block: DeviceToModbusMapping.Builder<D>.()->Unit): ProcessImage =
toProcessImage(DeviceToModbusMapping(block))