Compare commits
3 Commits
f1b63c3951
...
290010fc8c
Author | SHA1 | Date | |
---|---|---|---|
290010fc8c | |||
80cc62e25b | |||
aef94767c5 |
@ -7,6 +7,7 @@ plugins {
|
|||||||
}
|
}
|
||||||
|
|
||||||
val dataforgeVersion: String by extra("0.6.2")
|
val dataforgeVersion: String by extra("0.6.2")
|
||||||
|
val visionforgeVersion by extra("0.3.0-dev-10")
|
||||||
val ktorVersion: String by extra(space.kscience.gradle.KScienceVersions.ktorVersion)
|
val ktorVersion: String by extra(space.kscience.gradle.KScienceVersions.ktorVersion)
|
||||||
val rsocketVersion by extra("0.15.4")
|
val rsocketVersion by extra("0.15.4")
|
||||||
val xodusVersion by extra("2.0.1")
|
val xodusVersion by extra("2.0.1")
|
||||||
|
@ -12,7 +12,7 @@ import kotlin.reflect.KMutableProperty1
|
|||||||
import kotlin.reflect.KProperty
|
import kotlin.reflect.KProperty
|
||||||
import kotlin.reflect.KProperty1
|
import kotlin.reflect.KProperty1
|
||||||
|
|
||||||
public object UnitMetaConverter: MetaConverter<Unit>{
|
public object UnitMetaConverter : MetaConverter<Unit> {
|
||||||
override fun metaToObject(meta: Meta): Unit = Unit
|
override fun metaToObject(meta: Meta): Unit = Unit
|
||||||
|
|
||||||
override fun objectToMeta(obj: Unit): Meta = Meta.EMPTY
|
override fun objectToMeta(obj: Unit): Meta = Meta.EMPTY
|
||||||
@ -127,7 +127,8 @@ public abstract class DeviceSpec<D : Device> {
|
|||||||
PropertyDelegateProvider { _: DeviceSpec<D>, property: KProperty<*> ->
|
PropertyDelegateProvider { _: DeviceSpec<D>, property: KProperty<*> ->
|
||||||
val propertyName = name ?: property.name
|
val propertyName = name ?: property.name
|
||||||
val deviceProperty = object : WritableDevicePropertySpec<D, T> {
|
val deviceProperty = object : WritableDevicePropertySpec<D, T> {
|
||||||
override val descriptor: PropertyDescriptor = PropertyDescriptor(propertyName).apply(descriptorBuilder)
|
override val descriptor: PropertyDescriptor = PropertyDescriptor(propertyName, writable = true)
|
||||||
|
.apply(descriptorBuilder)
|
||||||
override val converter: MetaConverter<T> = converter
|
override val converter: MetaConverter<T> = converter
|
||||||
|
|
||||||
override suspend fun read(device: D): T? = withContext(device.coroutineContext) { device.read() }
|
override suspend fun read(device: D): T? = withContext(device.coroutineContext) { device.read() }
|
||||||
|
@ -57,15 +57,15 @@ fun CoroutineScope.startDemoDeviceServer(magixEndpoint: MagixEndpoint): Applicat
|
|||||||
//share subscription to a parse message only once
|
//share subscription to a parse message only once
|
||||||
val subscription = magixEndpoint.subscribe(DeviceManager.magixFormat).shareIn(this, SharingStarted.Lazily)
|
val subscription = magixEndpoint.subscribe(DeviceManager.magixFormat).shareIn(this, SharingStarted.Lazily)
|
||||||
|
|
||||||
val sinFlow = subscription.mapNotNull { (_, payload) ->
|
val sinFlow = subscription.mapNotNull { (_, payload) ->
|
||||||
(payload as? PropertyChangedMessage)?.takeIf { it.property == DemoDevice.sin.name }
|
(payload as? PropertyChangedMessage)?.takeIf { it.property == DemoDevice.sin.name }
|
||||||
}.map { it.value }
|
}.map { it.value }
|
||||||
|
|
||||||
val cosFlow = subscription.mapNotNull { (_, payload) ->
|
val cosFlow = subscription.mapNotNull { (_, payload) ->
|
||||||
(payload as? PropertyChangedMessage)?.takeIf { it.property == DemoDevice.cos.name }
|
(payload as? PropertyChangedMessage)?.takeIf { it.property == DemoDevice.cos.name }
|
||||||
}.map { it.value }
|
}.map { it.value }
|
||||||
|
|
||||||
val sinCosFlow = subscription.mapNotNull { (_, payload) ->
|
val sinCosFlow = subscription.mapNotNull { (_, payload) ->
|
||||||
(payload as? PropertyChangedMessage)?.takeIf { it.property == DemoDevice.coordinates.name }
|
(payload as? PropertyChangedMessage)?.takeIf { it.property == DemoDevice.coordinates.name }
|
||||||
}.map { it.value }
|
}.map { it.value }
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user