commonMain.com.divpundir.mavlink.definitions.common.LogRequestEnd.kt Maven / Gradle / Ivy
package com.divpundir.mavlink.definitions.common
import com.divpundir.mavlink.api.GeneratedMavField
import com.divpundir.mavlink.api.GeneratedMavMessage
import com.divpundir.mavlink.api.MavMessage
import com.divpundir.mavlink.serialization.MavDataDecoder
import com.divpundir.mavlink.serialization.MavDataEncoder
import com.divpundir.mavlink.serialization.encodeUInt8
import com.divpundir.mavlink.serialization.safeDecodeUInt8
import com.divpundir.mavlink.serialization.truncateZeros
import kotlin.Byte
import kotlin.ByteArray
import kotlin.Int
import kotlin.UByte
import kotlin.UInt
import kotlin.Unit
/**
* Stop log transfer and resume normal logging
*
* @param targetSystem System ID
* @param targetComponent Component ID
*/
@GeneratedMavMessage(
id = 122u,
crcExtra = -53,
)
public data class LogRequestEnd(
/**
* System ID
*/
@GeneratedMavField(type = "uint8_t")
public val targetSystem: UByte = 0u,
/**
* Component ID
*/
@GeneratedMavField(type = "uint8_t")
public val targetComponent: UByte = 0u,
) : MavMessage {
override val instanceCompanion: MavMessage.MavCompanion = Companion
override fun serializeV1(): ByteArray {
val encoder = MavDataEncoder(SIZE_V1)
encoder.encodeUInt8(targetSystem)
encoder.encodeUInt8(targetComponent)
return encoder.bytes
}
override fun serializeV2(): ByteArray {
val encoder = MavDataEncoder(SIZE_V2)
encoder.encodeUInt8(targetSystem)
encoder.encodeUInt8(targetComponent)
return encoder.bytes.truncateZeros()
}
public companion object : MavMessage.MavCompanion {
private const val SIZE_V1: Int = 2
private const val SIZE_V2: Int = 2
override val id: UInt = 122u
override val crcExtra: Byte = -53
override fun deserialize(bytes: ByteArray): LogRequestEnd {
val decoder = MavDataDecoder(bytes)
val targetSystem = decoder.safeDecodeUInt8()
val targetComponent = decoder.safeDecodeUInt8()
return LogRequestEnd(
targetSystem = targetSystem,
targetComponent = targetComponent,
)
}
public operator fun invoke(builderAction: Builder.() -> Unit): LogRequestEnd =
Builder().apply(builderAction).build()
}
public class Builder {
public var targetSystem: UByte = 0u
public var targetComponent: UByte = 0u
public fun build(): LogRequestEnd = LogRequestEnd(
targetSystem = targetSystem,
targetComponent = targetComponent,
)
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy