Message class hierarchy.
This commit is contained in:
parent
d68f5a9840
commit
93c82db08e
@ -75,6 +75,7 @@ public class DeviceController(
|
||||
targetDevice = request.sourceDevice
|
||||
)
|
||||
}
|
||||
|
||||
is PropertySetMessage -> {
|
||||
if (request.value == null) {
|
||||
device.invalidateProperty(request.property)
|
||||
@ -88,6 +89,7 @@ public class DeviceController(
|
||||
targetDevice = request.sourceDevice
|
||||
)
|
||||
}
|
||||
|
||||
is ActionExecuteMessage -> {
|
||||
ActionResultMessage(
|
||||
action = request.action,
|
||||
@ -96,6 +98,7 @@ public class DeviceController(
|
||||
targetDevice = request.sourceDevice
|
||||
)
|
||||
}
|
||||
|
||||
is GetDescriptionMessage -> {
|
||||
val descriptionMeta = Meta {
|
||||
"properties" put {
|
||||
@ -117,7 +120,14 @@ public class DeviceController(
|
||||
)
|
||||
}
|
||||
|
||||
is DescriptionMessage, is PropertyChangedMessage, is ActionResultMessage, is BinaryNotificationMessage, is DeviceErrorMessage, is EmptyDeviceMessage -> {
|
||||
is DescriptionMessage,
|
||||
is PropertyChangedMessage,
|
||||
is ActionResultMessage,
|
||||
is BinaryNotificationMessage,
|
||||
is DeviceErrorMessage,
|
||||
is EmptyDeviceMessage,
|
||||
is DeviceLogMessage,
|
||||
-> {
|
||||
//Those messages are ignored
|
||||
EmptyDeviceMessage(
|
||||
sourceDevice = deviceTarget,
|
||||
|
@ -9,7 +9,7 @@ import kotlinx.serialization.json.decodeFromJsonElement
|
||||
import kotlinx.serialization.json.encodeToJsonElement
|
||||
|
||||
@Serializable
|
||||
public sealed class DeviceMessage{
|
||||
public sealed class DeviceMessage {
|
||||
public abstract val sourceDevice: String?
|
||||
public abstract val targetDevice: String?
|
||||
public abstract val comment: String?
|
||||
@ -133,6 +133,7 @@ public data class EmptyDeviceMessage(
|
||||
@SerialName("log")
|
||||
public data class DeviceLogMessage(
|
||||
val message: String,
|
||||
val data: MetaItem<*>? = null,
|
||||
override val sourceDevice: String? = null,
|
||||
override val targetDevice: String? = null,
|
||||
override val comment: String? = null,
|
||||
|
Loading…
Reference in New Issue
Block a user