Protocol Message
Marks a data class or sealed interface as a protocol message. KSP will generate a Codec implementation for this type at compile time.
@ProtocolMessage
data class SensorReading(
val sensorId: UShort, // 2 bytes
val temperature: Int, // 4 bytes
)
// Generates SensorReadingCodec with decode(), encode(), and sizeOf()Content copied to clipboard
Note: Generated code appears after compilation (./gradlew build). IDE features (autocomplete, navigation) for generated codecs require an initial build.
Properties
Link copied to clipboard
Wire byte order for all multi-byte numeric fields in this message. Defaults to Endianness.Default (use the buffer's byte order).