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> =
|
||||
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>() {
|
||||
|
||||
override val deviceFactory: DeviceFactory = object :DeviceFactory{
|
||||
override fun getType(): String {
|
||||
return "numass.lambda"
|
||||
}
|
||||
override val type: String = "numass.lambda"
|
||||
|
||||
override fun build(context: Context, meta: Meta): Device {
|
||||
return LambdaHub(context, meta)
|
||||
|
@ -124,7 +124,8 @@ class MspDevice(context: Context, meta: Meta) : PortSensor(context, meta) {
|
||||
// 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.
|
||||
|
@ -136,9 +136,15 @@ abstract class DeviceDisplayFX<D : Device> : Component(), Connection, DeviceList
|
||||
alignment = Pos.CENTER_LEFT
|
||||
vgrow = Priority.ALWAYS;
|
||||
deviceStateIndicator(this@DeviceDisplayFX, Device.INITIALIZED_STATE)
|
||||
deviceStateIndicator(this@DeviceDisplayFX, PortSensor.CONNECTED_STATE)
|
||||
deviceStateIndicator(this@DeviceDisplayFX, Sensor.MEASURING_STATE)
|
||||
deviceStateIndicator(this@DeviceDisplayFX, "storing")
|
||||
if(device is PortSensor) {
|
||||
deviceStateIndicator(this@DeviceDisplayFX, PortSensor.CONNECTED_STATE)
|
||||
}
|
||||
if(device is Sensor) {
|
||||
deviceStateIndicator(this@DeviceDisplayFX, Sensor.MEASURING_STATE)
|
||||
}
|
||||
if(device.stateNames.contains("storing")) {
|
||||
deviceStateIndicator(this@DeviceDisplayFX, "storing")
|
||||
}
|
||||
pane {
|
||||
hgrow = Priority.ALWAYS
|
||||
}
|
||||
|
@ -52,8 +52,9 @@ class CM32Device(context: Context, meta: Meta) : PortSensor(context, meta) {
|
||||
}
|
||||
}
|
||||
|
||||
override fun getType(): String {
|
||||
return meta.getString("type", "numass.vac.cm32")
|
||||
}
|
||||
override val type: String
|
||||
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
|
||||
|
||||
override fun getType(): String {
|
||||
return meta.getString("type", "numass.vac.baratron")
|
||||
}
|
||||
override val type: String
|
||||
get() {
|
||||
return meta.getString("type", "numass.vac.baratron")
|
||||
}
|
||||
|
||||
override fun connect(meta: Meta): GenericPortController {
|
||||
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) {
|
||||
measurement {
|
||||
|
@ -35,9 +35,10 @@ class MeradatVacDevice(context: Context, meta: Meta) : PortSensor(context, meta)
|
||||
return GenericPortController(context, port) { it.endsWith("\r\n") }
|
||||
}
|
||||
|
||||
override fun getType(): String {
|
||||
return meta.getString("type", "numass.vac.vit")
|
||||
}
|
||||
override val type: String
|
||||
get() {
|
||||
return meta.getString("type", "numass.vac.vit")
|
||||
}
|
||||
|
||||
override fun startMeasurement(oldMeta: Meta?, newMeta: Meta) {
|
||||
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)
|
||||
|
@ -29,6 +29,10 @@ protobuf {
|
||||
generatedFilesBaseDir = "$projectDir/gen"
|
||||
}
|
||||
|
||||
compileKotlin {
|
||||
dependsOn(':numass-core:generateProto')
|
||||
}
|
||||
|
||||
sourceSets {
|
||||
main.kotlin.srcDirs += 'gen/main/java'
|
||||
}
|
||||
|
@ -95,7 +95,7 @@ val deviceInterceptor = InterceptorFactory { context, meta ->
|
||||
val device = deviceManager.optDevice(name).get();
|
||||
devices.add(jsonObject {
|
||||
add("name", name.toUnescaped())
|
||||
add("type", device.getType())
|
||||
add("type", device.type)
|
||||
add("getMeta", device.meta.asJson())
|
||||
})
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user