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