Updating control
This commit is contained in:
parent
98ef7688d5
commit
68fa5c715b
@ -58,5 +58,6 @@ class LambdaHub(context: Context, meta: Meta) : DeviceHub, AbstractDevice(contex
|
|||||||
override fun optDevice(name: Name): Optional<Device> =
|
override fun optDevice(name: Name): Optional<Device> =
|
||||||
magnets.stream().filter { it.name == name.toUnescaped() }.map { it as Device }.findFirst()
|
magnets.stream().filter { it.name == name.toUnescaped() }.map { it as Device }.findFirst()
|
||||||
|
|
||||||
override fun getDeviceNames(): Stream<Name> = magnets.stream().map { Name.ofSingle(it.name) }
|
override val deviceNames: Stream<Name>
|
||||||
|
get() = magnets.stream().map { Name.ofSingle(it.name) }
|
||||||
}
|
}
|
@ -12,9 +12,7 @@ import javafx.stage.Stage
|
|||||||
class MagnetApp: NumassControlApplication<LambdaHub>() {
|
class MagnetApp: NumassControlApplication<LambdaHub>() {
|
||||||
|
|
||||||
override val deviceFactory: DeviceFactory = object :DeviceFactory{
|
override val deviceFactory: DeviceFactory = object :DeviceFactory{
|
||||||
override fun getType(): String {
|
override val type: String = "numass.lambda"
|
||||||
return "numass.lambda"
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun build(context: Context, meta: Meta): Device {
|
override fun build(context: Context, meta: Meta): Device {
|
||||||
return LambdaHub(context, meta)
|
return LambdaHub(context, meta)
|
||||||
|
@ -124,7 +124,8 @@ class MspDevice(context: Context, meta: Meta) : PortSensor(context, meta) {
|
|||||||
// else -> super.computeState(stateName)
|
// else -> super.computeState(stateName)
|
||||||
// }
|
// }
|
||||||
|
|
||||||
override fun getType(): String = MSP_DEVICE_TYPE
|
override val type: String
|
||||||
|
get() = MSP_DEVICE_TYPE
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Startup MSP: get available sensors, select sensor and control.
|
* Startup MSP: get available sensors, select sensor and control.
|
||||||
|
@ -136,9 +136,15 @@ abstract class DeviceDisplayFX<D : Device> : Component(), Connection, DeviceList
|
|||||||
alignment = Pos.CENTER_LEFT
|
alignment = Pos.CENTER_LEFT
|
||||||
vgrow = Priority.ALWAYS;
|
vgrow = Priority.ALWAYS;
|
||||||
deviceStateIndicator(this@DeviceDisplayFX, Device.INITIALIZED_STATE)
|
deviceStateIndicator(this@DeviceDisplayFX, Device.INITIALIZED_STATE)
|
||||||
deviceStateIndicator(this@DeviceDisplayFX, PortSensor.CONNECTED_STATE)
|
if(device is PortSensor) {
|
||||||
deviceStateIndicator(this@DeviceDisplayFX, Sensor.MEASURING_STATE)
|
deviceStateIndicator(this@DeviceDisplayFX, PortSensor.CONNECTED_STATE)
|
||||||
deviceStateIndicator(this@DeviceDisplayFX, "storing")
|
}
|
||||||
|
if(device is Sensor) {
|
||||||
|
deviceStateIndicator(this@DeviceDisplayFX, Sensor.MEASURING_STATE)
|
||||||
|
}
|
||||||
|
if(device.stateNames.contains("storing")) {
|
||||||
|
deviceStateIndicator(this@DeviceDisplayFX, "storing")
|
||||||
|
}
|
||||||
pane {
|
pane {
|
||||||
hgrow = Priority.ALWAYS
|
hgrow = Priority.ALWAYS
|
||||||
}
|
}
|
||||||
|
@ -52,8 +52,9 @@ class CM32Device(context: Context, meta: Meta) : PortSensor(context, meta) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun getType(): String {
|
override val type: String
|
||||||
return meta.getString("type", "numass.vac.cm32")
|
get() {
|
||||||
}
|
return meta.getString("type", "numass.vac.cm32")
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -27,9 +27,10 @@ class MKSBaratronDevice(context: Context, meta: Meta) : PortSensor(context, meta
|
|||||||
|
|
||||||
var channel by valueState("channel").intDelegate
|
var channel by valueState("channel").intDelegate
|
||||||
|
|
||||||
override fun getType(): String {
|
override val type: String
|
||||||
return meta.getString("type", "numass.vac.baratron")
|
get() {
|
||||||
}
|
return meta.getString("type", "numass.vac.baratron")
|
||||||
|
}
|
||||||
|
|
||||||
override fun connect(meta: Meta): GenericPortController {
|
override fun connect(meta: Meta): GenericPortController {
|
||||||
val port: Port = PortFactory.build(meta)
|
val port: Port = PortFactory.build(meta)
|
||||||
|
@ -97,7 +97,8 @@ class MKSVacDevice(context: Context, meta: Meta) : PortSensor(context, meta) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun getType(): String = meta.getString("type", "numass.vac.mks")
|
override val type: String
|
||||||
|
get() = meta.getString("type", "numass.vac.mks")
|
||||||
|
|
||||||
override fun startMeasurement(oldMeta: Meta?, newMeta: Meta) {
|
override fun startMeasurement(oldMeta: Meta?, newMeta: Meta) {
|
||||||
measurement {
|
measurement {
|
||||||
|
@ -35,9 +35,10 @@ class MeradatVacDevice(context: Context, meta: Meta) : PortSensor(context, meta)
|
|||||||
return GenericPortController(context, port) { it.endsWith("\r\n") }
|
return GenericPortController(context, port) { it.endsWith("\r\n") }
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun getType(): String {
|
override val type: String
|
||||||
return meta.getString("type", "numass.vac.vit")
|
get() {
|
||||||
}
|
return meta.getString("type", "numass.vac.vit")
|
||||||
|
}
|
||||||
|
|
||||||
override fun startMeasurement(oldMeta: Meta?, newMeta: Meta) {
|
override fun startMeasurement(oldMeta: Meta?, newMeta: Meta) {
|
||||||
measurement{
|
measurement{
|
||||||
|
@ -75,7 +75,8 @@ class VacCollectorDevice(context: Context, meta: Meta, val sensors: Collection<S
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun getType(): String = "numass.vac.collector"
|
override val type: String
|
||||||
|
get() = "numass.vac.collector"
|
||||||
|
|
||||||
|
|
||||||
@Throws(ControlException::class)
|
@Throws(ControlException::class)
|
||||||
|
@ -29,6 +29,10 @@ protobuf {
|
|||||||
generatedFilesBaseDir = "$projectDir/gen"
|
generatedFilesBaseDir = "$projectDir/gen"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
compileKotlin {
|
||||||
|
dependsOn(':numass-core:generateProto')
|
||||||
|
}
|
||||||
|
|
||||||
sourceSets {
|
sourceSets {
|
||||||
main.kotlin.srcDirs += 'gen/main/java'
|
main.kotlin.srcDirs += 'gen/main/java'
|
||||||
}
|
}
|
||||||
|
@ -95,7 +95,7 @@ val deviceInterceptor = InterceptorFactory { context, meta ->
|
|||||||
val device = deviceManager.optDevice(name).get();
|
val device = deviceManager.optDevice(name).get();
|
||||||
devices.add(jsonObject {
|
devices.add(jsonObject {
|
||||||
add("name", name.toUnescaped())
|
add("name", name.toUnescaped())
|
||||||
add("type", device.getType())
|
add("type", device.type)
|
||||||
add("getMeta", device.meta.asJson())
|
add("getMeta", device.meta.asJson())
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user