ring bus debugger ui wip

This commit is contained in:
minjaesong
2025-03-03 21:27:35 +09:00
parent f861a2727d
commit fea4e34733
5 changed files with 513 additions and 250 deletions

View File

@@ -144,6 +144,18 @@ data class NetFrame(val byteArray: ByteArray) {
it.writeBigInt32(recipient, 6)
it.writeBigInt16(status, 10)
})
fun Int.toMAC() = this.ushr(16).toString(16).uppercase().padStart(4,'0') + "." + this.and(65535).toString(16).uppercase().padStart(4,'0')
}
override fun toString(): String {
val frameType = getFrameType()
return "Frame($frameType[${getFrameNumber()}] from ${getSender().toMAC()})" + when (frameType) {
"data" -> ": to ${getDataRecipient().toMAC()}, datagram size: ${byteArray.size - 18} bytes"
"ack" -> ": to ${getDataRecipient().toMAC()}"
"ballot" -> ": current candidate: ${getBallot().toMAC()}"
else -> ""
}
}
}