Upgrade versions

This commit is contained in:
Alexander Nozik 2021-04-05 17:41:36 +03:00
parent cb22374da5
commit bf51768fe1
66 changed files with 312 additions and 283 deletions

View File

@ -1,10 +1,10 @@
plugins {
id("ru.mipt.npm.project")
id("ru.mipt.npm.gradle.project")
kotlin("jvm") apply false
kotlin("js") apply false
}
val dataforgeVersion: String by extra("0.3.0")
val dataforgeVersion: String by extra("0.4.0-dev-2")
val ktorVersion: String by extra(ru.mipt.npm.gradle.KScienceVersions.ktorVersion)
val rsocketVersion by extra("0.12.0")
@ -12,6 +12,7 @@ allprojects {
repositories {
mavenLocal()
//maven("http://maven.jzy3d.org/releases")
maven(url = "https://maven.pkg.jetbrains.space/public/p/kotlinx-html/maven")
maven("https://kotlin.bintray.com/js-externals")
maven("https://dl.bintray.com/rsocket-admin/RSocket")
//maven("https://maven.pkg.github.com/altavir/ktor-client-sse")
@ -22,8 +23,7 @@ allprojects {
}
ksciencePublish {
githubProject = "controls.kt"
bintrayRepo = "kscience"
github("controls.kt")
}
apiValidation {

View File

@ -1,6 +1,6 @@
plugins {
id("ru.mipt.npm.mpp")
id("ru.mipt.npm.publish")
id("ru.mipt.npm.gradle.mpp")
`maven-publish`
}
val dataforgeVersion: String by rootProject.extra
@ -16,7 +16,7 @@ kotlin {
sourceSets {
commonMain{
dependencies {
api("hep.dataforge:dataforge-io:$dataforgeVersion")
api("space.kscience:dataforge-io:$dataforgeVersion")
}
}
}

View File

@ -1,14 +1,15 @@
package hep.dataforge.control.api
package space.kscience.dataforge.control.api
import hep.dataforge.context.ContextAware
import hep.dataforge.control.api.Device.Companion.DEVICE_TARGET
import hep.dataforge.meta.Meta
import hep.dataforge.meta.MetaItem
import hep.dataforge.misc.Type
import io.ktor.utils.io.core.Closeable
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.cancel
import kotlinx.coroutines.flow.SharedFlow
import kotlinx.io.Closeable
import space.kscience.dataforge.context.ContextAware
import space.kscience.dataforge.control.api.Device.Companion.DEVICE_TARGET
import space.kscience.dataforge.meta.Meta
import space.kscience.dataforge.meta.MetaItem
import space.kscience.dataforge.misc.Type
/**
* General interface describing a managed Device

View File

@ -1,8 +1,8 @@
package hep.dataforge.control.api
package space.kscience.dataforge.control.api
import hep.dataforge.meta.MetaItem
import hep.dataforge.names.*
import hep.dataforge.provider.Provider
import space.kscience.dataforge.meta.MetaItem
import space.kscience.dataforge.names.*
import space.kscience.dataforge.provider.Provider
/**
* A hub that could locate multiple devices and redirect actions to them

View File

@ -1,11 +1,11 @@
package hep.dataforge.control.api
package space.kscience.dataforge.control.api
import io.ktor.utils.io.core.Closeable
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Job
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.collect
import kotlinx.coroutines.launch
import kotlinx.io.Closeable
/**
* A generic bi-directional sender/receiver object

View File

@ -1,7 +1,7 @@
package hep.dataforge.control.api
package space.kscience.dataforge.control.api
import hep.dataforge.meta.Scheme
import hep.dataforge.meta.string
import space.kscience.dataforge.meta.Scheme
import space.kscience.dataforge.meta.string
/**
* A descriptor for property

View File

@ -1,9 +1,9 @@
package hep.dataforge.control.base
package space.kscience.dataforge.control.base
import hep.dataforge.control.api.ActionDescriptor
import hep.dataforge.meta.Meta
import hep.dataforge.meta.MetaItem
import hep.dataforge.meta.asMetaItem
import space.kscience.dataforge.control.api.ActionDescriptor
import space.kscience.dataforge.meta.Meta
import space.kscience.dataforge.meta.MetaItem
import space.kscience.dataforge.meta.asMetaItem
public interface DeviceAction {
public val name: String

View File

@ -1,11 +1,5 @@
package hep.dataforge.control.base
package space.kscience.dataforge.control.base
import hep.dataforge.context.Context
import hep.dataforge.control.api.ActionDescriptor
import hep.dataforge.control.api.Device
import hep.dataforge.control.api.PropertyDescriptor
import hep.dataforge.meta.MetaItem
import hep.dataforge.misc.DFExperimental
import kotlinx.coroutines.*
import kotlinx.coroutines.flow.MutableSharedFlow
import kotlinx.coroutines.flow.MutableStateFlow
@ -13,6 +7,12 @@ import kotlinx.coroutines.flow.SharedFlow
import kotlinx.coroutines.flow.StateFlow
import kotlinx.coroutines.sync.Mutex
import kotlinx.coroutines.sync.withLock
import space.kscience.dataforge.context.Context
import space.kscience.dataforge.control.api.ActionDescriptor
import space.kscience.dataforge.control.api.Device
import space.kscience.dataforge.control.api.PropertyDescriptor
import space.kscience.dataforge.meta.MetaItem
import space.kscience.dataforge.misc.DFExperimental
//TODO move to DataForge-core
@DFExperimental

View File

@ -1,9 +1,9 @@
package hep.dataforge.control.base
package space.kscience.dataforge.control.base
import hep.dataforge.control.api.PropertyDescriptor
import hep.dataforge.meta.MetaItem
import kotlinx.coroutines.*
import kotlinx.coroutines.flow.Flow
import space.kscience.dataforge.control.api.PropertyDescriptor
import space.kscience.dataforge.meta.MetaItem
import kotlin.time.Duration
/**

View File

@ -1,9 +1,9 @@
package hep.dataforge.control.base
package space.kscience.dataforge.control.base
import hep.dataforge.meta.MetaItem
import hep.dataforge.meta.transformations.MetaConverter
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.map
import space.kscience.dataforge.meta.MetaItem
import space.kscience.dataforge.meta.transformations.MetaConverter
/**
* A type-safe wrapper on top of read-only property

View File

@ -1,11 +1,11 @@
package hep.dataforge.control.base
package space.kscience.dataforge.control.base
import hep.dataforge.control.api.ActionDescriptor
import hep.dataforge.meta.MetaBuilder
import hep.dataforge.meta.MetaItem
import hep.dataforge.meta.MetaItemNode
import hep.dataforge.meta.MetaItemValue
import hep.dataforge.values.Value
import space.kscience.dataforge.control.api.ActionDescriptor
import space.kscience.dataforge.meta.MetaBuilder
import space.kscience.dataforge.meta.MetaItem
import space.kscience.dataforge.meta.MetaItemNode
import space.kscience.dataforge.meta.MetaItemValue
import space.kscience.dataforge.values.Value
import kotlin.properties.PropertyDelegateProvider
import kotlin.properties.ReadOnlyProperty
import kotlin.reflect.KProperty

View File

@ -1,11 +1,11 @@
package hep.dataforge.control.base
package space.kscience.dataforge.control.base
import hep.dataforge.control.api.PropertyDescriptor
import hep.dataforge.meta.*
import hep.dataforge.meta.transformations.MetaConverter
import hep.dataforge.values.Null
import hep.dataforge.values.Value
import hep.dataforge.values.asValue
import space.kscience.dataforge.control.api.PropertyDescriptor
import space.kscience.dataforge.meta.*
import space.kscience.dataforge.meta.transformations.MetaConverter
import space.kscience.dataforge.values.Null
import space.kscience.dataforge.values.Value
import space.kscience.dataforge.values.asValue
import kotlin.properties.PropertyDelegateProvider
import kotlin.properties.ReadOnlyProperty
import kotlin.reflect.KProperty

View File

@ -1,9 +1,9 @@
package hep.dataforge.control.base
package space.kscience.dataforge.control.base
import hep.dataforge.meta.*
import hep.dataforge.meta.transformations.MetaConverter
import hep.dataforge.values.asValue
import hep.dataforge.values.double
import space.kscience.dataforge.meta.*
import space.kscience.dataforge.meta.transformations.MetaConverter
import space.kscience.dataforge.values.asValue
import space.kscience.dataforge.values.double
import kotlin.time.Duration
import kotlin.time.DurationUnit
import kotlin.time.toDuration

View File

@ -1,16 +1,16 @@
package hep.dataforge.control.controllers
package space.kscience.dataforge.control.controllers
import hep.dataforge.control.api.Device
import hep.dataforge.control.api.DeviceHub
import hep.dataforge.control.api.get
import hep.dataforge.control.messages.*
import hep.dataforge.meta.Meta
import hep.dataforge.meta.MetaItem
import hep.dataforge.misc.DFExperimental
import hep.dataforge.names.Name
import hep.dataforge.names.toName
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.map
import space.kscience.dataforge.control.api.Device
import space.kscience.dataforge.control.api.DeviceHub
import space.kscience.dataforge.control.api.get
import space.kscience.dataforge.control.messages.*
import space.kscience.dataforge.meta.Meta
import space.kscience.dataforge.meta.MetaItem
import space.kscience.dataforge.misc.DFExperimental
import space.kscience.dataforge.names.Name
import space.kscience.dataforge.names.toName
/**
* The [DeviceController] wraps device operations in [DeviceMessage]

View File

@ -1,14 +1,14 @@
package hep.dataforge.control.controllers
package space.kscience.dataforge.control.controllers
import hep.dataforge.context.*
import hep.dataforge.control.api.Device
import hep.dataforge.control.api.DeviceHub
import hep.dataforge.meta.Meta
import hep.dataforge.meta.MetaBuilder
import hep.dataforge.meta.get
import hep.dataforge.meta.string
import hep.dataforge.names.Name
import hep.dataforge.names.NameToken
import space.kscience.dataforge.context.*
import space.kscience.dataforge.control.api.Device
import space.kscience.dataforge.control.api.DeviceHub
import space.kscience.dataforge.meta.Meta
import space.kscience.dataforge.meta.MetaBuilder
import space.kscience.dataforge.meta.get
import space.kscience.dataforge.meta.string
import space.kscience.dataforge.names.Name
import space.kscience.dataforge.names.NameToken
import kotlin.properties.ReadOnlyProperty
import kotlin.reflect.KClass

View File

@ -1,14 +1,14 @@
package hep.dataforge.control.controllers
package space.kscience.dataforge.control.controllers
import hep.dataforge.control.api.DeviceHub
import hep.dataforge.control.api.get
import hep.dataforge.control.messages.DeviceMessage
import hep.dataforge.misc.DFExperimental
import hep.dataforge.names.Name
import hep.dataforge.names.toName
import kotlinx.coroutines.channels.Channel
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.consumeAsFlow
import space.kscience.dataforge.control.api.DeviceHub
import space.kscience.dataforge.control.api.get
import space.kscience.dataforge.control.messages.DeviceMessage
import space.kscience.dataforge.misc.DFExperimental
import space.kscience.dataforge.names.Name
import space.kscience.dataforge.names.toName
@OptIn(DFExperimental::class)

View File

@ -1,12 +1,12 @@
package hep.dataforge.control.messages
package space.kscience.dataforge.control.messages
import hep.dataforge.io.SimpleEnvelope
import hep.dataforge.meta.*
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
import kotlinx.serialization.json.Json
import kotlinx.serialization.json.decodeFromJsonElement
import kotlinx.serialization.json.encodeToJsonElement
import space.kscience.dataforge.io.SimpleEnvelope
import space.kscience.dataforge.meta.*
@Serializable
public sealed class DeviceMessage {

View File

@ -1,14 +1,11 @@
package hep.dataforge.control.ports
package space.kscience.dataforge.control.ports
import hep.dataforge.context.Context
import hep.dataforge.context.ContextAware
import hep.dataforge.context.Factory
import hep.dataforge.context.logger
import hep.dataforge.control.api.Socket
import kotlinx.coroutines.*
import kotlinx.coroutines.channels.Channel
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.receiveAsFlow
import space.kscience.dataforge.context.*
import space.kscience.dataforge.control.api.Socket
import kotlin.coroutines.CoroutineContext
public interface Port : ContextAware, Socket<ByteArray>

View File

@ -1,9 +1,5 @@
package hep.dataforge.control.ports
package space.kscience.dataforge.control.ports
import hep.dataforge.context.Context
import hep.dataforge.context.ContextAware
import hep.dataforge.context.Global
import hep.dataforge.context.logger
import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.collect
@ -11,6 +7,7 @@ import kotlinx.coroutines.flow.flow
import kotlinx.coroutines.launch
import kotlinx.coroutines.sync.Mutex
import kotlinx.coroutines.sync.withLock
import space.kscience.dataforge.context.*
/**
* A port that could be closed multiple times and opens automatically on request
@ -45,7 +42,7 @@ public class PortProxy(override val context: Context = Global, public val factor
emit(it)
}
} catch (t: Throwable) {
logger.warn(t){"Port read failed. Reconnecting."}
logger.warn{"Port read failed: ${t.message}. Reconnecting."}
mutex.withLock {
actualPort?.close()
actualPort = null

View File

@ -1,4 +1,4 @@
package hep.dataforge.control.ports
package space.kscience.dataforge.control.ports
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.first

View File

@ -1,9 +1,11 @@
package hep.dataforge.control.ports
package space.kscience.dataforge.control.ports
import io.ktor.utils.io.core.BytePacketBuilder
import io.ktor.utils.io.core.readBytes
import io.ktor.utils.io.core.reset
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.map
import kotlinx.coroutines.flow.transform
import kotlinx.io.ByteArrayOutput
/**
* Transform byte fragments into complete phrases using given delimiter. Not thread safe.
@ -11,7 +13,7 @@ import kotlinx.io.ByteArrayOutput
public fun Flow<ByteArray>.withDelimiter(delimiter: ByteArray, expectedMessageSize: Int = 32): Flow<ByteArray> {
require(delimiter.isNotEmpty()) { "Delimiter must not be empty" }
var output = ByteArrayOutput(expectedMessageSize)
val output = BytePacketBuilder(expectedMessageSize)
var matcherPosition = 0
return transform { chunk ->
@ -22,8 +24,9 @@ public fun Flow<ByteArray>.withDelimiter(delimiter: ByteArray, expectedMessageSi
matcherPosition++
if (matcherPosition == delimiter.size) {
//full match achieved, sending result
emit(output.toByteArray())
output = ByteArrayOutput(expectedMessageSize)
val bytes = output.build()
emit(bytes.readBytes())
output.reset()
matcherPosition = 0
}
} else if (matcherPosition > 0) {

View File

@ -1,9 +1,9 @@
package hep.dataforge.control.controllers
package space.kscience.dataforge.control.controllers
import hep.dataforge.control.base.*
import hep.dataforge.meta.MetaItem
import hep.dataforge.meta.transformations.MetaConverter
import kotlinx.coroutines.runBlocking
import space.kscience.dataforge.control.base.*
import space.kscience.dataforge.meta.MetaItem
import space.kscience.dataforge.meta.transformations.MetaConverter
import kotlin.properties.ReadOnlyProperty
import kotlin.properties.ReadWriteProperty
import kotlin.reflect.KProperty

View File

@ -1,12 +1,13 @@
package hep.dataforge.control.ports
package space.kscience.dataforge.control.ports
import hep.dataforge.context.Context
import hep.dataforge.context.logger
import hep.dataforge.meta.Meta
import hep.dataforge.meta.get
import hep.dataforge.meta.int
import hep.dataforge.meta.string
import kotlinx.coroutines.*
import space.kscience.dataforge.context.Context
import space.kscience.dataforge.context.error
import space.kscience.dataforge.context.logger
import space.kscience.dataforge.meta.Meta
import space.kscience.dataforge.meta.get
import space.kscience.dataforge.meta.int
import space.kscience.dataforge.meta.string
import java.net.InetSocketAddress
import java.nio.ByteBuffer
import java.nio.channels.SocketChannel
@ -51,7 +52,7 @@ public class TcpPort private constructor(
}
if (num < 0) cancel("The input channel is exhausted")
} catch (ex: Exception) {
logger.error("Channel read error", ex)
logger.error(ex){"Channel read error"}
delay(1000)
}
}

View File

@ -1,4 +1,4 @@
package hep.dataforge.control.ports
package space.kscience.dataforge.control.ports
import kotlinx.coroutines.flow.flowOf
import kotlinx.coroutines.flow.map

View File

@ -1,6 +1,6 @@
plugins {
id("ru.mipt.npm.mpp")
id("ru.mipt.npm.publish")
id("ru.mipt.npm.gradle.mpp")
`maven-publish`
}
kscience{

View File

@ -1,4 +1,4 @@
package hep.dataforge.control.client
package space.kscience.dataforge.control.client
public sealed class TangoPayload(
val host: String,

View File

@ -1,17 +1,18 @@
package hep.dataforge.control.client
package space.kscience.dataforge.control.client
import hep.dataforge.context.logger
import hep.dataforge.control.controllers.DeviceManager
import hep.dataforge.control.controllers.respondMessage
import hep.dataforge.control.messages.DeviceMessage
import hep.dataforge.magix.api.MagixEndpoint
import hep.dataforge.magix.api.MagixMessage
import hep.dataforge.magix.api.MagixProcessor
import kotlinx.coroutines.Job
import kotlinx.coroutines.flow.catch
import kotlinx.coroutines.flow.launchIn
import kotlinx.coroutines.flow.onEach
import kotlinx.coroutines.launch
import space.kscience.dataforge.context.error
import space.kscience.dataforge.context.logger
import space.kscience.dataforge.control.controllers.DeviceManager
import space.kscience.dataforge.control.controllers.respondMessage
import space.kscience.dataforge.control.messages.DeviceMessage
import space.kscience.dataforge.magix.api.MagixEndpoint
import space.kscience.dataforge.magix.api.MagixMessage
import space.kscience.dataforge.magix.api.MagixProcessor
public const val DATAFORGE_MAGIX_FORMAT: String = "dataforge"

View File

@ -1,6 +1,6 @@
plugins {
id("ru.mipt.npm.jvm")
id("ru.mipt.npm.publish")
id("ru.mipt.npm.gradle.jvm")
`maven-publish`
}
dependencies{

View File

@ -1,14 +1,14 @@
package hep.dataforge.control.serial
package space.kscience.dataforge.control.serial
import hep.dataforge.context.Context
import hep.dataforge.control.ports.AbstractPort
import hep.dataforge.control.ports.Port
import hep.dataforge.control.ports.PortFactory
import hep.dataforge.meta.Meta
import hep.dataforge.meta.int
import hep.dataforge.meta.string
import jssc.SerialPort.*
import jssc.SerialPortEventListener
import space.kscience.dataforge.context.Context
import space.kscience.dataforge.control.ports.AbstractPort
import space.kscience.dataforge.control.ports.Port
import space.kscience.dataforge.control.ports.PortFactory
import space.kscience.dataforge.meta.Meta
import space.kscience.dataforge.meta.int
import space.kscience.dataforge.meta.string
import kotlin.coroutines.CoroutineContext
import jssc.SerialPort as JSSCPort

View File

@ -1,10 +1,10 @@
plugins {
id("ru.mipt.npm.jvm")
id("ru.mipt.npm.publish")
id("ru.mipt.npm.gradle.jvm")
`maven-publish`
}
val dataforgeVersion: String by rootProject.extra
val ktorVersion: String by rootProject.extra
val ktorVersion: String = "1.5.3"
dependencies{
implementation(project(":controls-core"))

View File

@ -1,17 +1,16 @@
package hep.dataforge.control.server
package space.kscience.dataforge.control.server
import hep.dataforge.control.messages.DeviceMessage
import hep.dataforge.control.messages.toMeta
import hep.dataforge.io.*
import hep.dataforge.meta.MetaSerializer
import io.ktor.application.ApplicationCall
import io.ktor.http.ContentType
import io.ktor.http.cio.websocket.Frame
import io.ktor.response.respondText
import kotlinx.io.asBinary
import kotlinx.serialization.json.Json
import kotlinx.serialization.json.JsonObjectBuilder
import kotlinx.serialization.json.buildJsonObject
import space.kscience.dataforge.control.messages.DeviceMessage
import space.kscience.dataforge.control.messages.toMeta
import space.kscience.dataforge.io.*
import space.kscience.dataforge.meta.MetaSerializer
internal fun Frame.toEnvelope(): Envelope {

View File

@ -1,17 +1,8 @@
@file:OptIn(ExperimentalCoroutinesApi::class, KtorExperimentalAPI::class, FlowPreview::class)
package hep.dataforge.control.server
package space.kscience.dataforge.control.server
import hep.dataforge.control.api.get
import hep.dataforge.control.controllers.DeviceManager
import hep.dataforge.control.controllers.respondMessage
import hep.dataforge.control.messages.DeviceMessage
import hep.dataforge.control.messages.PropertyGetMessage
import hep.dataforge.control.messages.PropertySetMessage
import hep.dataforge.meta.toJson
import hep.dataforge.meta.toMeta
import hep.dataforge.meta.toMetaItem
import io.ktor.application.*
import io.ktor.features.CORS
import io.ktor.features.StatusPages
@ -38,6 +29,15 @@ import kotlinx.serialization.json.Json
import kotlinx.serialization.json.JsonObject
import kotlinx.serialization.json.buildJsonArray
import kotlinx.serialization.json.put
import space.kscience.dataforge.control.api.get
import space.kscience.dataforge.control.controllers.DeviceManager
import space.kscience.dataforge.control.controllers.respondMessage
import space.kscience.dataforge.control.messages.DeviceMessage
import space.kscience.dataforge.control.messages.PropertyGetMessage
import space.kscience.dataforge.control.messages.PropertySetMessage
import space.kscience.dataforge.meta.toJson
import space.kscience.dataforge.meta.toMeta
import space.kscience.dataforge.meta.toMetaItem
/**
* Create and start a web server for several devices

View File

@ -1,5 +1,5 @@
plugins {
id("ru.mipt.npm.mpp")
id("ru.mipt.npm.gradle.mpp")
}
val ktorVersion: String by rootProject.extra

View File

@ -1,10 +1,5 @@
package hep.dataforge.control.ports
package space.kscience.dataforge.control.ports
import hep.dataforge.context.Context
import hep.dataforge.meta.Meta
import hep.dataforge.meta.get
import hep.dataforge.meta.int
import hep.dataforge.meta.string
import io.ktor.network.selector.ActorSelectorManager
import io.ktor.network.sockets.aSocket
import io.ktor.network.sockets.openReadChannel
@ -17,6 +12,11 @@ import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.async
import kotlinx.coroutines.isActive
import kotlinx.coroutines.launch
import space.kscience.dataforge.context.Context
import space.kscience.dataforge.meta.Meta
import space.kscience.dataforge.meta.get
import space.kscience.dataforge.meta.int
import space.kscience.dataforge.meta.string
import java.net.InetSocketAddress
import kotlin.coroutines.CoroutineContext

View File

@ -6,14 +6,10 @@ plugins {
repositories{
mavenLocal()
mavenCentral()
jcenter()
maven("https://repo.kotlin.link")
maven("https://kotlin.bintray.com/kotlinx")
maven("https://dl.bintray.com/kotlin/kotlin-eap")
maven("https://dl.bintray.com/mipt-npm/dataforge")
maven("https://dl.bintray.com/mipt-npm/scientifik")
maven("https://dl.bintray.com/mipt-npm/kscience")
maven("https://dl.bintray.com/mipt-npm/dev")
}
dependencies{
@ -21,9 +17,7 @@ dependencies{
implementation(project(":controls-server"))
implementation(project(":controls-magix-client"))
implementation("no.tornado:tornadofx:1.7.20")
implementation(kotlin("stdlib-jdk8"))
implementation("kscience.plotlykt:plotlykt-server:0.3.0")
implementation("space.kscience:plotlykt-server:0.4.0-dev-2")
implementation("com.github.Ricky12Awesome:json-schema-serialization:0.6.6")
}
@ -39,5 +33,5 @@ javafx{
}
application{
mainClass.set("hep.dataforge.control.demo.DemoControllerViewKt")
mainClass.set("space.kscience.dataforge.control.demo.DemoControllerViewKt")
}

View File

@ -1,14 +1,15 @@
package hep.dataforge.control.demo
package space.kscience.dataforge.control.demo
import hep.dataforge.context.ContextAware
import hep.dataforge.context.Global
import hep.dataforge.context.logger
import io.ktor.server.engine.ApplicationEngine
import javafx.scene.Parent
import javafx.scene.control.Slider
import javafx.scene.layout.Priority
import javafx.stage.Stage
import kotlinx.coroutines.launch
import space.kscience.dataforge.context.ContextAware
import space.kscience.dataforge.context.Global
import space.kscience.dataforge.context.info
import space.kscience.dataforge.context.logger
import tornadofx.*
import java.awt.Desktop
import java.net.URI
@ -28,11 +29,11 @@ class DemoController : Controller(), ContextAware {
}
fun shutdown() {
logger.info("Shutting down...")
logger.info { "Shutting down..." }
server?.stop(1000, 5000)
logger.info("Visualization server stopped")
logger.info { "Visualization server stopped" }
device?.close()
logger.info("Device server stopped")
logger.info { "Device server stopped" }
context.close()
}
}

View File

@ -1,14 +1,14 @@
package hep.dataforge.control.demo
package space.kscience.dataforge.control.demo
import hep.dataforge.context.Context
import hep.dataforge.context.Factory
import hep.dataforge.control.base.*
import hep.dataforge.control.controllers.double
import hep.dataforge.meta.Meta
import hep.dataforge.values.asValue
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Job
import kotlinx.coroutines.asCoroutineDispatcher
import space.kscience.dataforge.context.Context
import space.kscience.dataforge.context.Factory
import space.kscience.dataforge.control.base.*
import space.kscience.dataforge.control.controllers.double
import space.kscience.dataforge.meta.Meta
import space.kscience.dataforge.values.asValue
import java.time.Instant
import java.util.concurrent.Executors
import kotlin.math.cos

View File

@ -1,22 +1,22 @@
package hep.dataforge.control.demo
package space.kscience.dataforge.control.demo
import hep.dataforge.context.Context
import hep.dataforge.control.controllers.devices
import hep.dataforge.control.server.startDeviceServer
import hep.dataforge.control.server.whenStarted
import hep.dataforge.meta.double
import hep.dataforge.names.NameToken
import io.ktor.server.engine.ApplicationEngine
import kotlinx.coroutines.flow.*
import kotlinx.coroutines.launch
import kotlinx.html.div
import kotlinx.html.link
import kscience.plotly.layout
import kscience.plotly.models.Trace
import kscience.plotly.plot
import kscience.plotly.server.PlotlyUpdateMode
import kscience.plotly.server.plotlyModule
import kscience.plotly.trace
import space.kscience.dataforge.context.Context
import space.kscience.dataforge.control.controllers.devices
import space.kscience.dataforge.control.server.startDeviceServer
import space.kscience.dataforge.control.server.whenStarted
import space.kscience.dataforge.meta.double
import space.kscience.dataforge.names.NameToken
import space.kscience.plotly.layout
import space.kscience.plotly.models.Trace
import space.kscience.plotly.plot
import space.kscience.plotly.server.PlotlyUpdateMode
import space.kscience.plotly.server.plotlyModule
import space.kscience.plotly.trace
import java.util.concurrent.ConcurrentLinkedQueue
/**

View File

@ -1,8 +1,8 @@
package hep.dataforge.control.demo
package space.kscience.dataforge.control.demo
import com.github.ricky12awesome.jss.encodeToSchema
import com.github.ricky12awesome.jss.globalJson
import hep.dataforge.control.messages.DeviceMessage
import space.kscience.dataforge.control.messages.DeviceMessage
fun main() {
val schema = globalJson.encodeToSchema(DeviceMessage.serializer(), generateDefinitions = false)

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

View File

@ -0,0 +1,18 @@
@startuml
title Transform asynchronous to synchronous
participant Synchronous
participant Adapter
participant Asynchronous
activate Adapter
Asynchronous -> Adapter: message with ID
Adapter -> Synchronous
activate Synchronous
hnote over Adapter : create a waiting thread
Synchronous -> Adapter
deactivate Synchronous
Adapter -> Asynchronous: message with ID
@enduml

View File

@ -1,6 +1,8 @@
@startuml
title Simple call with callback
Main -> Async: call
activate Main
activate Async
Async -> Main: result

View File

@ -0,0 +1,23 @@
@startuml
title Transform synchronous to asynchronous
participant Synchronous
participant Adapter
participant Asynchronous
activate Synchronous
Synchronous -> Adapter: call and block
deactivate Synchronous
activate Adapter
Adapter -> Asynchronous: message with ID
hnote over Adapter : create a waiting thread
Asynchronous -> Adapter: message with ID
Adapter -> Synchronous: return result
deactivate Adapter
activate Synchronous
@enduml

View File

@ -1,6 +1,6 @@
plugins {
id("ru.mipt.npm.mpp")
id("ru.mipt.npm.publish")
id("ru.mipt.npm.gradle.mpp")
`maven-publish`
}
kscience {
@ -10,6 +10,3 @@ kscience {
}
}
val dataforgeVersion: String by rootProject.extra
val ktorVersion: String by rootProject.extra

View File

@ -1,4 +1,4 @@
package hep.dataforge.magix.api
package space.kscience.dataforge.magix.api
import kotlinx.coroutines.flow.Flow
import kotlinx.serialization.KSerializer

View File

@ -1,4 +1,4 @@
package hep.dataforge.magix.api
package space.kscience.dataforge.magix.api
import kotlinx.serialization.Serializable
import kotlinx.serialization.json.JsonElement

View File

@ -1,4 +1,4 @@
package hep.dataforge.magix.api
package space.kscience.dataforge.magix.api
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.filter

View File

@ -1,4 +1,4 @@
package hep.dataforge.magix.api
package space.kscience.dataforge.magix.api
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Job

View File

@ -1,7 +1,7 @@
plugins {
java
id("ru.mipt.npm.jvm")
id("ru.mipt.npm.publish")
id("ru.mipt.npm.gradle.jvm")
`maven-publish`
}
dependencies {

View File

@ -1,7 +1,7 @@
package ru.mipt.npm.magix.client;
import hep.dataforge.magix.api.MagixMessage;
import kotlinx.serialization.json.JsonElement;
import space.kscience.dataforge.magix.api.MagixMessage;
import java.io.IOException;
import java.util.concurrent.Flow;

View File

@ -1,14 +1,14 @@
package ru.mipt.npm.magix.client
import hep.dataforge.magix.api.MagixEndpoint
import hep.dataforge.magix.api.MagixMessage
import hep.dataforge.magix.api.MagixMessageFilter
import hep.dataforge.magix.service.RSocketMagixEndpoint
import hep.dataforge.magix.service.withTcp
import kotlinx.coroutines.jdk9.asPublisher
import kotlinx.coroutines.runBlocking
import kotlinx.serialization.KSerializer
import kotlinx.serialization.json.JsonElement
import space.kscience.dataforge.magix.api.MagixEndpoint
import space.kscience.dataforge.magix.api.MagixMessage
import space.kscience.dataforge.magix.api.MagixMessageFilter
import space.kscience.dataforge.magix.service.RSocketMagixEndpoint
import space.kscience.dataforge.magix.service.withTcp
import java.util.concurrent.Flow
public class ControlsMagixClient<T>(

View File

@ -1,6 +1,6 @@
plugins {
id("ru.mipt.npm.jvm")
id("ru.mipt.npm.publish")
id("ru.mipt.npm.gradle.jvm")
`maven-publish`
application
}
@ -12,7 +12,7 @@ kscience {
val dataforgeVersion: String by rootProject.extra
val rsocketVersion: String by rootProject.extra
val ktorVersion: String = ru.mipt.npm.gradle.KScienceVersions.ktorVersion
val ktorVersion: String = "1.5.3"
dependencies{
api(project(":magix:magix-api"))

View File

@ -1,7 +1,5 @@
package hep.dataforge.magix.server
package space.kscience.dataforge.magix.server
import hep.dataforge.magix.api.MagixEndpoint.Companion.DEFAULT_MAGIX_RAW_PORT
import hep.dataforge.magix.api.MagixEndpoint.Companion.DEFAULT_MAGIX_WS_PORT
import io.ktor.network.selector.ActorSelectorManager
import io.ktor.network.sockets.aSocket
import io.ktor.server.cio.CIO
@ -13,6 +11,8 @@ import io.rsocket.kotlin.transport.ktor.serverTransport
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.flow.MutableSharedFlow
import space.kscience.dataforge.magix.api.MagixEndpoint.Companion.DEFAULT_MAGIX_RAW_PORT
import space.kscience.dataforge.magix.api.MagixEndpoint.Companion.DEFAULT_MAGIX_WS_PORT
@OptIn(KtorExperimentalAPI::class)
public fun CoroutineScope.startMagixServer(

View File

@ -1,9 +1,5 @@
package hep.dataforge.magix.server
package space.kscience.dataforge.magix.server
import hep.dataforge.magix.api.MagixEndpoint.Companion.magixJson
import hep.dataforge.magix.api.MagixMessage
import hep.dataforge.magix.api.MagixMessageFilter
import hep.dataforge.magix.api.filter
import io.ktor.application.*
import io.ktor.features.CORS
import io.ktor.features.ContentNegotiation
@ -29,6 +25,10 @@ import kotlinx.coroutines.flow.*
import kotlinx.html.*
import kotlinx.serialization.KSerializer
import kotlinx.serialization.json.JsonElement
import space.kscience.dataforge.magix.api.MagixEndpoint.Companion.magixJson
import space.kscience.dataforge.magix.api.MagixMessage
import space.kscience.dataforge.magix.api.MagixMessageFilter
import space.kscience.dataforge.magix.api.filter
import java.util.*
public typealias GenericMagixMessage = MagixMessage<JsonElement>

View File

@ -1,4 +1,4 @@
package hep.dataforge.magix.server
package space.kscience.dataforge.magix.server
import io.ktor.application.ApplicationCall
import io.ktor.http.CacheControl

View File

@ -1,6 +1,6 @@
plugins {
id("ru.mipt.npm.mpp")
id("ru.mipt.npm.publish")
id("ru.mipt.npm.gradle.mpp")
`maven-publish`
}
kscience {

View File

@ -1,8 +1,5 @@
package hep.dataforge.magix.service
package space.kscience.dataforge.magix.service
import hep.dataforge.magix.api.MagixEndpoint
import hep.dataforge.magix.api.MagixMessage
import hep.dataforge.magix.api.MagixMessageFilter
import io.ktor.client.HttpClient
import io.ktor.client.features.websocket.WebSockets
import io.ktor.util.KtorExperimentalAPI
@ -18,6 +15,9 @@ import kotlinx.coroutines.flow.map
import kotlinx.coroutines.withContext
import kotlinx.serialization.KSerializer
import kotlinx.serialization.encodeToString
import space.kscience.dataforge.magix.api.MagixEndpoint
import space.kscience.dataforge.magix.api.MagixMessage
import space.kscience.dataforge.magix.api.MagixMessageFilter
import kotlin.coroutines.CoroutineContext
import kotlin.coroutines.coroutineContext

View File

@ -1,4 +1,4 @@
package hep.dataforge.magix.service
package space.kscience.dataforge.magix.service
import io.ktor.network.selector.ActorSelectorManager
import io.ktor.network.sockets.SocketOptions

View File

@ -1,6 +1,6 @@
plugins {
id("ru.mipt.npm.jvm")
id("ru.mipt.npm.publish")
id("ru.mipt.npm.gradle.jvm")
`maven-publish`
application
}

View File

@ -1,8 +1,5 @@
package ru.mipt.npm.devices.pimotionmaster
import hep.dataforge.context.Global
import hep.dataforge.control.controllers.DeviceManager
import hep.dataforge.control.controllers.installing
import javafx.beans.property.ReadOnlyProperty
import javafx.beans.property.SimpleIntegerProperty
import javafx.beans.property.SimpleObjectProperty
@ -14,6 +11,9 @@ import javafx.scene.layout.VBox
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Job
import kotlinx.coroutines.launch
import space.kscience.dataforge.context.Global
import space.kscience.dataforge.control.controllers.DeviceManager
import space.kscience.dataforge.control.controllers.installing
import tornadofx.*
class PiMotionMasterApp : App(PiMotionMasterView::class)

View File

@ -2,20 +2,19 @@
package ru.mipt.npm.devices.pimotionmaster
import hep.dataforge.context.Context
import hep.dataforge.context.logger
import hep.dataforge.control.api.DeviceHub
import hep.dataforge.control.api.PropertyDescriptor
import hep.dataforge.control.base.*
import hep.dataforge.control.controllers.*
import hep.dataforge.control.ports.*
import hep.dataforge.meta.*
import hep.dataforge.names.NameToken
import hep.dataforge.values.asValue
import kotlinx.coroutines.*
import kotlinx.coroutines.flow.*
import kotlinx.coroutines.sync.Mutex
import kotlinx.coroutines.sync.withLock
import space.kscience.dataforge.context.*
import space.kscience.dataforge.control.api.DeviceHub
import space.kscience.dataforge.control.api.PropertyDescriptor
import space.kscience.dataforge.control.base.*
import space.kscience.dataforge.control.controllers.*
import space.kscience.dataforge.control.ports.*
import space.kscience.dataforge.meta.*
import space.kscience.dataforge.names.NameToken
import space.kscience.dataforge.values.asValue
import tornadofx.*
import java.util.*
import kotlin.error

View File

@ -1,16 +1,14 @@
package ru.mipt.npm.devices.pimotionmaster
import hep.dataforge.context.Context
import hep.dataforge.context.ContextAware
import hep.dataforge.context.logger
import hep.dataforge.control.api.Socket
import hep.dataforge.control.ports.AbstractPort
import hep.dataforge.control.ports.withDelimiter
import kotlinx.coroutines.*
import kotlinx.coroutines.channels.Channel
import kotlinx.coroutines.flow.*
import kotlinx.coroutines.sync.Mutex
import kotlinx.coroutines.sync.withLock
import space.kscience.dataforge.context.*
import space.kscience.dataforge.control.api.Socket
import space.kscience.dataforge.control.ports.AbstractPort
import space.kscience.dataforge.control.ports.withDelimiter
import kotlin.math.abs
import kotlin.time.Duration

View File

@ -1,15 +1,16 @@
package ru.mipt.npm.devices.pimotionmaster
import hep.dataforge.context.logger
import hep.dataforge.control.api.Device
import hep.dataforge.control.base.TypedDeviceProperty
import hep.dataforge.control.base.TypedReadOnlyDeviceProperty
import javafx.beans.property.ObjectPropertyBase
import javafx.beans.property.Property
import javafx.beans.property.ReadOnlyProperty
import kotlinx.coroutines.flow.catch
import kotlinx.coroutines.flow.launchIn
import kotlinx.coroutines.flow.onEach
import space.kscience.dataforge.context.info
import space.kscience.dataforge.context.logger
import space.kscience.dataforge.control.api.Device
import space.kscience.dataforge.control.base.TypedDeviceProperty
import space.kscience.dataforge.control.base.TypedReadOnlyDeviceProperty
import tornadofx.*
fun <T : Any> TypedReadOnlyDeviceProperty<T>.fxProperty(ownerDevice: Device?): ReadOnlyProperty<T> =

View File

@ -1,7 +1,5 @@
package ru.mipt.npm.devices.pimotionmaster
import hep.dataforge.context.Context
import hep.dataforge.context.Global
import io.ktor.network.selector.ActorSelectorManager
import io.ktor.network.sockets.aSocket
import io.ktor.network.sockets.openReadChannel
@ -12,6 +10,8 @@ import io.ktor.util.moveToByteArray
import io.ktor.utils.io.writeAvailable
import kotlinx.coroutines.*
import kotlinx.coroutines.flow.collect
import space.kscience.dataforge.context.Context
import space.kscience.dataforge.context.Global
import java.net.InetSocketAddress
val exceptionHandler = CoroutineExceptionHandler { _, throwable ->

View File

@ -1,26 +1,23 @@
pluginManagement {
val kotlinVersion = "1.4.30"
val toolsVersion = "0.7.6"
val kotlinVersion = "1.4.32"
val toolsVersion = "0.9.3"
repositories {
mavenLocal()
jcenter()
maven("https://repo.kotlin.link")
mavenCentral()
gradlePluginPortal()
//maven("https://kotlin.bintray.com/kotlinx")
maven("https://dl.bintray.com/kotlin/kotlin-eap")
maven("https://dl.bintray.com/mipt-npm/dataforge")
maven("https://dl.bintray.com/mipt-npm/kscience")
maven("https://dl.bintray.com/mipt-npm/dev")
}
plugins {
id("ru.mipt.npm.project") version toolsVersion
id("ru.mipt.npm.mpp") version toolsVersion
id("ru.mipt.npm.jvm") version toolsVersion
id("ru.mipt.npm.js") version toolsVersion
id("ru.mipt.npm.publish") version toolsVersion
id("ru.mipt.npm.gradle.project") version toolsVersion
id("ru.mipt.npm.gradle.mpp") version toolsVersion
id("ru.mipt.npm.gradle.jvm") version toolsVersion
id("ru.mipt.npm.gradle.js") version toolsVersion
id("ru.mipt.npm.gradle.publish") version toolsVersion
kotlin("jvm") version kotlinVersion
kotlin("js") version kotlinVersion
kotlin("multiplatform") version kotlinVersion
}
}