commonMain.aws.sdk.kotlin.services.iotwireless.serde.SidewalkDeviceMetadataDocumentDeserializer.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of iotwireless-jvm Show documentation
Show all versions of iotwireless-jvm Show documentation
The AWS Kotlin client for IoT Wireless
// Code generated by smithy-kotlin-codegen. DO NOT EDIT!
package aws.sdk.kotlin.services.iotwireless.serde
import aws.sdk.kotlin.services.iotwireless.model.BatteryLevel
import aws.sdk.kotlin.services.iotwireless.model.DeviceState
import aws.sdk.kotlin.services.iotwireless.model.Event
import aws.sdk.kotlin.services.iotwireless.model.SidewalkDeviceMetadata
import aws.smithy.kotlin.runtime.serde.Deserializer
import aws.smithy.kotlin.runtime.serde.SdkFieldDescriptor
import aws.smithy.kotlin.runtime.serde.SdkObjectDescriptor
import aws.smithy.kotlin.runtime.serde.SerialKind
import aws.smithy.kotlin.runtime.serde.asSdkSerializable
import aws.smithy.kotlin.runtime.serde.deserializeList
import aws.smithy.kotlin.runtime.serde.deserializeMap
import aws.smithy.kotlin.runtime.serde.deserializeStruct
import aws.smithy.kotlin.runtime.serde.field
import aws.smithy.kotlin.runtime.serde.json.JsonDeserializer
import aws.smithy.kotlin.runtime.serde.json.JsonSerialName
import aws.smithy.kotlin.runtime.serde.serializeList
import aws.smithy.kotlin.runtime.serde.serializeMap
import aws.smithy.kotlin.runtime.serde.serializeStruct
internal fun deserializeSidewalkDeviceMetadataDocument(deserializer: Deserializer): SidewalkDeviceMetadata {
val builder = SidewalkDeviceMetadata.Builder()
val BATTERYLEVEL_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Enum, JsonSerialName("BatteryLevel"))
val DEVICESTATE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Enum, JsonSerialName("DeviceState"))
val EVENT_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Enum, JsonSerialName("Event"))
val RSSI_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Integer, JsonSerialName("Rssi"))
val OBJ_DESCRIPTOR = SdkObjectDescriptor.build {
field(BATTERYLEVEL_DESCRIPTOR)
field(DEVICESTATE_DESCRIPTOR)
field(EVENT_DESCRIPTOR)
field(RSSI_DESCRIPTOR)
}
deserializer.deserializeStruct(OBJ_DESCRIPTOR) {
loop@while (true) {
when (findNextFieldIndex()) {
BATTERYLEVEL_DESCRIPTOR.index -> builder.batteryLevel = deserializeString().let { BatteryLevel.fromValue(it) }
DEVICESTATE_DESCRIPTOR.index -> builder.deviceState = deserializeString().let { DeviceState.fromValue(it) }
EVENT_DESCRIPTOR.index -> builder.event = deserializeString().let { Event.fromValue(it) }
RSSI_DESCRIPTOR.index -> builder.rssi = deserializeInt()
null -> break@loop
else -> skipValue()
}
}
}
builder.correctErrors()
return builder.build()
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy