maauto: log full control payloads inbound
- Commit
21becb2d3f875c1ae41c76f88e806d65af107542- Author
- vayun-mathur <[email protected]>
- When
- 2026-09-12 14:46 UTC (2 months ago)
- Parents
6284b3b
Diff
auto/protocol/src/main/java/com/vayunmathur/auto/protocol/GalConnection.kt
diff --git a/auto/protocol/src/main/java/com/vayunmathur/auto/protocol/GalConnection.kt b/auto/protocol/src/main/java/com/vayunmathur/auto/protocol/GalConnection.ktindex 71492e4926..844909e2a2 100644--- a/auto/protocol/src/main/java/com/vayunmathur/auto/protocol/GalConnection.kt+++ b/auto/protocol/src/main/java/com/vayunmathur/auto/protocol/GalConnection.kt@@ -77,14 +77,14 @@ class GalConnection( val replies = session.onMessage(decoded.type, decoded.payload) // Log the payload: incoming message bodies are otherwise invisible, and // the head unit's answers (discovery list, open status, errors) carry- // the only explanation we ever get for a rejection. First bytes only:- // enough for status enums and service ids, small enough to read.+ // the only explanation we ever get for a rejection. Control payloads+ // are small (a discovery response is a few hundred bytes) and each+ // log line comfortably holds ~1.5KB of hex, so log them whole: the+ // 64-byte cap once hid the 569-byte service list we needed to see. trace( "ctrl in 0x${decoded.type.toString(16)} (${decoded.payload.size}B) " + "$before -> ${session.state}, ${replies.size} reply " +- decoded.payload.take(IN_PAYLOAD_LOG_BYTES).joinToString("") {- "%02x".format(it)- },+ decoded.payload.joinToString("") { "%02x".format(it) }, ) session.failure?.let { trace("session failed: $it") } replies.forEach(::send)@@ -145,7 +145,7 @@ class GalConnection( /** Comfortably larger than one frame, so a read rarely splits one. */ const val READ_BUFFER_SIZE = 32 * 1024 - /** Bytes of each inbound payload in the trace log: enough for ids and statuses. */+ /** Bytes of each service-channel payload in the trace log. */ const val IN_PAYLOAD_LOG_BYTES = 64 } }