File tree Expand file tree Collapse file tree
library/src/commonMain/kotlin/org/meshtastic/mqtt/packet Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -548,9 +548,16 @@ private fun decodePropertiesSection(
548548 return props to (lengthResult.bytesConsumed + propsLength)
549549}
550550
551- private fun ByteArray.toHexDump (): String =
552- if (size <= 64 ) joinToString(" " ) { " %02x" .format(it) }
553- else take(64 ).joinToString(" " ) { " %02x" .format(it) } + " ...(${size} total)"
551+ private fun ByteArray.toHexDump (): String {
552+ fun Byte.hex (): String {
553+ val i = toInt() and 0xFF
554+ val hi = " 0123456789abcdef" [i ushr 4 ]
555+ val lo = " 0123456789abcdef" [i and 0x0F ]
556+ return " $hi$lo "
557+ }
558+ return if (size <= 64 ) joinToString(" " ) { it.hex() }
559+ else take(64 ).joinToString(" " ) { it.hex() } + " ...(${size} total)"
560+ }
554561
555562/* *
556563 * Map an MQTT 3.1.1 CONNACK return code (§3.2.2.3) to a [ReasonCode].
You can’t perform that action at this time.
0 commit comments