commonMain.com.divpundir.mavlink.definitions.matrixpilot.FlexifunctionCommandAck.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of definitions-jvm Show documentation
Show all versions of definitions-jvm Show documentation
A modern MAVLink library for the JVM written in Kotlin.
The newest version!
package com.divpundir.mavlink.definitions.matrixpilot
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.encodeUInt16
import com.divpundir.mavlink.serialization.safeDecodeUInt16
import com.divpundir.mavlink.serialization.truncateZeros
import kotlin.Byte
import kotlin.ByteArray
import kotlin.Int
import kotlin.UInt
import kotlin.UShort
import kotlin.Unit
/**
* Acknowldge success or failure of a flexifunction command
*
* @param commandType Command acknowledged
* @param result result of acknowledge
*/
@GeneratedMavMessage(
id = 158u,
crcExtra = -48,
)
public data class FlexifunctionCommandAck(
/**
* Command acknowledged
*/
@GeneratedMavField(type = "uint16_t")
public val commandType: UShort = 0u,
/**
* result of acknowledge
*/
@GeneratedMavField(type = "uint16_t")
public val result: UShort = 0u,
) : MavMessage {
override val instanceCompanion: MavMessage.MavCompanion = Companion
override fun serializeV1(): ByteArray {
val encoder = MavDataEncoder(SIZE_V1)
encoder.encodeUInt16(commandType)
encoder.encodeUInt16(result)
return encoder.bytes
}
override fun serializeV2(): ByteArray {
val encoder = MavDataEncoder(SIZE_V2)
encoder.encodeUInt16(commandType)
encoder.encodeUInt16(result)
return encoder.bytes.truncateZeros()
}
public companion object : MavMessage.MavCompanion {
private const val SIZE_V1: Int = 4
private const val SIZE_V2: Int = 4
override val id: UInt = 158u
override val crcExtra: Byte = -48
override fun deserialize(bytes: ByteArray): FlexifunctionCommandAck {
val decoder = MavDataDecoder(bytes)
val commandType = decoder.safeDecodeUInt16()
val result = decoder.safeDecodeUInt16()
return FlexifunctionCommandAck(
commandType = commandType,
result = result,
)
}
public operator fun invoke(builderAction: Builder.() -> Unit): FlexifunctionCommandAck =
Builder().apply(builderAction).build()
}
public class Builder {
public var commandType: UShort = 0u
public var result: UShort = 0u
public fun build(): FlexifunctionCommandAck = FlexifunctionCommandAck(
commandType = commandType,
result = result,
)
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy