summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEdoardo La Greca2025-08-11 19:35:29 +0200
committerEdoardo La Greca2025-08-11 19:35:29 +0200
commite959e5c358964bce8225d62c21c2c31be0b74366 (patch)
tree205e06e7ea852c09b0cfd01a5ae83ead3ed43d1e
parent7c2961a72d4dd2477e561e3009752c1cbd0a22e0 (diff)
add toRaw to QID
-rw-r--r--src/main/kotlin/QID.kt10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/main/kotlin/QID.kt b/src/main/kotlin/QID.kt
index 3e32523..1e03fe8 100644
--- a/src/main/kotlin/QID.kt
+++ b/src/main/kotlin/QID.kt
@@ -1,3 +1,5 @@
+import java.math.BigInteger
+
/**
* This class holds information about a single QID.
*/
@@ -90,4 +92,12 @@ class QID {
private fun getIsTemporary(): Boolean {
return checkTypeBits(0x04u)
}
+
+ fun toRaw(): List<UByte> {
+ var bytes: List<UByte> = emptyList()
+ bytes += this.type
+ bytes += OutMessage.convIntegerToBytes(BigInteger(this.version.toString()), 4u)
+ bytes += OutMessage.convIntegerToBytes(BigInteger(this.path.toString()), 8u)
+ return bytes
+ }
} \ No newline at end of file