package rename

This commit is contained in:
Alexander Nozik 2021-04-11 15:12:09 +03:00
parent bf51768fe1
commit e3ea2304ef
41 changed files with 87 additions and 33 deletions

View File

@ -31,7 +31,7 @@ Among other things, you can:
### `dataforge-control-core` module packages
- `api` - defines API for device management. The main class here is
[`Device`](controls-core/src/commonMain/kotlin/hep/dataforge/control/api/Device.kt).
[`Device`](controls-core/src/commonMain/kotlin/ru/mipt/npm/controls/api/Device.kt).
Generally, a Device has Properties that can be read and written. Also, some Actions
can optionally be applied on a device (may or may not affect properties).

View File

@ -4,7 +4,7 @@ plugins {
kotlin("js") apply false
}
val dataforgeVersion: String by extra("0.4.0-dev-2")
val dataforgeVersion: String by extra("0.4.0-dev-8")
val ktorVersion: String by extra(ru.mipt.npm.gradle.KScienceVersions.ktorVersion)
val rsocketVersion by extra("0.12.0")

View File

@ -24,6 +24,10 @@ public data class LogEntry(val content: String, val priority: Int = 0)
@Suppress("EXPERIMENTAL_API_USAGE")
public abstract class DeviceBase(override val context: Context) : Device {
override val scope: CoroutineScope by lazy {
CoroutineScope(context.coroutineContext + Job(context.coroutineContext[Job]))
}
private val _properties = HashMap<String, ReadOnlyDeviceProperty>()
public val properties: Map<String, ReadOnlyDeviceProperty> get() = _properties
private val _actions = HashMap<String, DeviceAction>()

View File

@ -1,24 +0,0 @@
package space.kscience.dataforge.control.client
public sealed class TangoPayload(
val host: String,
val device: String,
val name: String,
val timestamp: Long? = null,
val quality: String = "VALID",
val event: String? = null,
// val input: Any? = null,
// val output: Any? = null,
// val errors: Iterable<Any?>?,
)
public class TangoAttributePayload(
host: String,
device: String,
name: String,
val value: Any? = null,
timestamp: Long? = null,
quality: String = "VALID",
event: String? = null,
errors: Iterable<Any?>?,
) : TangoPayload(host, device, name, timestamp, quality, event)

View File

@ -0,0 +1,24 @@
package space.kscience.dataforge.control.client
//public sealed class TangoPayload(
// val host: String,
// val device: String,
// val name: String,
// val timestamp: Long? = null,
// val quality: String = "VALID",
// val event: String? = null,
//// val input: Any? = null,
//// val output: Any? = null,
//// val errors: Iterable<Any?>?,
//)
//
//public class TangoAttributePayload(
// host: String,
// device: String,
// name: String,
// val value: Any? = null,
// timestamp: Long? = null,
// quality: String = "VALID",
// event: String? = null,
// errors: Iterable<Any?>?,
//) : TangoPayload(host, device, name, timestamp, quality, event)

View File

@ -0,0 +1,21 @@
plugins {
id("ru.mipt.npm.gradle.mpp")
`maven-publish`
}
kscience{
useSerialization {
json()
}
}
kotlin {
sourceSets {
commonMain {
dependencies {
implementation(project(":magix:magix-server"))
implementation(project(":controls-core"))
}
}
}
}

View File

@ -18,7 +18,7 @@ class DemoController : Controller(), ContextAware {
var device: DemoDevice? = null
var server: ApplicationEngine? = null
override val context = Global.context("demoDevice")
override val context = Global.buildContext("demoDevice")
fun init() {
context.launch {

View File

@ -0,0 +1,25 @@
@startuml
participant Physical
participant Logical
participant Remote
group Asynchronous update
Physical -> Logical: Notify changed
Logical -> Remote: Send event
end
group Timed update
Logical -> Logical: Timed check
Logical -> Physical: Request value
Physical -> Logical: Respond
Logical --> Remote: Send event if changed
end
group Request update
Remote -> Logical: Request value
Logical --> Physical: Request if needed
Physical --> Logical: Respond
Logical -> Remote: Force send event
end
@enduml

View File

@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.8-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.0-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

View File

@ -12,7 +12,7 @@ kscience {
val dataforgeVersion: String by rootProject.extra
val rsocketVersion: String by rootProject.extra
val ktorVersion: String = "1.5.3"
val ktorVersion: String = ru.mipt.npm.gradle.KScienceVersions.ktorVersion
dependencies{
api(project(":magix:magix-api"))

View File

@ -12,6 +12,7 @@ import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Job
import kotlinx.coroutines.launch
import space.kscience.dataforge.context.Global
import space.kscience.dataforge.context.fetch
import space.kscience.dataforge.control.controllers.DeviceManager
import space.kscience.dataforge.control.controllers.installing
import tornadofx.*
@ -20,10 +21,12 @@ class PiMotionMasterApp : App(PiMotionMasterView::class)
class PiMotionMasterController : Controller() {
//initialize context
val context = Global.context("piMotionMaster")
val context = Global.buildContext("piMotionMaster"){
plugin(DeviceManager)
}
//initialize deviceManager plugin
val deviceManager: DeviceManager = context.plugins.load(DeviceManager)
val deviceManager: DeviceManager = context.fetch(DeviceManager)
// install device
val motionMaster: PiMotionMasterDevice by deviceManager.installing(PiMotionMasterDevice)

View File

@ -1,6 +1,6 @@
pluginManagement {
val kotlinVersion = "1.4.32"
val toolsVersion = "0.9.3"
val kotlinVersion = "1.5.0-M2"
val toolsVersion = "0.9.5-dev"
repositories {
mavenLocal()
@ -35,6 +35,7 @@ include(
":magix:magix-service",
":magix:magix-java-client",
":controls-magix-client",
":controls-magix-server",
":motors"
)